diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-27 22:25:15 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-27 22:25:15 -0400 |
commit | 9961abf8f756279ac6d839e0b3de2b0d83431965 (patch) | |
tree | 2defad3f49df2921ff68a48a07a9ca0693a1f0f7 | |
parent | 733e1b1507d27d4f53055f740e8098f56215ab8f (diff) |
[python] conversion from cdec.sa.Rule to cdec.TRule
+ remove configobj dependency
+ re-structure packages (no more top-level library)
+ "const" stuff
+ use __new__ instead of constructor for some objects
-rw-r--r-- | python/README.md | 6 | ||||
-rw-r--r-- | python/cdec/configobj.py | 2468 | ||||
-rw-r--r-- | python/cdec/sa/__init__.py | 2 | ||||
-rw-r--r-- | python/cdec/sa/compile.py | 4 | ||||
-rw-r--r-- | python/cdec/sa/extract.py | 3 | ||||
-rw-r--r-- | python/cdec/sa/extractor.py | 7 | ||||
-rw-r--r-- | python/cdec/sa/features.py | 11 | ||||
-rw-r--r-- | python/setup.py | 6 | ||||
-rw-r--r-- | python/src/_cdec.cpp | 5677 | ||||
-rw-r--r-- | python/src/_cdec.pyx | 10 | ||||
-rw-r--r-- | python/src/grammar.pxd | 13 | ||||
-rw-r--r-- | python/src/grammar.pxi | 61 | ||||
-rw-r--r-- | python/src/hypergraph.pxd | 18 | ||||
-rw-r--r-- | python/src/hypergraph.pxi | 18 | ||||
-rw-r--r-- | python/src/lattice.pxi | 6 | ||||
-rw-r--r-- | python/src/mteval.pxd | 6 | ||||
-rw-r--r-- | python/src/mteval.pxi | 4 | ||||
-rw-r--r-- | python/src/sa/_sa.c (renamed from python/src/sa/_cdec_sa.c) | 16412 | ||||
-rw-r--r-- | python/src/sa/_sa.pxd | 17 | ||||
-rw-r--r-- | python/src/sa/_sa.pyx (renamed from python/src/sa/_cdec_sa.pyx) | 0 | ||||
-rw-r--r-- | python/src/sa/rule.pxi | 39 | ||||
-rw-r--r-- | python/src/sa/rulefactory.pxi | 3 | ||||
-rw-r--r-- | python/src/sa/sym.pxi | 16 | ||||
-rw-r--r-- | python/src/utils.pxd | 5 | ||||
-rw-r--r-- | python/src/vectors.pxi | 26 |
25 files changed, 14738 insertions, 10100 deletions
diff --git a/python/README.md b/python/README.md index 1ddb61a9..da9f9387 100644 --- a/python/README.md +++ b/python/README.md @@ -2,10 +2,6 @@ pycdec is a Python interface to cdec ## Installation -pycdec depends on the configobj module: - - pip install configobj - Build and install pycdec: python setup.py install @@ -30,4 +26,4 @@ More documentation will come as the API becomes stable. --- -pycdec was contributed by [Victor Chahuneau](http://victor.chahuneau.fr)
\ No newline at end of file +pycdec was contributed by [Victor Chahuneau](http://victor.chahuneau.fr) diff --git a/python/cdec/configobj.py b/python/cdec/configobj.py new file mode 100644 index 00000000..c1f6e6df --- /dev/null +++ b/python/cdec/configobj.py @@ -0,0 +1,2468 @@ +# configobj.py +# A config file reader/writer that supports nested sections in config files. +# Copyright (C) 2005-2010 Michael Foord, Nicola Larosa +# E-mail: fuzzyman AT voidspace DOT org DOT uk +# nico AT tekNico DOT net + +# ConfigObj 4 +# http://www.voidspace.org.uk/python/configobj.html + +# Released subject to the BSD License +# Please see http://www.voidspace.org.uk/python/license.shtml + +# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml +# For information about bugfixes, updates and support, please join the +# ConfigObj mailing list: +# http://lists.sourceforge.net/lists/listinfo/configobj-develop +# Comments, suggestions and bug reports welcome. + +from __future__ import generators + +import os +import re +import sys + +from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE + + +# imported lazily to avoid startup performance hit if it isn't used +compiler = None + +# A dictionary mapping BOM to +# the encoding to decode with, and what to set the +# encoding attribute to. +BOMS = { + BOM_UTF8: ('utf_8', None), + BOM_UTF16_BE: ('utf16_be', 'utf_16'), + BOM_UTF16_LE: ('utf16_le', 'utf_16'), + BOM_UTF16: ('utf_16', 'utf_16'), + } +# All legal variants of the BOM codecs. +# TODO: the list of aliases is not meant to be exhaustive, is there a +# better way ? +BOM_LIST = { + 'utf_16': 'utf_16', + 'u16': 'utf_16', + 'utf16': 'utf_16', + 'utf-16': 'utf_16', + 'utf16_be': 'utf16_be', + 'utf_16_be': 'utf16_be', + 'utf-16be': 'utf16_be', + 'utf16_le': 'utf16_le', + 'utf_16_le': 'utf16_le', + 'utf-16le': 'utf16_le', + 'utf_8': 'utf_8', + 'u8': 'utf_8', + 'utf': 'utf_8', + 'utf8': 'utf_8', + 'utf-8': 'utf_8', + } + +# Map of encodings to the BOM to write. +BOM_SET = { + 'utf_8': BOM_UTF8, + 'utf_16': BOM_UTF16, + 'utf16_be': BOM_UTF16_BE, + 'utf16_le': BOM_UTF16_LE, + None: BOM_UTF8 + } + + +def match_utf8(encoding): + return BOM_LIST.get(encoding.lower()) == 'utf_8' + + +# Quote strings used for writing values +squot = "'%s'" +dquot = '"%s"' +noquot = "%s" +wspace_plus = ' \r\n\v\t\'"' +tsquot = '"""%s"""' +tdquot = "'''%s'''" + +# Sentinel for use in getattr calls to replace hasattr +MISSING = object() + +__version__ = '4.7.2' + +try: + any +except NameError: + def any(iterable): + for entry in iterable: + if entry: + return True + return False + + +__all__ = ( + '__version__', + 'DEFAULT_INDENT_TYPE', + 'DEFAULT_INTERPOLATION', + 'ConfigObjError', + 'NestingError', + 'ParseError', + 'DuplicateError', + 'ConfigspecError', + 'ConfigObj', + 'SimpleVal', + 'InterpolationError', + 'InterpolationLoopError', + 'MissingInterpolationOption', + 'RepeatSectionError', + 'ReloadError', + 'UnreprError', + 'UnknownType', + 'flatten_errors', + 'get_extra_values' +) + +DEFAULT_INTERPOLATION = 'configparser' +DEFAULT_INDENT_TYPE = ' ' +MAX_INTERPOL_DEPTH = 10 + +OPTION_DEFAULTS = { + 'interpolation': True, + 'raise_errors': False, + 'list_values': True, + 'create_empty': False, + 'file_error': False, + 'configspec': None, + 'stringify': True, + # option may be set to one of ('', ' ', '\t') + 'indent_type': None, + 'encoding': None, + 'default_encoding': None, + 'unrepr': False, + 'write_empty_values': False, +} + + + +def getObj(s): + global compiler + if compiler is None: + import compiler + s = "a=" + s + p = compiler.parse(s) + return p.getChildren()[1].getChildren()[0].getChildren()[1] + + +class UnknownType(Exception): + pass + + +class Builder(object): + + def build(self, o): + m = getattr(self, 'build_' + o.__class__.__name__, None) + if m is None: + raise UnknownType(o.__class__.__name__) + return m(o) + + def build_List(self, o): + return map(self.build, o.getChildren()) + + def build_Const(self, o): + return o.value + + def build_Dict(self, o): + d = {} + i = iter(map(self.build, o.getChildren())) + for el in i: + d[el] = i.next() + return d + + def build_Tuple(self, o): + return tuple(self.build_List(o)) + + def build_Name(self, o): + if o.name == 'None': + return None + if o.name == 'True': + return True + if o.name == 'False': + return False + + # An undefined Name + raise UnknownType('Undefined Name') + + def build_Add(self, o): + real, imag = map(self.build_Const, o.getChildren()) + try: + real = float(real) + except TypeError: + raise UnknownType('Add') + if not isinstance(imag, complex) or imag.real != 0.0: + raise UnknownType('Add') + return real+imag + + def build_Getattr(self, o): + parent = self.build(o.expr) + return getattr(parent, o.attrname) + + def build_UnarySub(self, o): + return -self.build_Const(o.getChildren()[0]) + + def build_UnaryAdd(self, o): + return self.build_Const(o.getChildren()[0]) + + +_builder = Builder() + + +def unrepr(s): + if not s: + return s + return _builder.build(getObj(s)) + + + +class ConfigObjError(SyntaxError): + """ + This is the base class for all errors that ConfigObj raises. + It is a subclass of SyntaxError. + """ + def __init__(self, message='', line_number=None, line=''): + self.line = line + self.line_number = line_number + SyntaxError.__init__(self, message) + + +class NestingError(ConfigObjError): + """ + This error indicates a level of nesting that doesn't match. + """ + + +class ParseError(ConfigObjError): + """ + This error indicates that a line is badly written. + It is neither a valid ``key = value`` line, + nor a valid section marker line. + """ + + +class ReloadError(IOError): + """ + A 'reload' operation failed. + This exception is a subclass of ``IOError``. + """ + def __init__(self): + IOError.__init__(self, 'reload failed, filename is not set.') + + +class DuplicateError(ConfigObjError): + """ + The keyword or section specified already exists. + """ + + +class ConfigspecError(ConfigObjError): + """ + An error occured whilst parsing a configspec. + """ + + +class InterpolationError(ConfigObjError): + """Base class for the two interpolation errors.""" + + +class InterpolationLoopError(InterpolationError): + """Maximum interpolation depth exceeded in string interpolation.""" + + def __init__(self, option): + InterpolationError.__init__( + self, + 'interpolation loop detected in value "%s".' % option) + + +class RepeatSectionError(ConfigObjError): + """ + This error indicates additional sections in a section with a + ``__many__`` (repeated) section. + """ + + +class MissingInterpolationOption(InterpolationError): + """A value specified for interpolation was missing.""" + def __init__(self, option): + msg = 'missing option "%s" in interpolation.' % option + InterpolationError.__init__(self, msg) + + +class UnreprError(ConfigObjError): + """An error parsing in unrepr mode.""" + + + +class InterpolationEngine(object): + """ + A helper class to help perform string interpolation. + + This class is an abstract base class; its descendants perform + the actual work. + """ + + # compiled regexp to use in self.interpolate() + _KEYCRE = re.compile(r"%\(([^)]*)\)s") + _cookie = '%' + + def __init__(self, section): + # the Section instance that "owns" this engine + self.section = section + + + def interpolate(self, key, value): + # short-cut + if not self._cookie in value: + return value + + def recursive_interpolate(key, value, section, backtrail): + """The function that does the actual work. + + ``value``: the string we're trying to interpolate. + ``section``: the section in which that string was found + ``backtrail``: a dict to keep track of where we've been, + to detect and prevent infinite recursion loops + + This is similar to a depth-first-search algorithm. + """ + # Have we been here already? + if (key, section.name) in backtrail: + # Yes - infinite loop detected + raise InterpolationLoopError(key) + # Place a marker on our backtrail so we won't come back here again + backtrail[(key, section.name)] = 1 + + # Now start the actual work + match = self._KEYCRE.search(value) + while match: + # The actual parsing of the match is implementation-dependent, + # so delegate to our helper function + k, v, s = self._parse_match(match) + if k is None: + # That's the signal that no further interpolation is needed + replacement = v + else: + # Further interpolation may be needed to obtain final value + replacement = recursive_interpolate(k, v, s, backtrail) + # Replace the matched string with its final value + start, end = match.span() + value = ''.join((value[:start], replacement, value[end:])) + new_search_start = start + len(replacement) + # Pick up the next interpolation key, if any, for next time + # through the while loop + match = self._KEYCRE.search(value, new_search_start) + + # Now safe to come back here again; remove marker from backtrail + del backtrail[(key, section.name)] + + return value + + # Back in interpolate(), all we have to do is kick off the recursive + # function with appropriate starting values + value = recursive_interpolate(key, value, self.section, {}) + return value + + + def _fetch(self, key): + """Helper function to fetch values from owning section. + + Returns a 2-tuple: the value, and the section where it was found. + """ + # switch off interpolation before we try and fetch anything ! + save_interp = self.section.main.interpolation + self.section.main.interpolation = False + + # Start at section that "owns" this InterpolationEngine + current_section = self.section + while True: + # try the current section first + val = current_section.get(key) + if val is not None and not isinstance(val, Section): + break + # try "DEFAULT" next + val = current_section.get('DEFAULT', {}).get(key) + if val is not None and not isinstance(val, Section): + break + # move up to parent and try again + # top-level's parent is itself + if current_section.parent is current_section: + # reached top level, time to give up + break + current_section = current_section.parent + + # restore interpolation to previous value before returning + self.section.main.interpolation = save_interp + if val is None: + raise MissingInterpolationOption(key) + return val, current_section + + + def _parse_match(self, match): + """Implementation-dependent helper function. + + Will be passed a match object corresponding to the interpolation + key we just found (e.g., "%(foo)s" or "$foo"). Should look up that + key in the appropriate config file section (using the ``_fetch()`` + helper function) and return a 3-tuple: (key, value, section) + + ``key`` is the name of the key we're looking for + ``value`` is the value found for that key + ``section`` is a reference to the section where it was found + + ``key`` and ``section`` should be None if no further + interpolation should be performed on the resulting value + (e.g., if we interpolated "$$" and returned "$"). + """ + raise NotImplementedError() + + + +class ConfigParserInterpolation(InterpolationEngine): + """Behaves like ConfigParser.""" + _cookie = '%' + _KEYCRE = re.compile(r"%\(([^)]*)\)s") + + def _parse_match(self, match): + key = match.group(1) + value, section = self._fetch(key) + return key, value, section + + + +class TemplateInterpolation(InterpolationEngine): + """Behaves like string.Template.""" + _cookie = '$' + _delimiter = '$' + _KEYCRE = re.compile(r""" + \$(?: + (?P<escaped>\$) | # Two $ signs + (?P<named>[_a-z][_a-z0-9]*) | # $name format + {(?P<braced>[^}]*)} # ${name} format + ) + """, re.IGNORECASE | re.VERBOSE) + + def _parse_match(self, match): + # Valid name (in or out of braces): fetch value from section + key = match.group('named') or match.group('braced') + if key is not None: + value, section = self._fetch(key) + return key, value, section + # Escaped delimiter (e.g., $$): return single delimiter + if match.group('escaped') is not None: + # Return None for key and section to indicate it's time to stop + return None, self._delimiter, None + # Anything else: ignore completely, just return it unchanged + return None, match.group(), None + + +interpolation_engines = { + 'configparser': ConfigParserInterpolation, + 'template': TemplateInterpolation, +} + + +def __newobj__(cls, *args): + # Hack for pickle + return cls.__new__(cls, *args) + +class Section(dict): + """ + A dictionary-like object that represents a section in a config file. + + It does string interpolation if the 'interpolation' attribute + of the 'main' object is set to True. + + Interpolation is tried first from this object, then from the 'DEFAULT' + section of this object, next from the parent and its 'DEFAULT' section, + and so on until the main object is reached. + + A Section will behave like an ordered dictionary - following the + order of the ``scalars`` and ``sections`` attributes. + You can use this to change the order of members. + + Iteration follows the order: scalars, then sections. + """ + + + def __setstate__(self, state): + dict.update(self, state[0]) + self.__dict__.update(state[1]) + + def __reduce__(self): + state = (dict(self), self.__dict__) + return (__newobj__, (self.__class__,), state) + + + def __init__(self, parent, depth, main, indict=None, name=None): + """ + * parent is the section above + * depth is the depth level of this section + * main is the main ConfigObj + * indict is a dictionary to initialise the section with + """ + if indict is None: + indict = {} + dict.__init__(self) + # used for nesting level *and* interpolation + self.parent = parent + # used for the interpolation attribute + self.main = main + # level of nesting depth of this Section + self.depth = depth + # purely for information + self.name = name + # + self._initialise() + # we do this explicitly so that __setitem__ is used properly + # (rather than just passing to ``dict.__init__``) + for entry, value in indict.iteritems(): + self[entry] = value + + + def _initialise(self): + # the sequence of scalar values in this Section + self.scalars = [] + # the sequence of sections in this Section + self.sections = [] + # for comments :-) + self.comments = {} + self.inline_comments = {} + # the configspec + self.configspec = None + # for defaults + self.defaults = [] + self.default_values = {} + self.extra_values = [] + self._created = False + + + def _interpolate(self, key, value): + try: + # do we already have an interpolation engine? + engine = self._interpolation_engine + except AttributeError: + # not yet: first time running _interpolate(), so pick the engine + name = self.main.interpolation + if name == True: # note that "if name:" would be incorrect here + # backwards-compatibility: interpolation=True means use default + name = DEFAULT_INTERPOLATION + name = name.lower() # so that "Template", "template", etc. all work + class_ = interpolation_engines.get(name, None) + if class_ is None: + # invalid value for self.main.interpolation + self.main.interpolation = False + return value + else: + # save reference to engine so we don't have to do this again + engine = self._interpolation_engine = class_(self) + # let the engine do the actual work + return engine.interpolate(key, value) + + + def __getitem__(self, key): + """Fetch the item and do string interpolation.""" + val = dict.__getitem__(self, key) + if self.main.interpolation: + if isinstance(val, basestring): + return self._interpolate(key, val) + if isinstance(val, list): + def _check(entry): + if isinstance(entry, basestring): + return self._interpolate(key, entry) + return entry + new = [_check(entry) for entry in val] + if new != val: + return new + return val + + + def __setitem__(self, key, value, unrepr=False): + """ + Correctly set a value. + + Making dictionary values Section instances. + (We have to special case 'Section' instances - which are also dicts) + + Keys must be strings. + Values need only be strings (or lists of strings) if + ``main.stringify`` is set. + + ``unrepr`` must be set when setting a value to a dictionary, without + creating a new sub-section. + """ + if not isinstance(key, basestring): + raise ValueError('The key "%s" is not a string.' % key) + + # add the comment + if key not in self.comments: + self.comments[key] = [] + self.inline_comments[key] = '' + # remove the entry from defaults + if key in self.defaults: + self.defaults.remove(key) + # + if isinstance(value, Section): + if key not in self: + self.sections.append(key) + dict.__setitem__(self, key, value) + elif isinstance(value, dict) and not unrepr: + # First create the new depth level, + # then create the section + if key not in self: + self.sections.append(key) + new_depth = self.depth + 1 + dict.__setitem__( + self, + key, + Section( + self, + new_depth, + self.main, + indict=value, + name=key)) + else: + if key not in self: + self.scalars.append(key) + if not self.main.stringify: + if isinstance(value, basestring): + pass + elif isinstance(value, (list, tuple)): + for entry in value: + if not isinstance(entry, basestring): + raise TypeError('Value is not a string "%s".' % entry) + else: + raise TypeError('Value is not a string "%s".' % value) + dict.__setitem__(self, key, value) + + + def __delitem__(self, key): + """Remove items from the sequence when deleting.""" + dict. __delitem__(self, key) + if key in self.scalars: + self.scalars.remove(key) + else: + self.sections.remove(key) + del self.comments[key] + del self.inline_comments[key] + + + def get(self, key, default=None): + """A version of ``get`` that doesn't bypass string interpolation.""" + try: + return self[key] + except KeyError: + return default + + + def update(self, indict): + """ + A version of update that uses our ``__setitem__``. + """ + for entry in indict: + self[entry] = indict[entry] + + + def pop(self, key, default=MISSING): + """ + 'D.pop(k[,d]) -> v, remove specified key and return the corresponding value. + If key is not found, d is returned if given, otherwise KeyError is raised' + """ + try: + val = self[key] + except KeyError: + if default is MISSING: + raise + val = default + else: + del self[key] + return val + + + def popitem(self): + """Pops the first (key,val)""" + sequence = (self.scalars + self.sections) + if not sequence: + raise KeyError(": 'popitem(): dictionary is empty'") + key = sequence[0] + val = self[key] + del self[key] + return key, val + + + def clear(self): + """ + A version of clear that also affects scalars/sections + Also clears comments and configspec. + + Leaves other attributes alone : + depth/main/parent are not affected + """ + dict.clear(self) + self.scalars = [] + self.sections = [] + self.comments = {} + self.inline_comments = {} + self.configspec = None + self.defaults = [] + self.extra_values = [] + + + def setdefault(self, key, default=None): + """A version of setdefault that sets sequence if appropriate.""" + try: + return self[key] + except KeyError: + self[key] = default + return self[key] + + + def items(self): + """D.items() -> list of D's (key, value) pairs, as 2-tuples""" + return zip((self.scalars + self.sections), self.values()) + + + def keys(self): + """D.keys() -> list of D's keys""" + return (self.scalars + self.sections) + + + def values(self): + """D.values() -> list of D's values""" + return [self[key] for key in (self.scalars + self.sections)] + + + def iteritems(self): + """D.iteritems() -> an iterator over the (key, value) items of D""" + return iter(self.items()) + + + def iterkeys(self): + """D.iterkeys() -> an iterator over the keys of D""" + return iter((self.scalars + self.sections)) + + __iter__ = iterkeys + + + def itervalues(self): + """D.itervalues() -> an iterator over the values of D""" + return iter(self.values()) + + + def __repr__(self): + """x.__repr__() <==> repr(x)""" + def _getval(key): + try: + return self[key] + except MissingInterpolationOption: + return dict.__getitem__(self, key) + return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) + for key in (self.scalars + self.sections)]) + + __str__ = __repr__ + __str__.__doc__ = "x.__str__() <==> str(x)" + + + # Extra methods - not in a normal dictionary + + def dict(self): + """ + Return a deepcopy of self as a dictionary. + + All members that are ``Section`` instances are recursively turned to + ordinary dictionaries - by calling their ``dict`` method. + + >>> n = a.dict() + >>> n == a + 1 + >>> n is a + 0 + """ + newdict = {} + for entry in self: + this_entry = self[entry] + if isinstance(this_entry, Section): + this_entry = this_entry.dict() + elif isinstance(this_entry, list): + # create a copy rather than a reference + this_entry = list(this_entry) + elif isinstance(this_entry, tuple): + # create a copy rather than a reference + this_entry = tuple(this_entry) + newdict[entry] = this_entry + return newdict + + + def merge(self, indict): + """ + A recursive update - useful for merging config files. + + >>> a = '''[section1] + ... option1 = True + ... [[subsection]] + ... more_options = False + ... # end of file'''.splitlines() + >>> b = '''# File is user.ini + ... [section1] + ... option1 = False + ... # end of file'''.splitlines() + >>> c1 = ConfigObj(b) + >>> c2 = ConfigObj(a) + >>> c2.merge(c1) + >>> c2 + ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}}) + """ + for key, val in indict.items(): + if (key in self and isinstance(self[key], dict) and + isinstance(val, dict)): + self[key].merge(val) + else: + self[key] = val + + + def rename(self, oldkey, newkey): + """ + Change a keyname to another, without changing position in sequence. + + Implemented so that transformations can be made on keys, + as well as on values. (used by encode and decode) + + Also renames comments. + """ + if oldkey in self.scalars: + the_list = self.scalars + elif oldkey in self.sections: + the_list = self.sections + else: + raise KeyError('Key "%s" not found.' % oldkey) + pos = the_list.index(oldkey) + # + val = self[oldkey] + dict.__delitem__(self, oldkey) + dict.__setitem__(self, newkey, val) + the_list.remove(oldkey) + the_list.insert(pos, newkey) + comm = self.comments[oldkey] + inline_comment = self.inline_comments[oldkey] + del self.comments[oldkey] + del self.inline_comments[oldkey] + self.comments[newkey] = comm + self.inline_comments[newkey] = inline_comment + + + def walk(self, function, raise_errors=True, + call_on_sections=False, **keywargs): + """ + Walk every member and call a function on the keyword and value. + + Return a dictionary of the return values + + If the function raises an exception, raise the errror + unless ``raise_errors=False``, in which case set the return value to + ``False``. + + Any unrecognised keyword arguments you pass to walk, will be pased on + to the function you pass in. + + Note: if ``call_on_sections`` is ``True`` then - on encountering a + subsection, *first* the function is called for the *whole* subsection, + and then recurses into it's members. This means your function must be + able to handle strings, dictionaries and lists. This allows you + to change the key of subsections as well as for ordinary members. The + return value when called on the whole subsection has to be discarded. + + See the encode and decode methods for examples, including functions. + + .. admonition:: caution + + You can use ``walk`` to transform the names of members of a section + but you mustn't add or delete members. + + >>> config = '''[XXXXsection] + ... XXXXkey = XXXXvalue'''.splitlines() + >>> cfg = ConfigObj(config) + >>> cfg + ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) + >>> def transform(section, key): + ... val = section[key] + ... newkey = key.replace('XXXX', 'CLIENT1') + ... section.rename(key, newkey) + ... if isinstance(val, (tuple, list, dict)): + ... pass + ... else: + ... val = val.replace('XXXX', 'CLIENT1') + ... section[newkey] = val + >>> cfg.walk(transform, call_on_sections=True) + {'CLIENT1section': {'CLIENT1key': None}} + >>> cfg + ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}}) + """ + out = {} + # scalars first + for i in range(len(self.scalars)): + entry = self.scalars[i] + try: + val = function(self, entry, **keywargs) + # bound again in case name has changed + entry = self.scalars[i] + out[entry] = val + except Exception: + if raise_errors: + raise + else: + entry = self.scalars[i] + out[entry] = False + # then sections + for i in range(len(self.sections)): + entry = self.sections[i] + if call_on_sections: + try: + function(self, entry, **keywargs) + except Exception: + if raise_errors: + raise + else: + entry = self.sections[i] + out[entry] = False + # bound again in case name has changed + entry = self.sections[i] + # previous result is discarded + out[entry] = self[entry].walk( + function, + raise_errors=raise_errors, + call_on_sections=call_on_sections, + **keywargs) + return out + + + def as_bool(self, key): + """ + Accepts a key as input. The corresponding value must be a string or + the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to + retain compatibility with Python 2.2. + + If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns + ``True``. + + If the string is one of ``False``, ``Off``, ``No``, or ``0`` it returns + ``False``. + + ``as_bool`` is not case sensitive. + + Any other input will raise a ``ValueError``. + + >>> a = ConfigObj() + >>> a['a'] = 'fish' + >>> a.as_bool('a') + Traceback (most recent call last): + ValueError: Value "fish" is neither True nor False + >>> a['b'] = 'True' + >>> a.as_bool('b') + 1 + >>> a['b'] = 'off' + >>> a.as_bool('b') + 0 + """ + val = self[key] + if val == True: + return True + elif val == False: + return False + else: + try: + if not isinstance(val, basestring): + # TODO: Why do we raise a KeyError here? + raise KeyError() + else: + return self.main._bools[val.lower()] + except KeyError: + raise ValueError('Value "%s" is neither True nor False' % val) + + + def as_int(self, key): + """ + A convenience method which coerces the specified value to an integer. + + If the value is an invalid literal for ``int``, a ``ValueError`` will + be raised. + + >>> a = ConfigObj() + >>> a['a'] = 'fish' + >>> a.as_int('a') + Traceback (most recent call last): + ValueError: invalid literal for int() with base 10: 'fish' + >>> a['b'] = '1' + >>> a.as_int('b') + 1 + >>> a['b'] = '3.2' + >>> a.as_int('b') + Traceback (most recent call last): + ValueError: invalid literal for int() with base 10: '3.2' + """ + return int(self[key]) + + + def as_float(self, key): + """ + A convenience method which coerces the specified value to a float. + + If the value is an invalid literal for ``float``, a ``ValueError`` will + be raised. + + >>> a = ConfigObj() + >>> a['a'] = 'fish' + >>> a.as_float('a') + Traceback (most recent call last): + ValueError: invalid literal for float(): fish + >>> a['b'] = '1' + >>> a.as_float('b') + 1.0 + >>> a['b'] = '3.2' + >>> a.as_float('b') + 3.2000000000000002 + """ + return float(self[key]) + + + def as_list(self, key): + """ + A convenience method which fetches the specified value, guaranteeing + that it is a list. + + >>> a = ConfigObj() + >>> a['a'] = 1 + >>> a.as_list('a') + [1] + >>> a['a'] = (1,) + >>> a.as_list('a') + [1] + >>> a['a'] = [1] + >>> a.as_list('a') + [1] + """ + result = self[key] + if isinstance(result, (tuple, list)): + return list(result) + return [result] + + + def restore_default(self, key): + """ + Restore (and return) default value for the specified key. + + This method will only work for a ConfigObj that was created + with a configspec and has been validated. + + If there is no default value for this key, ``KeyError`` is raised. + """ + default = self.default_values[key] + dict.__setitem__(self, key, default) + if key not in self.defaults: + self.defaults.append(key) + return default + + + def restore_defaults(self): + """ + Recursively restore default values to all members + that have them. + + This method will only work for a ConfigObj that was created + with a configspec and has been validated. + + It doesn't delete or modify entries without default values. + """ + for key in self.default_values: + self.restore_default(key) + + for section in self.sections: + self[section].restore_defaults() + + +class ConfigObj(Section): + """An object to read, create, and write config files.""" + + _keyword = re.compile(r'''^ # line start + (\s*) # indentation + ( # keyword + (?:".*?")| # double quotes + (?:'.*?')| # single quotes + (?:[^'"=].*?) # no quotes + ) + \s*=\s* # divider + (.*) # value (including list values and comments) + $ # line end + ''', + re.VERBOSE) + + _sectionmarker = re.compile(r'''^ + (\s*) # 1: indentation + ((?:\[\s*)+) # 2: section marker open + ( # 3: section name open + (?:"\s*\S.*?\s*")| # at least one non-space with double quotes + (?:'\s*\S.*?\s*')| # at least one non-space with single quotes + (?:[^'"\s].*?) # at least one non-space unquoted + ) # section name close + ((?:\s*\])+) # 4: section marker close + \s*(\#.*)? # 5: optional comment + $''', + re.VERBOSE) + + # this regexp pulls list values out as a single string + # or single values and comments + # FIXME: this regex adds a '' to the end of comma terminated lists + # workaround in ``_handle_value`` + _valueexp = re.compile(r'''^ + (?: + (?: + ( + (?: + (?: + (?:".*?")| # double quotes + (?:'.*?')| # single quotes + (?:[^'",\#][^,\#]*?) # unquoted + ) + \s*,\s* # comma + )* # match all list items ending in a comma (if any) + ) + ( + (?:".*?")| # double quotes + (?:'.*?')| # single quotes + (?:[^'",\#\s][^,]*?)| # unquoted + (?:(?<!,)) # Empty value + )? # last item in a list - or string value + )| + (,) # alternatively a single comma - empty list + ) + \s*(\#.*)? # optional comment + $''', + re.VERBOSE) + + # use findall to get the members of a list value + _listvalueexp = re.compile(r''' + ( + (?:".*?")| # double quotes + (?:'.*?')| # single quotes + (?:[^'",\#]?.*?) # unquoted + ) + \s*,\s* # comma + ''', + re.VERBOSE) + + # this regexp is used for the value + # when lists are switched off + _nolistvalue = re.compile(r'''^ + ( + (?:".*?")| # double quotes + (?:'.*?')| # single quotes + (?:[^'"\#].*?)| # unquoted + (?:) # Empty value + ) + \s*(\#.*)? # optional comment + $''', + re.VERBOSE) + + # regexes for finding triple quoted values on one line + _single_line_single = re.compile(r"^'''(.*?)'''\s*(#.*)?$") + _single_line_double = re.compile(r'^"""(.*?)"""\s*(#.*)?$') + _multi_line_single = re.compile(r"^(.*?)'''\s*(#.*)?$") + _multi_line_double = re.compile(r'^(.*?)"""\s*(#.*)?$') + + _triple_quote = { + "'''": (_single_line_single, _multi_line_single), + '"""': (_single_line_double, _multi_line_double), + } + + # Used by the ``istrue`` Section method + _bools = { + 'yes': True, 'no': False, + 'on': True, 'off': False, + '1': True, '0': False, + 'true': True, 'false': False, + } + + + def __init__(self, infile=None, options=None, configspec=None, encoding=None, + interpolation=True, raise_errors=False, list_values=True, + create_empty=False, file_error=False, stringify=True, + indent_type=None, default_encoding=None, unrepr=False, + write_empty_values=False, _inspec=False): + """ + Parse a config file or create a config file object. + + ``ConfigObj(infile=None, configspec=None, encoding=None, + interpolation=True, raise_errors=False, list_values=True, + create_empty=False, file_error=False, stringify=True, + indent_type=None, default_encoding=None, unrepr=False, + write_empty_values=False, _inspec=False)`` + """ + self._inspec = _inspec + # init the superclass + Section.__init__(self, self, 0, self) + + infile = infile or [] + + _options = {'configspec': configspec, + 'encoding': encoding, 'interpolation': interpolation, + 'raise_errors': raise_errors, 'list_values': list_values, + 'create_empty': create_empty, 'file_error': file_error, + 'stringify': stringify, 'indent_type': indent_type, + 'default_encoding': default_encoding, 'unrepr': unrepr, + 'write_empty_values': write_empty_values} + + if options is None: + options = _options + else: + import warnings + warnings.warn('Passing in an options dictionary to ConfigObj() is ' + 'deprecated. Use **options instead.', + DeprecationWarning, stacklevel=2) + + # TODO: check the values too. + for entry in options: + if entry not in OPTION_DEFAULTS: + raise TypeError('Unrecognised option "%s".' % entry) + for entry, value in OPTION_DEFAULTS.items(): + if entry not in options: + options[entry] = value + keyword_value = _options[entry] + if value != keyword_value: + options[entry] = keyword_value + + # XXXX this ignores an explicit list_values = True in combination + # with _inspec. The user should *never* do that anyway, but still... + if _inspec: + options['list_values'] = False + + self._initialise(options) + configspec = options['configspec'] + self._original_configspec = configspec + self._load(infile, configspec) + + + def _load(self, infile, configspec): + if isinstance(infile, basestring): + self.filename = infile + if os.path.isfile(infile): + h = open(infile, 'rb') + infile = h.read() or [] + h.close() + elif self.file_error: + # raise an error if the file doesn't exist + raise IOError('Config file not found: "%s".' % self.filename) + else: + # file doesn't already exist + if self.create_empty: + # this is a good test that the filename specified + # isn't impossible - like on a non-existent device + h = open(infile, 'w') + h.write('') + h.close() + infile = [] + + elif isinstance(infile, (list, tuple)): + infile = list(infile) + + elif isinstance(infile, dict): + # initialise self + # the Section class handles creating subsections + if isinstance(infile, ConfigObj): + # get a copy of our ConfigObj + def set_section(in_section, this_section): + for entry in in_section.scalars: + this_section[entry] = in_section[entry] + for section in in_section.sections: + this_section[section] = {} + set_section(in_section[section], this_section[section]) + set_section(infile, self) + + else: + for entry in infile: + self[entry] = infile[entry] + del self._errors + + if configspec is not None: + self._handle_configspec(configspec) + else: + self.configspec = None + return + + elif getattr(infile, 'read', MISSING) is not MISSING: + # This supports file like objects + infile = infile.read() or [] + # needs splitting into lines - but needs doing *after* decoding + # in case it's not an 8 bit encoding + else: + raise TypeError('infile must be a filename, file like object, or list of lines.') + + if infile: + # don't do it for the empty ConfigObj + infile = self._handle_bom(infile) + # infile is now *always* a list + # + # Set the newlines attribute (first line ending it finds) + # and strip trailing '\n' or '\r' from lines + for line in infile: + if (not line) or (line[-1] not in ('\r', '\n', '\r\n')): + continue + for end in ('\r\n', '\n', '\r'): + if line.endswith(end): + self.newlines = end + break + break + + infile = [line.rstrip('\r\n') for line in infile] + + self._parse(infile) + # if we had any errors, now is the time to raise them + if self._errors: + info = "at line %s." % self._errors[0].line_number + if len(self._errors) > 1: + msg = "Parsing failed with several errors.\nFirst error %s" % info + error = ConfigObjError(msg) + else: + error = self._errors[0] + # set the errors attribute; it's a list of tuples: + # (error_type, message, line_number) + error.errors = self._errors + # set the config attribute + error.config = self + raise error + # delete private attributes + del self._errors + + if configspec is None: + self.configspec = None + else: + self._handle_configspec(configspec) + + + def _initialise(self, options=None): + if options is None: + options = OPTION_DEFAULTS + + # initialise a few variables + self.filename = None + self._errors = [] + self.raise_errors = options['raise_errors'] + self.interpolation = options['interpolation'] + self.list_values = options['list_values'] + self.create_empty = options['create_empty'] + self.file_error = options['file_error'] + self.stringify = options['stringify'] + self.indent_type = options['indent_type'] + self.encoding = options['encoding'] + self.default_encoding = options['default_encoding'] + self.BOM = False + self.newlines = None + self.write_empty_values = options['write_empty_values'] + self.unrepr = options['unrepr'] + + self.initial_comment = [] + self.final_comment = [] + self.configspec = None + + if self._inspec: + self.list_values = False + + # Clear section attributes as well + Section._initialise(self) + + + def __repr__(self): + def _getval(key): + try: + return self[key] + except MissingInterpolationOption: + return dict.__getitem__(self, key) + return ('ConfigObj({%s})' % + ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) + for key in (self.scalars + self.sections)])) + + + def _handle_bom(self, infile): + """ + Handle any BOM, and decode if necessary. + + If an encoding is specified, that *must* be used - but the BOM should + still be removed (and the BOM attribute set). + + (If the encoding is wrongly specified, then a BOM for an alternative + encoding won't be discovered or removed.) + + If an encoding is not specified, UTF8 or UTF16 BOM will be detected and + removed. The BOM attribute will be set. UTF16 will be decoded to + unicode. + + NOTE: This method must not be called with an empty ``infile``. + + Specifying the *wrong* encoding is likely to cause a + ``UnicodeDecodeError``. + + ``infile`` must always be returned as a list of lines, but may be + passed in as a single string. + """ + if ((self.encoding is not None) and + (self.encoding.lower() not in BOM_LIST)): + # No need to check for a BOM + # the encoding specified doesn't have one + # just decode + return self._decode(infile, self.encoding) + + if isinstance(infile, (list, tuple)): + line = infile[0] + else: + line = infile + if self.encoding is not None: + # encoding explicitly supplied + # And it could have an associated BOM + # TODO: if encoding is just UTF16 - we ought to check for both + # TODO: big endian and little endian versions. + enc = BOM_LIST[self.encoding.lower()] + if enc == 'utf_16': + # For UTF16 we try big endian and little endian + for BOM, (encoding, final_encoding) in BOMS.items(): + if not final_encoding: + # skip UTF8 + continue + if infile.startswith(BOM): + ### BOM discovered + ##self.BOM = True + # Don't need to remove BOM + return self._decode(infile, encoding) + + # If we get this far, will *probably* raise a DecodeError + # As it doesn't appear to start with a BOM + return self._decode(infile, self.encoding) + + # Must be UTF8 + BOM = BOM_SET[enc] + if not line.startswith(BOM): + return self._decode(infile, self.encoding) + + newline = line[len(BOM):] + + # BOM removed + if isinstance(infile, (list, tuple)): + infile[0] = newline + else: + infile = newline + self.BOM = True + return self._decode(infile, self.encoding) + + # No encoding specified - so we need to check for UTF8/UTF16 + for BOM, (encoding, final_encoding) in BOMS.items(): + if not line.startswith(BOM): + continue + else: + # BOM discovered + self.encoding = final_encoding + if not final_encoding: + self.BOM = True + # UTF8 + # remove BOM + newline = line[len(BOM):] + if isinstance(infile, (list, tuple)): + infile[0] = newline + else: + infile = newline + # UTF8 - don't decode + if isinstance(infile, basestring): + return infile.splitlines(True) + else: + return infile + # UTF16 - have to decode + return self._decode(infile, encoding) + + # No BOM discovered and no encoding specified, just return + if isinstance(infile, basestring): + # infile read from a file will be a single string + return infile.splitlines(True) + return infile + + + def _a_to_u(self, aString): + """Decode ASCII strings to unicode if a self.encoding is specified.""" + if self.encoding: + return aString.decode('ascii') + else: + return aString + + + def _decode(self, infile, encoding): + """ + Decode infile to unicode. Using the specified encoding. + + if is a string, it also needs converting to a list. + """ + if isinstance(infile, basestring): + # can't be unicode + # NOTE: Could raise a ``UnicodeDecodeError`` + return infile.decode(encoding).splitlines(True) + for i, line in enumerate(infile): + if not isinstance(line, unicode): + # NOTE: The isinstance test here handles mixed lists of unicode/string + # NOTE: But the decode will break on any non-string values + # NOTE: Or could raise a ``UnicodeDecodeError`` + infile[i] = line.decode(encoding) + return infile + + + def _decode_element(self, line): + """Decode element to unicode if necessary.""" + if not self.encoding: + return line + if isinstance(line, str) and self.default_encoding: + return line.decode(self.default_encoding) + return line + + + def _str(self, value): + """ + Used by ``stringify`` within validate, to turn non-string values + into strings. + """ + if not isinstance(value, basestring): + return str(value) + else: + return value + + + def _parse(self, infile): + """Actually parse the config file.""" + temp_list_values = self.list_values + if self.unrepr: + self.list_values = False + + comment_list = [] + done_start = False + this_section = self + maxline = len(infile) - 1 + cur_index = -1 + reset_comment = False + + while cur_index < maxline: + if reset_comment: + comment_list = [] + cur_index += 1 + line = infile[cur_index] + sline = line.strip() + # do we have anything on the line ? + if not sline or sline.startswith('#'): + reset_comment = False + comment_list.append(line) + continue + + if not done_start: + # preserve initial comment + self.initial_comment = comment_list + comment_list = [] + done_start = True + + reset_comment = True + # first we check if it's a section marker + mat = self._sectionmarker.match(line) + if mat is not None: + # is a section line + (indent, sect_open, sect_name, sect_close, comment) = mat.groups() + if indent and (self.indent_type is None): + self.indent_type = indent + cur_depth = sect_open.count('[') + if cur_depth != sect_close.count(']'): + self._handle_error("Cannot compute the section depth at line %s.", + NestingError, infile, cur_index) + continue + + if cur_depth < this_section.depth: + # the new section is dropping back to a previous level + try: + parent = self._match_depth(this_section, + cur_depth).parent + except SyntaxError: + self._handle_error("Cannot compute nesting level at line %s.", + NestingError, infile, cur_index) + continue + elif cur_depth == this_section.depth: + # the new section is a sibling of the current section + parent = this_section.parent + elif cur_depth == this_section.depth + 1: + # the new section is a child the current section + parent = this_section + else: + self._handle_error("Section too nested at line %s.", + NestingError, infile, cur_index) + + sect_name = self._unquote(sect_name) + if sect_name in parent: + self._handle_error('Duplicate section name at line %s.', + DuplicateError, infile, cur_index) + continue + + # create the new section + this_section = Section( + parent, + cur_depth, + self, + name=sect_name) + parent[sect_name] = this_section + parent.inline_comments[sect_name] = comment + parent.comments[sect_name] = comment_list + continue + # + # it's not a section marker, + # so it should be a valid ``key = value`` line + mat = self._keyword.match(line) + if mat is None: + # it neither matched as a keyword + # or a section marker + self._handle_error( + 'Invalid line at line "%s".', + ParseError, infile, cur_index) + else: + # is a keyword value + # value will include any inline comment + (indent, key, value) = mat.groups() + if indent and (self.indent_type is None): + self.indent_type = indent + # check for a multiline value + if value[:3] in ['"""', "'''"]: + try: + value, comment, cur_index = self._multiline( + value, infile, cur_index, maxline) + except SyntaxError: + self._handle_error( + 'Parse error in value at line %s.', + ParseError, infile, cur_index) + continue + else: + if self.unrepr: + comment = '' + try: + value = unrepr(value) + except Exception, e: + if type(e) == UnknownType: + msg = 'Unknown name or type in value at line %s.' + else: + msg = 'Parse error in value at line %s.' + self._handle_error(msg, UnreprError, infile, + cur_index) + continue + else: + if self.unrepr: + comment = '' + try: + value = unrepr(value) + except Exception, e: + if isinstance(e, UnknownType): + msg = 'Unknown name or type in value at line %s.' + else: + msg = 'Parse error in value at line %s.' + self._handle_error(msg, UnreprError, infile, + cur_index) + continue + else: + # extract comment and lists + try: + (value, comment) = self._handle_value(value) + except SyntaxError: + self._handle_error( + 'Parse error in value at line %s.', + ParseError, infile, cur_index) + continue + # + key = self._unquote(key) + if key in this_section: + self._handle_error( + 'Duplicate keyword name at line %s.', + DuplicateError, infile, cur_index) + continue + # add the key. + # we set unrepr because if we have got this far we will never + # be creating a new section + this_section.__setitem__(key, value, unrepr=True) + this_section.inline_comments[key] = comment + this_section.comments[key] = comment_list + continue + # + if self.indent_type is None: + # no indentation used, set the type accordingly + self.indent_type = '' + + # preserve the final comment + if not self and not self.initial_comment: + self.initial_comment = comment_list + elif not reset_comment: + self.final_comment = comment_list + self.list_values = temp_list_values + + + def _match_depth(self, sect, depth): + """ + Given a section and a depth level, walk back through the sections + parents to see if the depth level matches a previous section. + + Return a reference to the right section, + or raise a SyntaxError. + """ + while depth < sect.depth: + if sect is sect.parent: + # we've reached the top level already + raise SyntaxError() + sect = sect.parent + if sect.depth == depth: + return sect + # shouldn't get here + raise SyntaxError() + + + def _handle_error(self, text, ErrorClass, infile, cur_index): + """ + Handle an error according to the error settings. + + Either raise the error or store it. + The error will have occured at ``cur_index`` + """ + line = infile[cur_index] + cur_index += 1 + message = text % cur_index + error = ErrorClass(message, cur_index, line) + if self.raise_errors: + # raise the error - parsing stops here + raise error + # store the error + # reraise when parsing has finished + self._errors.append(error) + + + def _unquote(self, value): + """Return an unquoted version of a value""" + if not value: + # should only happen during parsing of lists + raise SyntaxError + if (value[0] == value[-1]) and (value[0] in ('"', "'")): + value = value[1:-1] + return value + + + def _quote(self, value, multiline=True): + """ + Return a safely quoted version of a value. + + Raise a ConfigObjError if the value cannot be safely quoted. + If multiline is ``True`` (default) then use triple quotes + if necessary. + + * Don't quote values that don't need it. + * Recursively quote members of a list and return a comma joined list. + * Multiline is ``False`` for lists. + * Obey list syntax for empty and single member lists. + + If ``list_values=False`` then the value is only quoted if it contains + a ``\\n`` (is multiline) or '#'. + + If ``write_empty_values`` is set, and the value is an empty string, it + won't be quoted. + """ + if multiline and self.write_empty_values and value == '': + # Only if multiline is set, so that it is used for values not + # keys, and not values that are part of a list + return '' + + if multiline and isinstance(value, (list, tuple)): + if not value: + return ',' + elif len(value) == 1: + return self._quote(value[0], multiline=False) + ',' + return ', '.join([self._quote(val, multiline=False) + for val in value]) + if not isinstance(value, basestring): + if self.stringify: + value = str(value) + else: + raise TypeError('Value "%s" is not a string.' % value) + + if not value: + return '""' + + no_lists_no_quotes = not self.list_values and '\n' not in value and '#' not in value + need_triple = multiline and ((("'" in value) and ('"' in value)) or ('\n' in value )) + hash_triple_quote = multiline and not need_triple and ("'" in value) and ('"' in value) and ('#' in value) + check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote + + if check_for_single: + if not self.list_values: + # we don't quote if ``list_values=False`` + quot = noquot + # for normal values either single or double quotes will do + elif '\n' in value: + # will only happen if multiline is off - e.g. '\n' in key + raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) + elif ((value[0] not in wspace_plus) and + (value[-1] not in wspace_plus) and + (',' not in value)): + quot = noquot + else: + quot = self._get_single_quote(value) + else: + # if value has '\n' or "'" *and* '"', it will need triple quotes + quot = self._get_triple_quote(value) + + if quot == noquot and '#' in value and self.list_values: + quot = self._get_single_quote(value) + + return quot % value + + + def _get_single_quote(self, value): + if ("'" in value) and ('"' in value): + raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) + elif '"' in value: + quot = squot + else: + quot = dquot + return quot + + + def _get_triple_quote(self, value): + if (value.find('"""') != -1) and (value.find("'''") != -1): + raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) + if value.find('"""') == -1: + quot = tdquot + else: + quot = tsquot + return quot + + + def _handle_value(self, value): + """ + Given a value string, unquote, remove comment, + handle lists. (including empty and single member lists) + """ + if self._inspec: + # Parsing a configspec so don't handle comments + return (value, '') + # do we look for lists in values ? + if not self.list_values: + mat = self._nolistvalue.match(value) + if mat is None: + raise SyntaxError() + # NOTE: we don't unquote here + return mat.groups() + # + mat = self._valueexp.match(value) + if mat is None: + # the value is badly constructed, probably badly quoted, + # or an invalid list + raise SyntaxError() + (list_values, single, empty_list, comment) = mat.groups() + if (list_values == '') and (single is None): + # change this if you want to accept empty values + raise SyntaxError() + # NOTE: note there is no error handling from here if the regex + # is wrong: then incorrect values will slip through + if empty_list is not None: + # the single comma - meaning an empty list + return ([], comment) + if single is not None: + # handle empty values + if list_values and not single: + # FIXME: the '' is a workaround because our regex now matches + # '' at the end of a list if it has a trailing comma + single = None + else: + single = single or '""' + single = self._unquote(single) + if list_values == '': + # not a list value + return (single, comment) + the_list = self._listvalueexp.findall(list_values) + the_list = [self._unquote(val) for val in the_list] + if single is not None: + the_list += [single] + return (the_list, comment) + + + def _multiline(self, value, infile, cur_index, maxline): + """Extract the value, where we are in a multiline situation.""" + quot = value[:3] + newvalue = value[3:] + single_line = self._triple_quote[quot][0] + multi_line = self._triple_quote[quot][1] + mat = single_line.match(value) + if mat is not None: + retval = list(mat.groups()) + retval.append(cur_index) + return retval + elif newvalue.find(quot) != -1: + # somehow the triple quote is missing + raise SyntaxError() + # + while cur_index < maxline: + cur_index += 1 + newvalue += '\n' + line = infile[cur_index] + if line.find(quot) == -1: + newvalue += line + else: + # end of multiline, process it + break + else: + # we've got to the end of the config, oops... + raise SyntaxError() + mat = multi_line.match(line) + if mat is None: + # a badly formed line + raise SyntaxError() + (value, comment) = mat.groups() + return (newvalue + value, comment, cur_index) + + + def _handle_configspec(self, configspec): + """Parse the configspec.""" + # FIXME: Should we check that the configspec was created with the + # correct settings ? (i.e. ``list_values=False``) + if not isinstance(configspec, ConfigObj): + try: + configspec = ConfigObj(configspec, + raise_errors=True, + file_error=True, + _inspec=True) + except ConfigObjError, e: + # FIXME: Should these errors have a reference + # to the already parsed ConfigObj ? + raise ConfigspecError('Parsing configspec failed: %s' % e) + except IOError, e: + raise IOError('Reading configspec failed: %s' % e) + + self.configspec = configspec + + + + def _set_configspec(self, section, copy): + """ + Called by validate. Handles setting the configspec on subsections + including sections to be validated by __many__ + """ + configspec = section.configspec + many = configspec.get('__many__') + if isinstance(many, dict): + for entry in section.sections: + if entry not in configspec: + section[entry].configspec = many + + for entry in configspec.sections: + if entry == '__many__': + continue + if entry not in section: + section[entry] = {} + section[entry]._created = True + if copy: + # copy comments + section.comments[entry] = configspec.comments.get(entry, []) + section.inline_comments[entry] = configspec.inline_comments.get(entry, '') + + # Could be a scalar when we expect a section + if isinstance(section[entry], Section): + section[entry].configspec = configspec[entry] + + + def _write_line(self, indent_string, entry, this_entry, comment): + """Write an individual line, for the write method""" + # NOTE: the calls to self._quote here handles non-StringType values. + if not self.unrepr: + val = self._decode_element(self._quote(this_entry)) + else: + val = repr(this_entry) + return '%s%s%s%s%s' % (indent_string, + self._decode_element(self._quote(entry, multiline=False)), + self._a_to_u(' = '), + val, + self._decode_element(comment)) + + + def _write_marker(self, indent_string, depth, entry, comment): + """Write a section marker line""" + return '%s%s%s%s%s' % (indent_string, + self._a_to_u('[' * depth), + self._quote(self._decode_element(entry), multiline=False), + self._a_to_u(']' * depth), + self._decode_element(comment)) + + + def _handle_comment(self, comment): + """Deal with a comment.""" + if not comment: + return '' + start = self.indent_type + if not comment.startswith('#'): + start += self._a_to_u(' # ') + return (start + comment) + + + # Public methods + + def write(self, outfile=None, section=None): + """ + Write the current ConfigObj as a file + + tekNico: FIXME: use StringIO instead of real files + + >>> filename = a.filename + >>> a.filename = 'test.ini' + >>> a.write() + >>> a.filename = filename + >>> a == ConfigObj('test.ini', raise_errors=True) + 1 + >>> import os + >>> os.remove('test.ini') + """ + if self.indent_type is None: + # this can be true if initialised from a dictionary + self.indent_type = DEFAULT_INDENT_TYPE + + out = [] + cs = self._a_to_u('#') + csp = self._a_to_u('# ') + if section is None: + int_val = self.interpolation + self.interpolation = False + section = self + for line in self.initial_comment: + line = self._decode_element(line) + stripped_line = line.strip() + if stripped_line and not stripped_line.startswith(cs): + line = csp + line + out.append(line) + + indent_string = self.indent_type * section.depth + for entry in (section.scalars + section.sections): + if entry in section.defaults: + # don't write out default values + continue + for comment_line in section.comments[entry]: + comment_line = self._decode_element(comment_line.lstrip()) + if comment_line and not comment_line.startswith(cs): + comment_line = csp + comment_line + out.append(indent_string + comment_line) + this_entry = section[entry] + comment = self._handle_comment(section.inline_comments[entry]) + + if isinstance(this_entry, dict): + # a section + out.append(self._write_marker( + indent_string, + this_entry.depth, + entry, + comment)) + out.extend(self.write(section=this_entry)) + else: + out.append(self._write_line( + indent_string, + entry, + this_entry, + comment)) + + if section is self: + for line in self.final_comment: + line = self._decode_element(line) + stripped_line = line.strip() + if stripped_line and not stripped_line.startswith(cs): + line = csp + line + out.append(line) + self.interpolation = int_val + + if section is not self: + return out + + if (self.filename is None) and (outfile is None): + # output a list of lines + # might need to encode + # NOTE: This will *screw* UTF16, each line will start with the BOM + if self.encoding: + out = [l.encode(self.encoding) for l in out] + if (self.BOM and ((self.encoding is None) or + (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))): + # Add the UTF8 BOM + if not out: + out.append('') + out[0] = BOM_UTF8 + out[0] + return out + + # Turn the list to a string, joined with correct newlines + newline = self.newlines or os.linesep + if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w' + and sys.platform == 'win32' and newline == '\r\n'): + # Windows specific hack to avoid writing '\r\r\n' + newline = '\n' + output = self._a_to_u(newline).join(out) + if self.encoding: + output = output.encode(self.encoding) + if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)): + # Add the UTF8 BOM + output = BOM_UTF8 + output + + if not output.endswith(newline): + output += newline + if outfile is not None: + outfile.write(output) + else: + h = open(self.filename, 'wb') + h.write(output) + h.close() + + + def validate(self, validator, preserve_errors=False, copy=False, + section=None): + """ + Test the ConfigObj against a configspec. + + It uses the ``validator`` object from *validate.py*. + + To run ``validate`` on the current ConfigObj, call: :: + + test = config.validate(validator) + + (Normally having previously passed in the configspec when the ConfigObj + was created - you can dynamically assign a dictionary of checks to the + ``configspec`` attribute of a section though). + + It returns ``True`` if everything passes, or a dictionary of + pass/fails (True/False). If every member of a subsection passes, it + will just have the value ``True``. (It also returns ``False`` if all + members fail). + + In addition, it converts the values from strings to their native + types if their checks pass (and ``stringify`` is set). + + If ``preserve_errors`` is ``True`` (``False`` is default) then instead + of a marking a fail with a ``False``, it will preserve the actual + exception object. This can contain info about the reason for failure. + For example the ``VdtValueTooSmallError`` indicates that the value + supplied was too small. If a value (or section) is missing it will + still be marked as ``False``. + + You must have the validate module to use ``preserve_errors=True``. + + You can then use the ``flatten_errors`` function to turn your nested + results dictionary into a flattened list of failures - useful for + displaying meaningful error messages. + """ + if section is None: + if self.configspec is None: + raise ValueError('No configspec supplied.') + if preserve_errors: + # We do this once to remove a top level dependency on the validate module + # Which makes importing configobj faster + from validate import VdtMissingValue + self._vdtMissingValue = VdtMissingValue + + section = self + + if copy: + section.initial_comment = section.configspec.initial_comment + section.final_comment = section.configspec.final_comment + section.encoding = section.configspec.encoding + section.BOM = section.configspec.BOM + section.newlines = section.configspec.newlines + section.indent_type = section.configspec.indent_type + + # + # section.default_values.clear() #?? + configspec = section.configspec + self._set_configspec(section, copy) + + + def validate_entry(entry, spec, val, missing, ret_true, ret_false): + section.default_values.pop(entry, None) + + try: + section.default_values[entry] = validator.get_default_value(configspec[entry]) + except (KeyError, AttributeError, validator.baseErrorClass): + # No default, bad default or validator has no 'get_default_value' + # (e.g. SimpleVal) + pass + + try: + check = validator.check(spec, + val, + missing=missing + ) + except validator.baseErrorClass, e: + if not preserve_errors or isinstance(e, self._vdtMissingValue): + out[entry] = False + else: + # preserve the error + out[entry] = e + ret_false = False + ret_true = False + else: + ret_false = False + out[entry] = True + if self.stringify or missing: + # if we are doing type conversion + # or the value is a supplied default + if not self.stringify: + if isinstance(check, (list, tuple)): + # preserve lists + check = [self._str(item) for item in check] + elif missing and check is None: + # convert the None from a default to a '' + check = '' + else: + check = self._str(check) + if (check != val) or missing: + section[entry] = check + if not copy and missing and entry not in section.defaults: + section.defaults.append(entry) + return ret_true, ret_false + + # + out = {} + ret_true = True + ret_false = True + + unvalidated = [k for k in section.scalars if k not in configspec] + incorrect_sections = [k for k in configspec.sections if k in section.scalars] + incorrect_scalars = [k for k in configspec.scalars if k in section.sections] + + for entry in configspec.scalars: + if entry in ('__many__', '___many___'): + # reserved names + continue + if (not entry in section.scalars) or (entry in section.defaults): + # missing entries + # or entries from defaults + missing = True + val = None + if copy and entry not in section.scalars: + # copy comments + section.comments[entry] = ( + configspec.comments.get(entry, [])) + section.inline_comments[entry] = ( + configspec.inline_comments.get(entry, '')) + # + else: + missing = False + val = section[entry] + + ret_true, ret_false = validate_entry(entry, configspec[entry], val, + missing, ret_true, ret_false) + + many = None + if '__many__' in configspec.scalars: + many = configspec['__many__'] + elif '___many___' in configspec.scalars: + many = configspec['___many___'] + + if many is not None: + for entry in unvalidated: + val = section[entry] + ret_true, ret_false = validate_entry(entry, many, val, False, + ret_true, ret_false) + unvalidated = [] + + for entry in incorrect_scalars: + ret_true = False + if not preserve_errors: + out[entry] = False + else: + ret_false = False + msg = 'Value %r was provided as a section' % entry + out[entry] = validator.baseErrorClass(msg) + for entry in incorrect_sections: + ret_true = False + if not preserve_errors: + out[entry] = False + else: + ret_false = False + msg = 'Section %r was provided as a single value' % entry + out[entry] = validator.baseErrorClass(msg) + + # Missing sections will have been created as empty ones when the + # configspec was read. + for entry in section.sections: + # FIXME: this means DEFAULT is not copied in copy mode + if section is self and entry == 'DEFAULT': + continue + if section[entry].configspec is None: + unvalidated.append(entry) + continue + if copy: + section.comments[entry] = configspec.comments.get(entry, []) + section.inline_comments[entry] = configspec.inline_comments.get(entry, '') + check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry]) + out[entry] = check + if check == False: + ret_true = False + elif check == True: + ret_false = False + else: + ret_true = False + + section.extra_values = unvalidated + if preserve_errors and not section._created: + # If the section wasn't created (i.e. it wasn't missing) + # then we can't return False, we need to preserve errors + ret_false = False + # + if ret_false and preserve_errors and out: + # If we are preserving errors, but all + # the failures are from missing sections / values + # then we can return False. Otherwise there is a + # real failure that we need to preserve. + ret_false = not any(out.values()) + if ret_true: + return True + elif ret_false: + return False + return out + + + def reset(self): + """Clear ConfigObj instance and restore to 'freshly created' state.""" + self.clear() + self._initialise() + # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload) + # requires an empty dictionary + self.configspec = None + # Just to be sure ;-) + self._original_configspec = None + + + def reload(self): + """ + Reload a ConfigObj from file. + + This method raises a ``ReloadError`` if the ConfigObj doesn't have + a filename attribute pointing to a file. + """ + if not isinstance(self.filename, basestring): + raise ReloadError() + + filename = self.filename + current_options = {} + for entry in OPTION_DEFAULTS: + if entry == 'configspec': + continue + current_options[entry] = getattr(self, entry) + + configspec = self._original_configspec + current_options['configspec'] = configspec + + self.clear() + self._initialise(current_options) + self._load(filename, configspec) + + + +class SimpleVal(object): + """ + A simple validator. + Can be used to check that all members expected are present. + + To use it, provide a configspec with all your members in (the value given + will be ignored). Pass an instance of ``SimpleVal`` to the ``validate`` + method of your ``ConfigObj``. ``validate`` will return ``True`` if all + members are present, or a dictionary with True/False meaning + present/missing. (Whole missing sections will be replaced with ``False``) + """ + + def __init__(self): + self.baseErrorClass = ConfigObjError + + def check(self, check, member, missing=False): + """A dummy check method, always returns the value unchanged.""" + if missing: + raise self.baseErrorClass() + return member + + +def flatten_errors(cfg, res, levels=None, results=None): + """ + An example function that will turn a nested dictionary of results + (as returned by ``ConfigObj.validate``) into a flat list. + + ``cfg`` is the ConfigObj instance being checked, ``res`` is the results + dictionary returned by ``validate``. + + (This is a recursive function, so you shouldn't use the ``levels`` or + ``results`` arguments - they are used by the function.) + + Returns a list of keys that failed. Each member of the list is a tuple:: + + ([list of sections...], key, result) + + If ``validate`` was called with ``preserve_errors=False`` (the default) + then ``result`` will always be ``False``. + + *list of sections* is a flattened list of sections that the key was found + in. + + If the section was missing (or a section was expected and a scalar provided + - or vice-versa) then key will be ``None``. + + If the value (or section) was missing then ``result`` will be ``False``. + + If ``validate`` was called with ``preserve_errors=True`` and a value + was present, but failed the check, then ``result`` will be the exception + object returned. You can use this as a string that describes the failure. + + For example *The value "3" is of the wrong type*. + """ + if levels is None: + # first time called + levels = [] + results = [] + if res == True: + return results + if res == False or isinstance(res, Exception): + results.append((levels[:], None, res)) + if levels: + levels.pop() + return results + for (key, val) in res.items(): + if val == True: + continue + if isinstance(cfg.get(key), dict): + # Go down one level + levels.append(key) + flatten_errors(cfg[key], val, levels, results) + continue + results.append((levels[:], key, val)) + # + # Go up one level + if levels: + levels.pop() + # + return results + + +def get_extra_values(conf, _prepend=()): + """ + Find all the values and sections not in the configspec from a validated + ConfigObj. + + ``get_extra_values`` returns a list of tuples where each tuple represents + either an extra section, or an extra value. + + The tuples contain two values, a tuple representing the section the value + is in and the name of the extra values. For extra values in the top level + section the first member will be an empty tuple. For values in the 'foo' + section the first member will be ``('foo',)``. For members in the 'bar' + subsection of the 'foo' section the first member will be ``('foo', 'bar')``. + + NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't + been validated it will return an empty list. + """ + out = [] + + out.extend([(_prepend, name) for name in conf.extra_values]) + for name in conf.sections: + if name not in conf.extra_values: + out.extend(get_extra_values(conf[name], _prepend + (name,))) + return out + + +"""*A programming language is a medium of expression.* - Paul Graham""" diff --git a/python/cdec/sa/__init__.py b/python/cdec/sa/__init__.py index ddefa280..8645e837 100644 --- a/python/cdec/sa/__init__.py +++ b/python/cdec/sa/__init__.py @@ -1,4 +1,4 @@ -from _cdec_sa import sym_tostring, sym_isvar, sym_fromstring,\ +from _sa import sym_fromstring,\ SuffixArray, DataArray, LCP, Precomputation, Alignment, BiLex,\ HieroCachingRuleFactory, Sampler from extractor import GrammarExtractor diff --git a/python/cdec/sa/compile.py b/python/cdec/sa/compile.py index 061cdab2..30e605a6 100644 --- a/python/cdec/sa/compile.py +++ b/python/cdec/sa/compile.py @@ -2,7 +2,7 @@ import argparse import os import logging -import configobj +import cdec.configobj import cdec.sa MAX_PHRASE_LENGTH = 4 @@ -80,7 +80,7 @@ def main(): lex.write_binary(lex_bin) # Write configuration - config = configobj.ConfigObj(args.config, unrepr=True) + config = cdec.configobj.ConfigObj(args.config, unrepr=True) config['f_sa_file'] = f_sa_bin config['e_file'] = e_bin config['a_file'] = a_bin diff --git a/python/cdec/sa/extract.py b/python/cdec/sa/extract.py index c6da5e9d..918aa3bb 100644 --- a/python/cdec/sa/extract.py +++ b/python/cdec/sa/extract.py @@ -3,7 +3,6 @@ import sys import os import argparse import logging -import configobj import cdec.sa def main(): @@ -18,7 +17,7 @@ def main(): if not os.path.exists(args.grammars): os.mkdir(args.grammars) - extractor = cdec.sa.GrammarExtractor(configobj.ConfigObj(args.config, unrepr=True)) + extractor = cdec.sa.GrammarExtractor(args.config) for i, sentence in enumerate(sys.stdin): sentence = sentence[:-1] grammar_file = os.path.join(args.grammars, 'grammar.{0}'.format(i)) diff --git a/python/cdec/sa/extractor.py b/python/cdec/sa/extractor.py index c97b3c6f..bb912e16 100644 --- a/python/cdec/sa/extractor.py +++ b/python/cdec/sa/extractor.py @@ -1,4 +1,6 @@ from itertools import chain +import os +import cdec.configobj from cdec.sa.features import EgivenFCoherent, SampleCountF, CountEF,\ MaxLexEgivenF, MaxLexFgivenE, IsSingletonF, IsSingletonFE import cdec.sa @@ -8,7 +10,10 @@ MAX_INITIAL_SIZE = 15 class GrammarExtractor: def __init__(self, config): - # TODO if str, read config + if isinstance(config, str) or isinstance(config, unicode): + if not os.path.exists(config): + raise IOError('cannot read configuration from {0}'.format(config)) + config = cdec.configobj.ConfigObj(config, unrepr=True) alignment = cdec.sa.Alignment(from_binary=config['a_file']) self.factory = cdec.sa.HieroCachingRuleFactory( # compiled alignment object (REQUIRED) diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py index 8d35d8e6..325b9e13 100644 --- a/python/cdec/sa/features.py +++ b/python/cdec/sa/features.py @@ -1,6 +1,5 @@ from __future__ import division import math -import cdec.sa MAXSCORE = 99 @@ -22,11 +21,10 @@ def CoherenceProb(fphrase, ephrase, paircount, fcount, fsample_count): def MaxLexEgivenF(ttable): def feature(fphrase, ephrase, paircount, fcount, fsample_count): - fwords = [cdec.sa.sym_tostring(w) for w in fphrase if not cdec.sa.sym_isvar(w)] + fwords = fphrase.words fwords.append('NULL') - ewords = (cdec.sa.sym_tostring(w) for w in ephrase if not cdec.sa.sym_isvar(w)) def score(): - for e in ewords: + for e in ephrase.words: maxScore = max(ttable.get_score(f, e, 0) for f in fwords) yield -math.log10(maxScore) if maxScore > 0 else MAXSCORE return sum(score()) @@ -34,11 +32,10 @@ def MaxLexEgivenF(ttable): def MaxLexFgivenE(ttable): def feature(fphrase, ephrase, paircount, fcount, fsample_count): - fwords = (cdec.sa.sym_tostring(w) for w in fphrase if not cdec.sa.sym_isvar(w)) - ewords = [cdec.sa.sym_tostring(w) for w in ephrase if not cdec.sa.sym_isvar(w)] + ewords = ephrase.words ewords.append('NULL') def score(): - for f in fwords: + for f in fphrase.words: maxScore = max(ttable.get_score(f, e, 1) for e in ewords) yield -math.log10(maxScore) if maxScore > 0 else MAXSCORE return sum(score()) diff --git a/python/setup.py b/python/setup.py index 9ae4a35c..1d1d7e45 100644 --- a/python/setup.py +++ b/python/setup.py @@ -32,7 +32,7 @@ else: BOOST_PROGRAM_OPTIONS = 'boost_program_options' ext_modules = [ - Extension(name='_cdec', + Extension(name='cdec._cdec', sources=['src/_cdec.cpp'], include_dirs=INC, library_dirs=LIB, @@ -40,8 +40,8 @@ ext_modules = [ 'cdec', 'utils', 'mteval', 'training', 'klm', 'klm_util'], extra_compile_args=['-DHAVE_CONFIG_H'], extra_link_args=LINK_ARGS), - Extension(name='_cdec_sa', - sources=['src/sa/_cdec_sa.c', 'src/sa/strmap.cc']) + Extension(name='cdec.sa._sa', + sources=['src/sa/_sa.c', 'src/sa/strmap.cc']) ] setup( diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp index 44cd6568..20b86169 100644 --- a/python/src/_cdec.cpp +++ b/python/src/_cdec.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.16 on Wed Jul 25 23:56:10 2012 */ +/* Generated by Cython 0.17.beta1 on Fri Jul 27 22:15:28 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -47,12 +47,6 @@ #define CYTHON_COMPILING_IN_CPYTHON 1 #endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCFunction_Call PyObject_Call -#else - #define __Pyx_PyCFunction_Call PyCFunction_Call -#endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -60,8 +54,11 @@ #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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 PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else @@ -130,14 +127,20 @@ #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #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_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #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 @@ -270,6 +273,7 @@ #include <math.h> #define __PYX_HAVE___cdec #define __PYX_HAVE_API___cdec +#include "string.h" #include <string> #include <vector> #include <utility> @@ -357,7 +361,11 @@ 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)) #ifdef __GNUC__ @@ -391,6 +399,8 @@ static const char *__pyx_f[] = { "hypergraph.pxi", "lattice.pxi", "mteval.pxi", + "stringsource", + "cdec.sa._sa.pxd", }; /*--- Type declarations ---*/ @@ -398,15 +408,15 @@ struct __pyx_obj_5_cdec_Scorer; struct __pyx_obj_5_cdec_NTRef; struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__; struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Phrase; struct __pyx_obj_5_cdec_Grammar; struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__; struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot; struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase; struct __pyx_obj_5_cdec_CandidateSet; struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__; -struct __pyx_obj_5_cdec_BaseTRule; struct __pyx_obj_5_cdec_TRule; -struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Rule; struct __pyx_obj_5_cdec_SegmentEvaluator; struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__; struct __pyx_obj_5_cdec_Candidate; @@ -420,7 +430,7 @@ struct __pyx_obj_5_cdec_Decoder; struct __pyx_obj_5_cdec_HypergraphNode; struct __pyx_obj_5_cdec_SparseVector; struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__; -struct __pyx_obj_5_cdec___pyx_scope_struct_12___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__; @@ -430,11 +440,12 @@ 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____iter__; +struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__; struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config; struct __pyx_obj_5_cdec_TextGrammar; struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines; @@ -443,13 +454,13 @@ struct __pyx_opt_args_5_cdec_as_str; /* "_cdec.pyx":6 * cimport decoder * - * cdef char* as_str(data, error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<< + * cdef char* 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 { int __pyx_n; - PyObject *error_msg; + char *error_msg; }; /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117 @@ -466,7 +477,7 @@ struct __pyx_obj_5_cdec_Scorer { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":18 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":20 * return '[%s]' % self.cat * * cdef class NTRef: # <<<<<<<<<<<<<< @@ -509,8 +520,23 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":146 - * self.rule.get().ComputeArity() +/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1 + * 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; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169 + * _phrase(self.f), _phrase(self.e), scores) * * cdef class Grammar: # <<<<<<<<<<<<<< * cdef shared_ptr[grammar.Grammar]* grammar @@ -539,7 +565,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ { /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57 - * del self.lattice + * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< * def lines(): @@ -551,8 +577,8 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3 - * cimport grammar +/* "/Users/vchahun/Sandbox/cdec/python/src/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) @@ -595,45 +621,34 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":26 - * return '[%d]' % self.ref +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":50 + * return TRule(lhs, f, e, scores, a) * - * cdef class BaseTRule: # <<<<<<<<<<<<<< + * cdef class TRule: # <<<<<<<<<<<<<< * cdef shared_ptr[grammar.TRule]* rule * */ -struct __pyx_obj_5_cdec_BaseTRule { +struct __pyx_obj_5_cdec_TRule { PyObject_HEAD boost::shared_ptr<TRule> *rule; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135 - * _phrase(self.f), _phrase(self.e), scores) +/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":7 + * cdef public int chunklen(self, int k) * - * cdef class TRule(BaseTRule): # <<<<<<<<<<<<<< - * def __cinit__(self, lhs, f, e, scores, a=None): - * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) - */ -struct __pyx_obj_5_cdec_TRule { - struct __pyx_obj_5_cdec_BaseTRule __pyx_base; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":4 - * - * def _phrase(phrase): - * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< - * - * cdef class NT: + * cdef class Rule: # <<<<<<<<<<<<<< + * cdef public int lhs + * cdef readonly Phrase f, e */ -struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr { +struct __pyx_obj_4cdec_2sa_3_sa_Rule { PyObject_HEAD - struct __pyx_obj_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 *); + int lhs; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e; + float *cscores; + int n_scores; + PyObject *word_alignments; }; @@ -672,7 +687,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ { * return stats * * cdef class Candidate: # <<<<<<<<<<<<<< - * cdef mteval.Candidate* candidate + * cdef mteval.const_Candidate* candidate * cdef public float score */ struct __pyx_obj_5_cdec_Candidate { @@ -682,7 +697,7 @@ struct __pyx_obj_5_cdec_Candidate { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -699,7 +714,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6 +/* "/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) * * cdef class NT: # <<<<<<<<<<<<<< @@ -724,12 +739,12 @@ struct __pyx_obj_5_cdec_HypergraphEdge { PyObject_HEAD struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtab; Hypergraph *hg; - const Hypergraph::Edge *edge; - struct __pyx_obj_5_cdec_BaseTRule *trule; + Hypergraph::Edge *edge; + struct __pyx_obj_5_cdec_TRule *trule; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -762,7 +777,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -773,7 +788,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ { PyObject_HEAD std::vector<AlignmentPoint> *__pyx_v_a; unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self; + struct __pyx_obj_5_cdec_TRule *__pyx_v_self; size_t __pyx_t_0; unsigned int __pyx_t_1; }; @@ -804,11 +819,11 @@ struct __pyx_obj_5_cdec_HypergraphNode { PyObject_HEAD struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtab; Hypergraph *hg; - const Hypergraph::Node *node; + Hypergraph::Node *node; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":36 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":45 * return sparse * * cdef class SparseVector: # <<<<<<<<<<<<<< @@ -821,7 +836,7 @@ struct __pyx_obj_5_cdec_SparseVector { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49 +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52 * return hypergraph.AsPLF(self.lattice[0], True).c_str() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -837,17 +852,17 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":31 + * self.vector[0][fid] = value * - * property edges: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.hg.edges_.size()): + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned fid + * for fid in range(1, self.vector.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ { +struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ { PyObject_HEAD - unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; + unsigned int __pyx_v_fid; + struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self; size_t __pyx_t_0; unsigned int __pyx_t_1; }; @@ -873,21 +888,22 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ { * from cython.operator cimport preincrement as pinc * * cdef class DenseVector: # <<<<<<<<<<<<<< - * cdef vector[weight_t]* vector # Not owned by DenseVector - * + * cdef vector[weight_t]* vector + * cdef bint owned # if True, do not manage memory */ struct __pyx_obj_5_cdec_DenseVector { PyObject_HEAD std::vector<weight_t> *vector; + int owned; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< - * cdef grammar.GrammarIter* root = self.grammar.get().GetRoot() - * cdef grammar.RuleBin* rbin = root.GetRules() + * 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__ { PyObject_HEAD @@ -983,7 +999,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":130 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164 * self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -992,7 +1008,24 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ { */ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ { PyObject_HEAD - struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self; + struct __pyx_obj_5_cdec_TRule *__pyx_v_self; +}; + + +/* "/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) # <<<<<<<<<<<<<< + * + * cdef class NT: + */ +struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr { + PyObject_HEAD + struct __pyx_obj_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 *); }; @@ -1064,17 +1097,17 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22 - * self.vector[0][fid] = value +/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113 * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned fid - * for fid in range(1, self.vector.size()): + * property edges: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.hg.edges_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ { +struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ { PyObject_HEAD - unsigned int __pyx_v_fid; - struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self; + unsigned int __pyx_v_i; + struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; size_t __pyx_t_0; unsigned int __pyx_t_1; }; @@ -1103,7 +1136,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":192 * self.grammar.get().SetGrammarName(string(<char *>name)) * * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<< @@ -1139,6 +1172,19 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines { +/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1 + * cdef class Phrase: # <<<<<<<<<<<<<< + * cdef int *syms + * cdef int n, *varpos, n_vars + */ + +struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase { + int (*chunkpos)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int); + int (*chunklen)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int); +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase; + + /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193 * raise NotImplemented('comparison not implemented for HypergraphEdge') * @@ -1226,9 +1272,19 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*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 int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ + static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ +static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) { + return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new( + (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL)); +} + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); @@ -1239,16 +1295,28 @@ 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*/ +#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)) { + 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 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; + if (unlikely(PyList_Append(L, x) < 0)) return NULL; Py_INCREF(Py_None); return Py_None; /* this is just to have an accurate signature */ - } - else { + } else { PyObject *r, *m; m = __Pyx_GetAttrString(L, "append"); if (!m) return NULL; @@ -1269,42 +1337,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -1320,19 +1393,30 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) Py_INCREF(r); return r; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } return m->sq_item(o, i); } } +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ @@ -1343,26 +1427,72 @@ static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); } -#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL); +#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ - 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 int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*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, long level); /*proto*/ + static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname); /*proto*/ +#ifndef __Pyx_CppExn2PyErr +#include <new> +#include <typeinfo> +#include <stdexcept> +#include <ios> +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject *); static PyObject* __Pyx_Globals(void); /*proto*/ @@ -1460,6 +1590,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #define __Pyx_Generator_USED #include <structmember.h> +#include <frameobject.h> typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD @@ -1472,15 +1603,38 @@ typedef struct { PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; + PyObject *yieldfrom; } __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_SetVtable(PyObject *dict, void *vtable); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + typedef struct { int code_line; PyCodeObject* code_object; @@ -1501,6 +1655,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from 'libc.string' */ + /* Module declarations from 'libcpp.string' */ /* Module declarations from 'libcpp.vector' */ @@ -1519,6 +1675,14 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'decoder' */ +/* Module declarations from 'cdec.sa._sa' */ +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Phrase = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Rule = 0; +static char *(*__pyx_f_4cdec_2sa_3_sa_sym_tostring)(int); /*proto*/ +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' */ @@ -1528,7 +1692,6 @@ static PyTypeObject *__pyx_ptype_5_cdec_DenseVector = 0; static PyTypeObject *__pyx_ptype_5_cdec_SparseVector = 0; static PyTypeObject *__pyx_ptype_5_cdec_NT = 0; static PyTypeObject *__pyx_ptype_5_cdec_NTRef = 0; -static PyTypeObject *__pyx_ptype_5_cdec_BaseTRule = 0; static PyTypeObject *__pyx_ptype_5_cdec_TRule = 0; static PyTypeObject *__pyx_ptype_5_cdec_Grammar = 0; static PyTypeObject *__pyx_ptype_5_cdec_TextGrammar = 0; @@ -1569,9 +1732,11 @@ static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22__make_config = 0; static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_23___cinit__ = 0; static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr = 0; static char *__pyx_f_5_cdec_as_str(PyObject *, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args); /*proto*/ +static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/ static float __pyx_f_5_cdec__compute_score(void *, SufficientStats *); /*proto*/ static void __pyx_f_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/ +static PyObject *__pyx_convert_string_to_py_(const std::string &); /*proto*/ #define __Pyx_MODULE_NAME "_cdec" int __pyx_module_is_main__cdec = 0; @@ -1586,33 +1751,36 @@ static PyObject *__pyx_builtin_eval; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_open; -static Py_ssize_t __pyx_pf_5_cdec_11DenseVector___len__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static int __pyx_pf_5_cdec_11DenseVector_4__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_6__iter__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_9dot(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_11tosparse(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static void __pyx_pf_5_cdec_12SparseVector___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_2copy(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static int __pyx_pf_5_cdec_12SparseVector_6__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_8__iter__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_13__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_15__len__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_12SparseVector_17__contains__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_19__neg__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_21__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_23__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_25__imul__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ +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 */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_27__idiv__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ +static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ #endif -static PyObject *__pyx_pf_5_cdec_12SparseVector_29__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_31__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_33__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ +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 */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_35__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ +static PyObject *__pyx_pf_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 */ @@ -1626,21 +1794,21 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_ 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 void __pyx_pf_5_cdec_9BaseTRule___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_e); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1a___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_6scores___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_scores); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule___cinit__(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 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 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 */ @@ -1680,12 +1848,12 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj 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, PyObject *__pyx_v_inp); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */ -static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_7Lattice_6__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static void __pyx_pf_5_cdec_7Lattice_13__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ +static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */ +static int __pyx_pf_5_cdec_7Lattice_6__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_8__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5_cdec_7Lattice_12__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_15todot(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 */ @@ -1760,8 +1928,10 @@ 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_56[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi"; -static char __pyx_k_62[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx"; +static char __pyx_k_54[] = "cdec.sa._sa"; +static char __pyx_k_55[] = "*"; +static char __pyx_k_58[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi"; +static char __pyx_k_64[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx"; static char __pyx_k__a[] = "a"; static char __pyx_k__e[] = "e"; static char __pyx_k__f[] = "f"; @@ -1770,6 +1940,7 @@ static char __pyx_k__k[] = "k"; static char __pyx_k__pb[] = "pb"; static char __pyx_k__CER[] = "CER"; static char __pyx_k__TER[] = "TER"; +static char __pyx_k___sa[] = "_sa"; static char __pyx_k__cat[] = "cat"; static char __pyx_k__dot[] = "dot"; static char __pyx_k__fst[] = "fst"; @@ -1805,6 +1976,7 @@ static char __pyx_k__value[] = "value"; static char __pyx_k__config[] = "config"; static char __pyx_k__csplit[] = "csplit"; static char __pyx_k__encode[] = "encode"; +static char __pyx_k__format[] = "format"; static char __pyx_k__phrase[] = "phrase"; static char __pyx_k__scores[] = "scores"; static char __pyx_k__tagger[] = "tagger"; @@ -1840,10 +2012,10 @@ static char __pyx_k__config_str[] = "config_str"; static char __pyx_k__hypergraph[] = "hypergraph"; static char __pyx_k__startswith[] = "startswith"; static char __pyx_k__ParseFailed[] = "ParseFailed"; +static char __pyx_k__PhraseModel_[] = "PhraseModel_"; static char __pyx_k___make_config[] = "_make_config"; static char __pyx_k__InvalidConfig[] = "InvalidConfig"; static char __pyx_k__NotImplemented[] = "NotImplemented"; -static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_10; static PyObject *__pyx_kp_s_11; static PyObject *__pyx_kp_s_12; @@ -1874,8 +2046,10 @@ static PyObject *__pyx_kp_s_48; static PyObject *__pyx_kp_s_49; static PyObject *__pyx_kp_s_50; static PyObject *__pyx_kp_s_53; -static PyObject *__pyx_kp_s_56; -static PyObject *__pyx_kp_s_62; +static PyObject *__pyx_n_s_54; +static PyObject *__pyx_n_s_55; +static PyObject *__pyx_kp_s_58; +static PyObject *__pyx_kp_s_64; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_8; static PyObject *__pyx_kp_s_9; @@ -1888,6 +2062,7 @@ static PyObject *__pyx_n_s__InvalidConfig; static PyObject *__pyx_n_s__KeyError; static PyObject *__pyx_n_s__NotImplemented; static PyObject *__pyx_n_s__ParseFailed; +static PyObject *__pyx_n_s__PhraseModel_; static PyObject *__pyx_n_s__TER; static PyObject *__pyx_n_s__TypeError; static PyObject *__pyx_n_s__ValueError; @@ -1900,6 +2075,7 @@ 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; static PyObject *__pyx_n_s__a; static PyObject *__pyx_n_s__beam_alpha; static PyObject *__pyx_n_s__cat; @@ -1918,6 +2094,7 @@ static PyObject *__pyx_n_s__evaluate; static PyObject *__pyx_n_s__evaluator; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__formalism; +static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__fst; static PyObject *__pyx_n_s__genexpr; static PyObject *__pyx_n_s__get; @@ -1962,6 +2139,7 @@ static PyObject *__pyx_n_s__value; static PyObject *__pyx_n_s__weight; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; +static PyObject *__pyx_int_65536; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_6; @@ -1980,32 +2158,33 @@ static PyObject *__pyx_k_tuple_44; static PyObject *__pyx_k_tuple_47; static PyObject *__pyx_k_tuple_51; static PyObject *__pyx_k_tuple_52; -static PyObject *__pyx_k_tuple_54; -static PyObject *__pyx_k_tuple_57; -static PyObject *__pyx_k_tuple_58; +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_codeobj_37; -static PyObject *__pyx_k_codeobj_55; -static PyObject *__pyx_k_codeobj_61; +static PyObject *__pyx_k_codeobj_57; +static PyObject *__pyx_k_codeobj_63; /* "_cdec.pyx":6 * cimport decoder * - * cdef char* as_str(data, error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<< + * cdef char* as_str(data, char* error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<< * cdef bytes ret * if isinstance(data, unicode): */ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args) { - PyObject *__pyx_v_error_msg = ((PyObject *)__pyx_kp_s_1); + char *__pyx_v_error_msg = ((char *)__pyx_k_1); PyObject *__pyx_v_ret = 0; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2017,7 +2196,7 @@ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args } /* "_cdec.pyx":8 - * cdef char* as_str(data, error_msg='Cannot convert type %s to str'): + * cdef char* as_str(data, char* error_msg='Cannot convert type %s to str'): * cdef bytes ret * if isinstance(data, unicode): # <<<<<<<<<<<<<< * ret = data.encode('utf8') @@ -2065,7 +2244,7 @@ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args * elif isinstance(data, str): * ret = data # <<<<<<<<<<<<<< * else: - * raise TypeError(error_msg % type(data)) + * raise TypeError(error_msg.format(type(data))) */ if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_data); @@ -2077,35 +2256,47 @@ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args /* "_cdec.pyx":13 * ret = data * else: - * raise TypeError(error_msg % type(data)) # <<<<<<<<<<<<<< + * raise TypeError(error_msg.format(type(data))) # <<<<<<<<<<<<<< * return ret * */ - __pyx_t_3 = PyNumber_Remainder(__pyx_v_error_msg, ((PyObject *)Py_TYPE(__pyx_v_data))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__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 = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(__pyx_v_data))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data))); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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[0]; __pyx_lineno = 13; __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_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; /* "_cdec.pyx":14 * else: - * raise TypeError(error_msg % type(data)) + * raise TypeError(error_msg.format(type(data))) * return ret # <<<<<<<<<<<<<< * * include "vectors.pxi" */ - __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_ret)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_4; + __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_ret)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_5; goto __pyx_L0; __pyx_r = 0; @@ -2113,6 +2304,7 @@ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -2122,30 +2314,127 @@ static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_1__len__(PyObject *__pyx_v_self) { +static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_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_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":7 + * cdef bint owned # if True, do not manage memory + * + * def __init__(self): # <<<<<<<<<<<<<< + * self.vector = new vector[weight_t]() + * self.owned = False + */ + +static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":8 + * + * def __init__(self): + * self.vector = new vector[weight_t]() # <<<<<<<<<<<<<< + * self.owned = False + * + */ + __pyx_v_self->vector = new std::vector<weight_t>(); + + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":9 + * def __init__(self): + * self.vector = new vector[weight_t]() + * self.owned = False # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->owned = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_5_cdec_11DenseVector_2__dealloc__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":11 + * self.owned = False + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if not self.owned: + * del self.vector + */ + +static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":12 + * + * def __dealloc__(self): + * if not self.owned: # <<<<<<<<<<<<<< + * del self.vector + * + */ + __pyx_t_1 = (!__pyx_v_self->owned); + if (__pyx_t_1) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":13 + * def __dealloc__(self): + * if not self.owned: + * del self.vector # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + delete __pyx_v_self->vector; + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_RefNannyFinishContext(); +} + +/* 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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_11DenseVector___len__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_11DenseVector_4__len__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":6 - * cdef vector[weight_t]* vector # Not owned by DenseVector +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":15 + * del self.vector * * def __len__(self): # <<<<<<<<<<<<<< * return self.vector.size() * */ -static Py_ssize_t __pyx_pf_5_cdec_11DenseVector___len__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_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":7 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":16 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -2162,14 +2451,14 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector___len__(struct __pyx_obj_5_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_fname); { - __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2177,12 +2466,12 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_3__getitem__(PyObject *__pyx_v_se __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_11DenseVector_2__getitem__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_5_cdec_11DenseVector_6__getitem__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":18 * return self.vector.size() * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -2190,7 +2479,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_3__getitem__(PyObject *__pyx_v_se * if 0 <= fid < self.vector.size(): */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname) { +static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname) { int __pyx_v_fid; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2202,7 +2491,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":10 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":19 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2211,7 +2500,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":11 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":20 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<< @@ -2224,7 +2513,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c } if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":12 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":21 * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] # <<<<<<<<<<<<<< @@ -2232,7 +2521,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_self->vector[0])[__pyx_v_fid])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_self->vector[0])[__pyx_v_fid])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2241,26 +2530,26 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22 * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] * raise KeyError(fname) # <<<<<<<<<<<<<< * * def __setitem__(self, char* fname, float value): */ - __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __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[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __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_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -2276,18 +2565,18 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_2__getitem__(struct __pyx_obj_5_c } /* Python wrapper */ -static int __pyx_pw_5_cdec_11DenseVector_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/ -static int __pyx_pw_5_cdec_11DenseVector_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) { +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) { char *__pyx_v_fname; float __pyx_v_value; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); assert(__pyx_arg_fname); { - __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } assert(__pyx_arg_value); { - __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2295,12 +2584,12 @@ static int __pyx_pw_5_cdec_11DenseVector_5__setitem__(PyObject *__pyx_v_self, Py __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_11DenseVector_4__setitem__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value)); + __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_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":15 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":24 * raise KeyError(fname) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -2308,7 +2597,7 @@ static int __pyx_pw_5_cdec_11DenseVector_5__setitem__(PyObject *__pyx_v_self, Py * if fid < 0: raise KeyError(fname) */ -static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) { +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) { int __pyx_v_fid; int __pyx_r; __Pyx_RefNannyDeclarations @@ -2320,7 +2609,7 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":25 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(<char *>fname) # <<<<<<<<<<<<<< @@ -2329,7 +2618,7 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De */ __pyx_v_fid = FD::Convert(((char *)__pyx_v_fname)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":26 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(<char *>fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2338,24 +2627,24 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De */ __pyx_t_1 = (__pyx_v_fid < 0); if (__pyx_t_1) { - __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __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[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); 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); 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_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":27 * cdef int fid = FDConvert(<char *>fname) * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: # <<<<<<<<<<<<<< @@ -2365,7 +2654,7 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De __pyx_t_1 = (__pyx_v_self->vector->size() <= __pyx_v_fid); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":28 * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: * self.vector.resize(fid + 1) # <<<<<<<<<<<<<< @@ -2377,7 +2666,7 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":29 * if self.vector.size() <= fid: * self.vector.resize(fid + 1) * self.vector[0][fid] = value # <<<<<<<<<<<<<< @@ -2397,20 +2686,20 @@ static int __pyx_pf_5_cdec_11DenseVector_4__setitem__(struct __pyx_obj_5_cdec_De __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_7__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_7__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_11DenseVector_6__iter__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_11DenseVector_10__iter__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":31 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -2418,7 +2707,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__iter__(PyObject *__pyx_v_self) * for fid in range(1, self.vector.size()): */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_6__iter__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2436,7 +2725,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__iter__(struct __pyx_obj_5_cdec __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_8generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -2454,7 +2743,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__iter__(struct __pyx_obj_5_cdec return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_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); PyObject *__pyx_r = NULL; @@ -2473,9 +2762,9 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__pyx_GeneratorObject return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":33 * def __iter__(self): * cdef unsigned fid * for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<< @@ -2486,18 +2775,18 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__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":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":34 * cdef unsigned fid * for fid in range(1, self.vector.size()): * yield FDConvert(fid).c_str(), self.vector[0][fid] # <<<<<<<<<<<<<< * * def dot(self, SparseVector other): */ - __pyx_t_3 = PyBytes_FromString(FD::Convert(__pyx_cur_scope->__pyx_v_fid).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyBytes_FromString(FD::Convert(__pyx_cur_scope->__pyx_v_fid).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->vector[0])[__pyx_cur_scope->__pyx_v_fid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->vector[0])[__pyx_cur_scope->__pyx_v_fid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); @@ -2517,7 +2806,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__pyx_GeneratorObject __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -2529,18 +2818,19 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_8generator(__pyx_GeneratorObject __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_10dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_10dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { 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 = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_11DenseVector_9dot(((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_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -2549,7 +2839,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_10dot(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":27 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":36 * yield FDConvert(fid).c_str(), self.vector[0][fid] * * def dot(self, SparseVector other): # <<<<<<<<<<<<<< @@ -2557,7 +2847,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_10dot(PyObject *__pyx_v_self, PyO * */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_9dot(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2568,7 +2858,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_9dot(struct __pyx_obj_5_cdec_Dens int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":37 * * def dot(self, SparseVector other): * return other.dot(self) # <<<<<<<<<<<<<< @@ -2576,14 +2866,14 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_9dot(struct __pyx_obj_5_cdec_Dens * def tosparse(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __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[1]; __pyx_lineno = 37; __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; @@ -2606,25 +2896,25 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_9dot(struct __pyx_obj_5_cdec_Dens } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_12tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_12tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_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_11tosparse(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_11DenseVector_15tosparse(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":30 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":39 * return other.dot(self) * * def tosparse(self): # <<<<<<<<<<<<<< - * cdef SparseVector sparse = SparseVector() + * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_11tosparse(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2634,29 +2924,30 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_11tosparse(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tosparse", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":40 * * def tosparse(self): - * cdef SparseVector sparse = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __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 = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_sparse = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":41 * def tosparse(self): - * cdef SparseVector sparse = SparseVector() + * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< * InitSparseVector(self.vector[0], sparse.vector) * return sparse */ __pyx_v_sparse->vector = new FastSparseVector<weight_t>(); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":33 - * cdef SparseVector sparse = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":42 + * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<< * return sparse @@ -2664,7 +2955,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_11tosparse(struct __pyx_obj_5_cde */ Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":43 * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) * return sparse # <<<<<<<<<<<<<< @@ -2690,27 +2981,68 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_11tosparse(struct __pyx_obj_5_cde } /* Python wrapper */ -static void __pyx_pw_5_cdec_12SparseVector_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_12SparseVector_1__dealloc__(PyObject *__pyx_v_self) { +static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5_cdec_12SparseVector___dealloc__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __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_RefNannyFinishContext(); + return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":39 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":48 * cdef FastSparseVector[weight_t]* vector * + * def __init__(self): # <<<<<<<<<<<<<< + * self.vector = new FastSparseVector[weight_t]() + * + */ + +static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":49 + * + * def __init__(self): + * self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->vector = new FastSparseVector<weight_t>(); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_5_cdec_12SparseVector_2__dealloc__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":51 + * self.vector = new FastSparseVector[weight_t]() + * * def __dealloc__(self): # <<<<<<<<<<<<<< * del self.vector * */ -static void __pyx_pf_5_cdec_12SparseVector___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":52 * * def __dealloc__(self): * del self.vector # <<<<<<<<<<<<<< @@ -2723,17 +3055,17 @@ static void __pyx_pf_5_cdec_12SparseVector___dealloc__(CYTHON_UNUSED struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_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_2copy(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_4copy(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":42 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":54 * del self.vector * * def copy(self): # <<<<<<<<<<<<<< @@ -2741,7 +3073,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_3copy(PyObject *__pyx_v_self, CY * */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_2copy(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2750,7 +3082,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_2copy(struct __pyx_obj_5_cdec_Sp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55 * * def copy(self): * return self * 1 # <<<<<<<<<<<<<< @@ -2758,7 +3090,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_2copy(struct __pyx_obj_5_cdec_Sp * def __getitem__(self, char* fname): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_self), __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_self), __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2777,14 +3109,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_2copy(struct __pyx_obj_5_cdec_Sp } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_fname); { - __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2792,12 +3124,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5__getitem__(PyObject *__pyx_v_s __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_4__getitem__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_6__getitem__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":45 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":57 * return self * 1 * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -2805,7 +3137,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5__getitem__(PyObject *__pyx_v_s * if fid < 0: raise KeyError(fname) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) { +static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) { int __pyx_v_fid; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2817,7 +3149,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":58 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2826,7 +3158,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_ */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":59 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2835,24 +3167,24 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_ */ __pyx_t_1 = (__pyx_v_fid < 0); if (__pyx_t_1) { - __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":60 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * return self.vector.value(fid) # <<<<<<<<<<<<<< @@ -2860,7 +3192,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_ * def __setitem__(self, char* fname, float value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->value(__pyx_v_fid)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->value(__pyx_v_fid)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2880,18 +3212,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4__getitem__(struct __pyx_obj_5_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_12SparseVector_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/ -static int __pyx_pw_5_cdec_12SparseVector_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) { +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) { char *__pyx_v_fname; float __pyx_v_value; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); assert(__pyx_arg_fname); { - __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } assert(__pyx_arg_value); { - __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2899,12 +3231,12 @@ static int __pyx_pw_5_cdec_12SparseVector_7__setitem__(PyObject *__pyx_v_self, P __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_6__setitem__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value)); + __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_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":50 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":62 * return self.vector.value(fid) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -2912,7 +3244,7 @@ static int __pyx_pw_5_cdec_12SparseVector_7__setitem__(PyObject *__pyx_v_self, P * if fid < 0: raise KeyError(fname) */ -static int __pyx_pf_5_cdec_12SparseVector_6__setitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) { +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) { int __pyx_v_fid; int __pyx_r; __Pyx_RefNannyDeclarations @@ -2924,7 +3256,7 @@ static int __pyx_pf_5_cdec_12SparseVector_6__setitem__(struct __pyx_obj_5_cdec_S int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":63 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(<char *>fname) # <<<<<<<<<<<<<< @@ -2933,7 +3265,7 @@ static int __pyx_pf_5_cdec_12SparseVector_6__setitem__(struct __pyx_obj_5_cdec_S */ __pyx_v_fid = FD::Convert(((char *)__pyx_v_fname)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":64 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(<char *>fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2942,24 +3274,24 @@ static int __pyx_pf_5_cdec_12SparseVector_6__setitem__(struct __pyx_obj_5_cdec_S */ __pyx_t_1 = (__pyx_v_fid < 0); if (__pyx_t_1) { - __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":65 * cdef int fid = FDConvert(<char *>fname) * if fid < 0: raise KeyError(fname) * self.vector.set_value(fid, value) # <<<<<<<<<<<<<< @@ -2979,20 +3311,20 @@ static int __pyx_pf_5_cdec_12SparseVector_6__setitem__(struct __pyx_obj_5_cdec_S __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_9__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_9__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_8__iter__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_10__iter__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3000,7 +3332,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_9__iter__(PyObject *__pyx_v_self * cdef unsigned i */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_8__iter__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3018,7 +3350,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_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_12SparseVector_10generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3036,7 +3368,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_8__iter__(struct __pyx_obj_5_cde return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_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); PyObject *__pyx_r = NULL; @@ -3055,9 +3387,9 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":68 * * def __iter__(self): * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<< @@ -3066,7 +3398,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje */ __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":70 * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) * cdef unsigned i * try: # <<<<<<<<<<<<<< @@ -3075,7 +3407,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":71 * cdef unsigned i * try: * for i in range(self.vector.size()): # <<<<<<<<<<<<<< @@ -3086,18 +3418,18 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__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":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72 * try: * for i in range(self.vector.size()): * yield (FDConvert(it[0].ptr().first).c_str(), it[0].ptr().second) # <<<<<<<<<<<<<< * pinc(it[0]) # ++it * finally: */ - __pyx_t_3 = PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_t_3 = PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); @@ -3117,9 +3449,9 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje __pyx_L9_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":73 * for i in range(self.vector.size()): * yield (FDConvert(it[0].ptr().first).c_str(), it[0].ptr().second) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -3130,7 +3462,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje } } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75 * pinc(it[0]) # ++it * finally: * del it # <<<<<<<<<<<<<< @@ -3175,22 +3507,23 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_10generator1(__pyx_GeneratorObje __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_12dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_12dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_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_11dot(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_13dot(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":65 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77 * del it * * def dot(self, other): # <<<<<<<<<<<<<< @@ -3198,7 +3531,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_12dot(PyObject *__pyx_v_self, Py * return self.vector.dot((<DenseVector> other).vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3209,7 +3542,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":78 * * def dot(self, other): * if isinstance(other, DenseVector): # <<<<<<<<<<<<<< @@ -3222,7 +3555,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":79 * def dot(self, other): * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3230,7 +3563,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp * return self.vector.dot((<SparseVector> other).vector[0]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3238,7 +3571,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":80 * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): # <<<<<<<<<<<<<< @@ -3251,7 +3584,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":81 * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3259,7 +3592,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3268,26 +3601,26 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":82 * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<< * * def __richcmp__(SparseVector x, SparseVector y, int op): */ - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -3303,14 +3636,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_14__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_14__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) { +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) { 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 = 72; __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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12SparseVector_13__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_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __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 = 84; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3319,7 +3652,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14__richcmp__(PyObject *__pyx_v_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":84 * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) * * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<< @@ -3327,7 +3660,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14__richcmp__(PyObject *__pyx_v_ * return x.vector[0] == y.vector[0] */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_13__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_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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3337,7 +3670,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -3346,7 +3679,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 */ switch (__pyx_v_op) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":85 * * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -3355,7 +3688,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 */ case 2: - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":86 * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == * return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<< @@ -3363,14 +3696,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 * return not (x == y) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((__pyx_v_x->vector[0]) == (__pyx_v_y->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((__pyx_v_x->vector[0]) == (__pyx_v_y->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -3379,7 +3712,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 */ case 3: - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":88 * return x.vector[0] == y.vector[0] * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -3387,11 +3720,11 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __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[1]; __pyx_lineno = 76; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3399,18 +3732,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 break; } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":89 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< * * def __len__(self): */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -3425,17 +3758,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5 } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_16__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_16__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_15__len__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_17__len__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":79 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":91 * raise NotImplemented('comparison not implemented for SparseVector') * * def __len__(self): # <<<<<<<<<<<<<< @@ -3443,12 +3776,12 @@ static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_16__len__(PyObject *__pyx_v_sel * */ -static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_15__len__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_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":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":92 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -3465,14 +3798,14 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_15__len__(struct __pyx_obj_5_cd } /* Python wrapper */ -static int __pyx_pw_5_cdec_12SparseVector_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static int __pyx_pw_5_cdec_12SparseVector_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); assert(__pyx_arg_fname); { - __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3480,12 +3813,12 @@ static int __pyx_pw_5_cdec_12SparseVector_18__contains__(PyObject *__pyx_v_self, __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_17__contains__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_19__contains__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":82 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":94 * return self.vector.size() * * def __contains__(self, char* fname): # <<<<<<<<<<<<<< @@ -3493,12 +3826,12 @@ static int __pyx_pw_5_cdec_12SparseVector_18__contains__(PyObject *__pyx_v_self, * */ -static int __pyx_pf_5_cdec_12SparseVector_17__contains__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) { +static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_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":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95 * * def __contains__(self, char* fname): * return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<< @@ -3515,25 +3848,25 @@ static int __pyx_pf_5_cdec_12SparseVector_17__contains__(struct __pyx_obj_5_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_20__neg__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_20__neg__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_19__neg__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_21__neg__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":85 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":97 * return self.vector.nonzero(FDConvert(fname)) * * def __neg__(self): # <<<<<<<<<<<<<< - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_19__neg__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3543,29 +3876,30 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_19__neg__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__neg__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":98 * * def __neg__(self): - * cdef SparseVector result = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":99 * def __neg__(self): - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<< * result.vector[0] *= -1.0 * return result */ __pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":88 - * cdef SparseVector result = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":100 + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 # <<<<<<<<<<<<<< * return result @@ -3573,7 +3907,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_19__neg__(struct __pyx_obj_5_cde */ (__pyx_v_result->vector[0]) *= -1.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":101 * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 * return result # <<<<<<<<<<<<<< @@ -3599,13 +3933,13 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_19__neg__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_22__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_22__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12SparseVector_21__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_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3614,7 +3948,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__iadd__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":91 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":103 * return result * * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -3622,12 +3956,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__iadd__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_21__iadd__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":104 * * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] # <<<<<<<<<<<<<< @@ -3636,7 +3970,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__iadd__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":105 * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] * return self # <<<<<<<<<<<<<< @@ -3656,13 +3990,13 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__iadd__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_24__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_24__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { 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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12SparseVector_23__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_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3671,7 +4005,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__isub__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":107 * return self * * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -3679,12 +4013,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__isub__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_23__isub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__isub__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":108 * * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<< @@ -3693,7 +4027,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__isub__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":109 * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] * return self # <<<<<<<<<<<<<< @@ -3713,14 +4047,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__isub__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_26__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_26__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) { +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) { float __pyx_v_scalar; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0); assert(__pyx_arg_scalar); { - __pyx_v_scalar = __pyx_PyFloat_AsFloat(__pyx_arg_scalar); if (unlikely((__pyx_v_scalar == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_scalar = __pyx_PyFloat_AsFloat(__pyx_arg_scalar); if (unlikely((__pyx_v_scalar == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3728,12 +4062,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__imul__(PyObject *__pyx_v_sel __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_25__imul__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_27__imul__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":99 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":111 * return self * * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -3741,12 +4075,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__imul__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_25__imul__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) { +static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_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":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":112 * * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar # <<<<<<<<<<<<<< @@ -3755,7 +4089,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__imul__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) *= __pyx_v_scalar; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":113 * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar * return self # <<<<<<<<<<<<<< @@ -3776,14 +4110,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__imul__(struct __pyx_obj_5_cd /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pw_5_cdec_12SparseVector_28__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_28__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) { +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) { float __pyx_v_scalar; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0); assert(__pyx_arg_scalar); { - __pyx_v_scalar = __pyx_PyFloat_AsFloat(__pyx_arg_scalar); if (unlikely((__pyx_v_scalar == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_scalar = __pyx_PyFloat_AsFloat(__pyx_arg_scalar); if (unlikely((__pyx_v_scalar == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3791,13 +4125,13 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__idiv__(PyObject *__pyx_v_sel __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_27__idiv__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); + __pyx_r = __pyx_pf_5_cdec_12SparseVector_29__idiv__(((struct __pyx_obj_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":103 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":115 * return self * * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -3806,12 +4140,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__idiv__(PyObject *__pyx_v_sel */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_27__idiv__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) { +static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_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":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":116 * * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar # <<<<<<<<<<<<<< @@ -3820,7 +4154,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__idiv__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) /= __pyx_v_scalar; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":117 * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar * return self # <<<<<<<<<<<<<< @@ -3841,14 +4175,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__idiv__(struct __pyx_obj_5_cd #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_30__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_30__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { 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 = 107; __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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12SparseVector_29__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_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __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 = 119; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3857,15 +4191,15 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__add__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":107 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":119 * return self * * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_29__add__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3875,29 +4209,30 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__add__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":120 * * def __add__(SparseVector x, SparseVector y): - * cdef SparseVector result = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) * return result */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":109 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":121 * def __add__(SparseVector x, SparseVector y): - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<< * return result * */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":110 - * cdef SparseVector result = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":122 + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) * return result # <<<<<<<<<<<<<< * @@ -3922,14 +4257,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__add__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_32__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_32__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { 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 = 112; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12SparseVector_31__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_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __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 = 124; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3938,15 +4273,15 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__sub__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":112 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":124 * return result * * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_31__sub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3956,29 +4291,30 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__sub__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__sub__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":125 * * def __sub__(SparseVector x, SparseVector y): - * cdef SparseVector result = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) * return result */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":126 * def __sub__(SparseVector x, SparseVector y): - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<< * return result * */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":115 - * cdef SparseVector result = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":127 + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) * return result # <<<<<<<<<<<<<< * @@ -4003,17 +4339,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__sub__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_34__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_34__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_33__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); + __pyx_r = __pyx_pf_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":117 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":129 * return result * * def __mul__(x, y): # <<<<<<<<<<<<<< @@ -4021,7 +4357,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__mul__(PyObject *__pyx_v_x, P * cdef float scalar */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_33__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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; float __pyx_v_scalar; struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; @@ -4035,22 +4371,22 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__mul__(PyObject *__pyx_v_x, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":132 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) */ __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_x; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_scalar = __pyx_t_3; @@ -4058,46 +4394,47 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__mul__(PyObject *__pyx_v_x, P } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":121 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":133 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< - * cdef SparseVector result = SparseVector() + * 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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_y; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_scalar = __pyx_t_3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":134 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":135 * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<< * return result * */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":124 - * cdef SparseVector result = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":136 + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result # <<<<<<<<<<<<<< * @@ -4124,18 +4461,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__mul__(PyObject *__pyx_v_x, P /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pw_5_cdec_12SparseVector_36__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_36__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__div__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_35__div__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); + __pyx_r = __pyx_pf_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":126 +/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":138 * return result * * def __div__(x, y): # <<<<<<<<<<<<<< @@ -4144,7 +4481,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_36__div__(PyObject *__pyx_v_x, P */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_35__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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; float __pyx_v_scalar; struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; @@ -4158,22 +4495,22 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__div__(PyObject *__pyx_v_x, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__div__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":141 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) */ __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_x; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_scalar = __pyx_t_3; @@ -4181,45 +4518,46 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__div__(PyObject *__pyx_v_x, P } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":142 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< - * cdef SparseVector result = SparseVector() + * 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 = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_y; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_scalar = __pyx_t_3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":143 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":144 * else: vector, scalar = y, x - * cdef SparseVector result = SparseVector() + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<< * return result */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":133 - * cdef SparseVector result = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":145 + * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result # <<<<<<<<<<<<<< */ @@ -4250,14 +4588,13 @@ static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_phrase (wrapper)", 0); - __pyx_self = __pyx_self; __pyx_r = __pyx_pf_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase)); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":4 +/* "/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) # <<<<<<<<<<<<<< @@ -4283,7 +4620,7 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) { __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7_phrase_2generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7_phrase_2generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4322,29 +4659,37 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __Pyx_RaiseClosureNameError("phrase"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __Pyx_RaiseClosureNameError("phrase"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } 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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -4360,20 +4705,20 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__ __pyx_t_6 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_w, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - __pyx_t_5 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; } else { - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_w); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_w); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_w); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_4 = __pyx_t_5; @@ -4396,7 +4741,7 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__ __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[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -4410,12 +4755,13 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__ __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/grammar.pxi":3 - * cimport grammar +/* "/Users/vchahun/Sandbox/cdec/python/src/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) @@ -4443,7 +4789,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":4 + /* "/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) # <<<<<<<<<<<<<< @@ -4451,16 +4797,16 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO * cdef class NT: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((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 = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __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[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -4488,11 +4834,11 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_cat = 0; PyObject *__pyx_v_ref = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0}; PyObject* values[2] = {0,0}; values[1] = ((PyObject *)__pyx_int_0); if (unlikely(__pyx_kwds)) { @@ -4507,8 +4853,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -4517,7 +4862,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4532,7 +4877,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_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_RefNannyFinishContext(); @@ -4543,7 +4888,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":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":11 * cdef public char* cat * cdef public unsigned ref * def __init__(self, cat, ref=0): # <<<<<<<<<<<<<< @@ -4561,24 +4906,24 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":10 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":12 * cdef public unsigned ref * def __init__(self, cat, ref=0): * self.cat = cat # <<<<<<<<<<<<<< * self.ref = ref * */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_cat); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(__pyx_v_cat); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->cat = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":11 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":13 * def __init__(self, cat, ref=0): * self.cat = cat * self.ref = ref # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_2 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_ref); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_ref); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->ref = __pyx_t_2; __pyx_r = 0; @@ -4602,7 +4947,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":13 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":15 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -4622,7 +4967,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":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":16 * * def __str__(self): * if self.ref > 0: # <<<<<<<<<<<<<< @@ -4632,7 +4977,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); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":17 * def __str__(self): * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<< @@ -4640,11 +4985,11 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __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[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); @@ -4652,7 +4997,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_3); @@ -4662,7 +5007,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":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":18 * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) * return '[%s]' % self.cat # <<<<<<<<<<<<<< @@ -4670,9 +5015,9 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ * cdef class NTRef: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); @@ -4704,7 +5049,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":7 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":9 * * cdef class NT: * cdef public char* cat # <<<<<<<<<<<<<< @@ -4721,7 +5066,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_3cat___get__(struct __pyx_obj_5_cdec_NT *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_v_self->cat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -4758,7 +5103,7 @@ static int __pyx_pf_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->cat = __pyx_t_1; __pyx_r = 0; @@ -4782,7 +5127,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":10 * cdef class NT: * cdef public char* cat * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -4799,7 +5144,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_3ref___get__(struct __pyx_obj_5_cdec_NT *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4836,7 +5181,7 @@ static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->ref = __pyx_t_1; __pyx_r = 0; @@ -4853,11 +5198,11 @@ static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_ref = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -4870,12 +5215,11 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -4886,7 +5230,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_cdec.NTRef.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4897,7 +5241,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":20 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":22 * cdef class NTRef: * cdef public unsigned ref * def __init__(self, ref): # <<<<<<<<<<<<<< @@ -4914,14 +5258,14 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":23 * cdef public unsigned ref * def __init__(self, ref): * self.ref = ref # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_ref); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_ref); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->ref = __pyx_t_1; __pyx_r = 0; @@ -4945,7 +5289,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":23 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":25 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -4963,17 +5307,17 @@ 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":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":26 * * def __str__(self): * return '[%d]' % self.ref # <<<<<<<<<<<<<< * - * cdef class BaseTRule: + * cdef TRule convert_rule(_sa.Rule rule): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject *)__pyx_t_2); @@ -5004,7 +5348,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":19 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":21 * * cdef class NTRef: * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5021,7 +5365,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_5_cdec_NTR int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5058,7 +5402,7 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_ const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->ref = __pyx_t_1; __pyx_r = 0; @@ -5071,28 +5415,589 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_ return __pyx_r; } +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":28 + * return '[%d]' % self.ref + * + * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<< + * cdef unsigned i + * cdef lhs = _sa.sym_tocat(rule.lhs) + */ + +static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_rule) { + unsigned int __pyx_v_i; + PyObject *__pyx_v_lhs = 0; + PyObject *__pyx_v_scores = 0; + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_e = NULL; + int *__pyx_v_fsyms; + int *__pyx_v_esyms; + PyObject *__pyx_v_a = 0; + PyObject *__pyx_v_point = NULL; + struct __pyx_obj_5_cdec_TRule *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + unsigned int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_rule", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30 + * cdef TRule convert_rule(_sa.Rule rule): + * cdef unsigned i + * cdef lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<< + * cdef scores = {} + * for i in range(rule.n_scores): + */ + __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_lhs = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31 + * cdef unsigned i + * cdef lhs = _sa.sym_tocat(rule.lhs) + * cdef scores = {} # <<<<<<<<<<<<<< + * for i in range(rule.n_scores): + * scores['PhraseModel_'+str(i)] = rule.cscores[i] + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_scores = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32 + * cdef lhs = _sa.sym_tocat(rule.lhs) + * cdef scores = {} + * for i in range(rule.n_scores): # <<<<<<<<<<<<<< + * scores['PhraseModel_'+str(i)] = rule.cscores[i] + * f, e = [], [] + */ + __pyx_t_2 = __pyx_v_rule->n_scores; + 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":33 + * cdef scores = {} + * for i in range(rule.n_scores): + * scores['PhraseModel_'+str(i)] = rule.cscores[i] # <<<<<<<<<<<<<< + * f, e = [], [] + * cdef int* fsyms = rule.f.syms + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_rule->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __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 = 33; __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 = 33; __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_Add(((PyObject *)__pyx_n_s__PhraseModel_), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetItem(__pyx_v_scores, __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34 + * for i in range(rule.n_scores): + * scores['PhraseModel_'+str(i)] = rule.cscores[i] + * f, e = [], [] # <<<<<<<<<<<<<< + * cdef int* fsyms = rule.f.syms + * for i in range(rule.f.n): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_v_e = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35 + * scores['PhraseModel_'+str(i)] = rule.cscores[i] + * f, e = [], [] + * cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<< + * for i in range(rule.f.n): + * if _sa.sym_isvar(fsyms[i]): + */ + __pyx_v_fsyms = __pyx_v_rule->f->syms; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":36 + * f, e = [], [] + * cdef int* fsyms = rule.f.syms + * for i in range(rule.f.n): # <<<<<<<<<<<<<< + * if _sa.sym_isvar(fsyms[i]): + * f.append(NT(_sa.sym_tocat(fsyms[i]))) + */ + __pyx_t_2 = __pyx_v_rule->f->n; + 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":37 + * cdef int* fsyms = rule.f.syms + * for i in range(rule.f.n): + * if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<< + * f.append(NT(_sa.sym_tocat(fsyms[i]))) + * else: + */ + __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])); + if (__pyx_t_6) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":38 + * for i in range(rule.f.n): + * if _sa.sym_isvar(fsyms[i]): + * f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<< + * else: + * f.append(_sa.sym_tostring(fsyms[i])) + */ + __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_f, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40 + * f.append(NT(_sa.sym_tocat(fsyms[i]))) + * else: + * f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<< + * cdef int* esyms = rule.e.syms + * for i in range(rule.e.n): + */ + __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_7 = PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __pyx_L7:; + } + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41 + * else: + * f.append(_sa.sym_tostring(fsyms[i])) + * cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<< + * for i in range(rule.e.n): + * if _sa.sym_isvar(esyms[i]): + */ + __pyx_v_esyms = __pyx_v_rule->e->syms; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42 + * f.append(_sa.sym_tostring(fsyms[i])) + * cdef int* esyms = rule.e.syms + * for i in range(rule.e.n): # <<<<<<<<<<<<<< + * if _sa.sym_isvar(esyms[i]): + * e.append(NTRef(_sa.sym_getindex(esyms[i]))) + */ + __pyx_t_2 = __pyx_v_rule->e->n; + 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":43 + * cdef int* esyms = rule.e.syms + * for i in range(rule.e.n): + * if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<< + * e.append(NTRef(_sa.sym_getindex(esyms[i]))) + * else: + */ + __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])); + if (__pyx_t_6) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":44 + * for i in range(rule.e.n): + * if _sa.sym_isvar(esyms[i]): + * e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<< + * else: + * e.append(_sa.sym_tostring(esyms[i])) + */ + __pyx_t_5 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L10; + } + /*else*/ { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46 + * e.append(NTRef(_sa.sym_getindex(esyms[i]))) + * else: + * e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<< + * cdef a = [(point/65536, point%65536) for point in rule.word_alignments] + * return TRule(lhs, f, e, scores, a) + */ + __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_7 = PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __pyx_L10:; + } + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47 + * else: + * e.append(_sa.sym_tostring(esyms[i])) + * cdef a = [(point/65536, point%65536) for point in rule.word_alignments] # <<<<<<<<<<<<<< + * return TRule(lhs, f, e, scores, a) + * + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyList_CheckExact(__pyx_v_rule->word_alignments) || PyTuple_CheckExact(__pyx_v_rule->word_alignments)) { + __pyx_t_1 = __pyx_v_rule->word_alignments; __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_rule->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_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_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __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[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_point); + __pyx_v_point = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_point, __pyx_int_65536); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyNumber_Remainder(__pyx_v_point, __pyx_int_65536); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_4 = 0; + __pyx_t_10 = 0; + if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_5)); + __pyx_v_a = ((PyObject *)__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":48 + * e.append(_sa.sym_tostring(esyms[i])) + * cdef a = [(point/65536, point%65536) for point in rule.word_alignments] + * return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<< + * + * cdef class TRule: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_lhs); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_lhs); + __Pyx_GIVEREF(__pyx_v_lhs); + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_INCREF(((PyObject *)__pyx_v_e)); + PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); + __Pyx_INCREF(__pyx_v_scores); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_scores); + __Pyx_GIVEREF(__pyx_v_scores); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)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_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("_cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lhs); + __Pyx_XDECREF(__pyx_v_scores); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_a); + __Pyx_XDECREF(__pyx_v_point); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* Python wrapper */ -static void __pyx_pw_5_cdec_9BaseTRule_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_9BaseTRule_1__dealloc__(PyObject *__pyx_v_self) { +static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_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; + PyObject *__pyx_v_scores = 0; + PyObject *__pyx_v_a = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0}; + PyObject* values[5] = {0,0,0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":53 + * cdef shared_ptr[grammar.TRule]* rule + * + * def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<< + * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) + * self.lhs = lhs + */ + 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("__init__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __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("__init__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __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_lhs = values[0]; + __pyx_v_f = values[1]; + __pyx_v_e = values[2]; + __pyx_v_scores = values[3]; + __pyx_v_a = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_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_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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + TRule *__pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":54 + * + * def __init__(self, lhs, f, e, scores, a=None): + * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<< + * self.lhs = lhs + * self.e = e + */ + try {__pyx_t_1 = new TRule();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1); + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":55 + * def __init__(self, lhs, f, e, scores, a=None): + * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) + * self.lhs = lhs # <<<<<<<<<<<<<< + * self.e = e + * self.f = f + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":56 + * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) + * self.lhs = lhs + * self.e = e # <<<<<<<<<<<<<< + * self.f = f + * self.scores = scores + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":57 + * self.lhs = lhs + * self.e = e + * self.f = f # <<<<<<<<<<<<<< + * self.scores = scores + * if a: + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":58 + * self.e = e + * self.f = f + * self.scores = scores # <<<<<<<<<<<<<< + * if a: + * self.a = a + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59 + * self.f = f + * self.scores = scores + * if a: # <<<<<<<<<<<<<< + * self.a = a + * self.rule.get().ComputeArity() + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60 + * self.scores = scores + * if a: + * self.a = a # <<<<<<<<<<<<<< + * self.rule.get().ComputeArity() + * + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61 + * if a: + * self.a = a + * self.rule.get().ComputeArity() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->rule->get()->ComputeArity(); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5_cdec_9BaseTRule___dealloc__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_pf_5_cdec_5TRule_2__dealloc__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":29 - * cdef shared_ptr[grammar.TRule]* rule +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":63 + * self.rule.get().ComputeArity() * * def __dealloc__(self): # <<<<<<<<<<<<<< * del self.rule * */ -static void __pyx_pf_5_cdec_9BaseTRule___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64 * * def __dealloc__(self): * del self.rule # <<<<<<<<<<<<<< @@ -5105,17 +6010,17 @@ static void __pyx_pf_5_cdec_9BaseTRule___dealloc__(CYTHON_UNUSED struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_5arity_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_5arity___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":67 * * property arity: * def __get__(self): # <<<<<<<<<<<<<< @@ -5123,7 +6028,7 @@ static PyObject *__pyx_pw_5_cdec_9BaseTRule_5arity_1__get__(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5132,7 +6037,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68 * property arity: * def __get__(self): * return self.rule.get().arity_ # <<<<<<<<<<<<<< @@ -5140,7 +6045,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cd * property f: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); 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_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5150,7 +6055,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cd goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.BaseTRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5159,17 +6064,17 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_5arity___get__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1f_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1f___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1f___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":71 * * property f: * def __get__(self): # <<<<<<<<<<<<<< @@ -5177,7 +6082,7 @@ static PyObject *__pyx_pw_5_cdec_9BaseTRule_1f_1__get__(PyObject *__pyx_v_self) * cdef WordID w */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { std::vector<WordID> *__pyx_v_f_; WordID __pyx_v_w; PyObject *__pyx_v_f = 0; @@ -5196,7 +6101,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72 * property f: * def __get__(self): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -5205,19 +6110,19 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":74 * cdef vector[WordID]* f_ = &self.rule.get().f_ * cdef WordID w * cdef f = [] # <<<<<<<<<<<<<< * cdef unsigned i * cdef int idx = 0 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_f = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76 * cdef f = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -5226,7 +6131,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77 * cdef unsigned i * cdef int idx = 0 * for i in range(f_.size()): # <<<<<<<<<<<<<< @@ -5237,7 +6142,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B 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":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":78 * cdef int idx = 0 * for i in range(f_.size()): * w = f_[0][i] # <<<<<<<<<<<<<< @@ -5246,7 +6151,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79 * for i in range(f_.size()): * w = f_[0][i] * if w < 0: # <<<<<<<<<<<<<< @@ -5256,7 +6161,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B __pyx_t_4 = (__pyx_v_w < 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":80 * w = f_[0][i] * if w < 0: * idx += 1 # <<<<<<<<<<<<<< @@ -5265,18 +6170,18 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81 * if w < 0: * idx += 1 * f.append(NT(TDConvert(-w), idx)) # <<<<<<<<<<<<<< * else: * f.append(unicode(TDConvert(w), encoding='utf8')) */ - __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -5284,10 +6189,10 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 81; __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __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; @@ -5295,28 +6200,28 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83 * f.append(NT(TDConvert(-w), idx)) * else: * f.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_6 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5324,7 +6229,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84 * else: * f.append(unicode(TDConvert(w), encoding='utf8')) * return f # <<<<<<<<<<<<<< @@ -5342,7 +6247,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.BaseTRule.f.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.f.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -5352,17 +6257,17 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1f___get__(struct __pyx_obj_5_cdec_B } /* Python wrapper */ -static int __pyx_pw_5_cdec_9BaseTRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static int __pyx_pw_5_cdec_9BaseTRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1f_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_f)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":52 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":86 * return f * * def __set__(self, f): # <<<<<<<<<<<<<< @@ -5370,7 +6275,7 @@ static int __pyx_pw_5_cdec_9BaseTRule_1f_3__set__(PyObject *__pyx_v_self, PyObje * f_.resize(len(f)) */ -static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_f) { +static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f) { std::vector<WordID> *__pyx_v_f_; unsigned int __pyx_v_i; CYTHON_UNUSED int __pyx_v_idx; @@ -5387,7 +6292,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":87 * * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -5396,17 +6301,17 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88 * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ * f_.resize(len(f)) # <<<<<<<<<<<<<< * cdef unsigned i * cdef int idx = 0 */ - __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90 * f_.resize(len(f)) * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -5415,25 +6320,25 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":91 * cdef unsigned i * cdef int idx = 0 * for i in range(len(f)): # <<<<<<<<<<<<<< * if isinstance(f[i], NT): * f_[0][i] = -TDConvert(<char *>f[i].cat) */ - __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 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":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92 * cdef int idx = 0 * for i in range(len(f)): * if isinstance(f[i], NT): # <<<<<<<<<<<<<< * f_[0][i] = -TDConvert(<char *>f[i].cat) * else: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)); __Pyx_INCREF(__pyx_t_4); @@ -5442,33 +6347,33 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":93 * for i in range(len(f)): * if isinstance(f[i], NT): * f_[0][i] = -TDConvert(<char *>f[i].cat) # <<<<<<<<<<<<<< * else: * f_[0][i] = TDConvert(<char *>as_str(f[i])) */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __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(((char *)__pyx_t_6))); goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95 * f_[0][i] = -TDConvert(<char *>f[i].cat) * else: * f_[0][i] = TDConvert(<char *>as_str(f[i])) # <<<<<<<<<<<<<< * * property e: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5481,7 +6386,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.BaseTRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5489,17 +6394,17 @@ static int __pyx_pf_5_cdec_9BaseTRule_1f_2__set__(struct __pyx_obj_5_cdec_BaseTR } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1e_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1e___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1e___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98 * * property e: * def __get__(self): # <<<<<<<<<<<<<< @@ -5507,7 +6412,7 @@ static PyObject *__pyx_pw_5_cdec_9BaseTRule_1e_1__get__(PyObject *__pyx_v_self) * cdef WordID w */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { std::vector<WordID> *__pyx_v_e_; WordID __pyx_v_w; PyObject *__pyx_v_e = 0; @@ -5526,7 +6431,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":99 * property e: * def __get__(self): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -5535,19 +6440,19 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101 * cdef vector[WordID]* e_ = &self.rule.get().e_ * cdef WordID w * cdef e = [] # <<<<<<<<<<<<<< * cdef unsigned i * cdef int idx = 0 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_e = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":103 * cdef e = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -5556,7 +6461,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104 * cdef unsigned i * cdef int idx = 0 * for i in range(e_.size()): # <<<<<<<<<<<<<< @@ -5567,7 +6472,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B 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":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105 * cdef int idx = 0 * for i in range(e_.size()): * w = e_[0][i] # <<<<<<<<<<<<<< @@ -5576,7 +6481,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":106 * for i in range(e_.size()): * w = e_[0][i] * if w < 1: # <<<<<<<<<<<<<< @@ -5586,7 +6491,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B __pyx_t_4 = (__pyx_v_w < 1); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107 * w = e_[0][i] * if w < 1: * idx += 1 # <<<<<<<<<<<<<< @@ -5595,24 +6500,24 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":108 * if w < 1: * idx += 1 * e.append(NTRef(1-w)) # <<<<<<<<<<<<<< * else: * e.append(unicode(TDConvert(w), encoding='utf8')) */ - __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 108; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __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; @@ -5620,28 +6525,28 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110 * e.append(NTRef(1-w)) * else: * e.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<< * return e * */ - __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5649,7 +6554,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111 * else: * e.append(unicode(TDConvert(w), encoding='utf8')) * return e # <<<<<<<<<<<<<< @@ -5667,7 +6572,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.BaseTRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); @@ -5677,17 +6582,17 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1e___get__(struct __pyx_obj_5_cdec_B } /* Python wrapper */ -static int __pyx_pw_5_cdec_9BaseTRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e); /*proto*/ -static int __pyx_pw_5_cdec_9BaseTRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self), ((PyObject *)__pyx_v_e)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1e_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_e)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113 * return e * * def __set__(self, e): # <<<<<<<<<<<<<< @@ -5695,7 +6600,7 @@ static int __pyx_pw_5_cdec_9BaseTRule_1e_3__set__(PyObject *__pyx_v_self, PyObje * e_.resize(len(e)) */ -static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_e) { +static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_e) { std::vector<WordID> *__pyx_v_e_; unsigned int __pyx_v_i; int __pyx_r; @@ -5711,7 +6616,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTR int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114 * * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -5720,35 +6625,35 @@ static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTR */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":115 * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ * e_.resize(len(e)) # <<<<<<<<<<<<<< * cdef unsigned i * for i in range(len(e)): */ - __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_e_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117 * e_.resize(len(e)) * cdef unsigned i * for i in range(len(e)): # <<<<<<<<<<<<<< * if isinstance(e[i], NTRef): * e_[0][i] = 1-e[i].ref */ - __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 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":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":118 * cdef unsigned i * for i in range(len(e)): * if isinstance(e[i], NTRef): # <<<<<<<<<<<<<< * e_[0][i] = 1-e[i].ref * else: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)); __Pyx_INCREF(__pyx_t_4); @@ -5757,36 +6662,36 @@ static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTR __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119 * for i in range(len(e)): * if isinstance(e[i], NTRef): * e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<< * else: * e_[0][i] = TDConvert(<char *>as_str(e[i])) */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __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_Subtract(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_4); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_4); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; ((__pyx_v_e_[0])[__pyx_v_i]) = __pyx_t_6; goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121 * e_[0][i] = 1-e[i].ref * else: * e_[0][i] = TDConvert(<char *>as_str(e[i])) # <<<<<<<<<<<<<< * * property a: */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); ((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_t_4, NULL))); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -5799,26 +6704,26 @@ static int __pyx_pf_5_cdec_9BaseTRule_1e_2__set__(struct __pyx_obj_5_cdec_BaseTR __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.BaseTRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_9BaseTRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1a_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_1a_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1a___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1a___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -5826,7 +6731,7 @@ static PyObject *__pyx_pw_5_cdec_9BaseTRule_1a_1__get__(PyObject *__pyx_v_self) * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_1a___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5844,7 +6749,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1a___get__(struct __pyx_obj_5_cdec_B __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_9BaseTRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5853,7 +6758,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1a___get__(struct __pyx_obj_5_cdec_B __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.BaseTRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -5862,7 +6767,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_1a___get__(struct __pyx_obj_5_cdec_B return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_9BaseTRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_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); PyObject *__pyx_r = NULL; @@ -5881,9 +6786,9 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_1a_2generator2(__pyx_GeneratorObject return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":126 * def __get__(self): * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -5892,7 +6797,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_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":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127 * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): # <<<<<<<<<<<<<< @@ -5903,18 +6808,18 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_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":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128 * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): * yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<< * * def __set__(self, a): */ - __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -5934,7 +6839,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_1a_2generator2(__pyx_GeneratorObject __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -5946,22 +6851,23 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_1a_2generator2(__pyx_GeneratorObject __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_5_cdec_9BaseTRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/ -static int __pyx_pw_5_cdec_9BaseTRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self), ((PyObject *)__pyx_v_a)); + __pyx_r = __pyx_pf_5_cdec_5TRule_1a_3__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_a)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":96 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":130 * yield (a[0][i].s_, a[0][i].t_) * * def __set__(self, a): # <<<<<<<<<<<<<< @@ -5969,7 +6875,7 @@ static int __pyx_pw_5_cdec_9BaseTRule_1a_4__set__(PyObject *__pyx_v_self, PyObje * a_.resize(len(a)) */ -static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_a) { +static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_a) { std::vector<AlignmentPoint> *__pyx_v_a_; unsigned int __pyx_v_i; int __pyx_v_s; @@ -5990,7 +6896,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTR int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131 * * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -5999,61 +6905,67 @@ static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTR */ __pyx_v_a_ = (&__pyx_v_self->rule->get()->a_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":132 * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ * a_.resize(len(a)) # <<<<<<<<<<<<<< * cdef unsigned i * cdef int s, t */ - __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_a_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135 * cdef unsigned i * cdef int s, t * for i in range(len(a)): # <<<<<<<<<<<<<< * s, t = a[i] * a_[0][i] = grammar.AlignmentPoint(s, t) */ - __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 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":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":136 * cdef int s, t * for i in range(len(a)): * s, t = a[i] # <<<<<<<<<<<<<< * a_[0][i] = grammar.AlignmentPoint(s, t) * */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; + #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[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __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[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __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; @@ -6061,24 +6973,25 @@ static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTR __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_s = __pyx_t_8; __pyx_v_t = __pyx_t_9; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137 * for i in range(len(a)): * s, t = a[i] * a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<< @@ -6095,7 +7008,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTR __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.BaseTRule.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6103,25 +7016,25 @@ static int __pyx_pf_5_cdec_9BaseTRule_1a_3__set__(struct __pyx_obj_5_cdec_BaseTR } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_6scores_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_6scores___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":106 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":140 * * property scores: * def __get__(self): # <<<<<<<<<<<<<< - * cdef SparseVector scores = SparseVector() + * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_6scores___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { struct __pyx_obj_5_cdec_SparseVector *__pyx_v_scores = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6131,29 +7044,30 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_6scores___get__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":141 * property scores: * def __get__(self): - * cdef SparseVector scores = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * scores.vector = new FastSparseVector[double](self.rule.get().scores_) * return scores */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142 * def __get__(self): - * cdef SparseVector scores = SparseVector() + * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<< * return scores * */ __pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":109 - * cdef SparseVector scores = SparseVector() + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143 + * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) * return scores # <<<<<<<<<<<<<< * @@ -6168,7 +7082,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_6scores___get__(struct __pyx_obj_5_c goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.BaseTRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_scores); @@ -6178,17 +7092,17 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_6scores___get__(struct __pyx_obj_5_c } /* Python wrapper */ -static int __pyx_pw_5_cdec_9BaseTRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores); /*proto*/ -static int __pyx_pw_5_cdec_9BaseTRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self), ((PyObject *)__pyx_v_scores)); + __pyx_r = __pyx_pf_5_cdec_5TRule_6scores_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_scores)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":145 * return scores * * def __set__(self, scores): # <<<<<<<<<<<<<< @@ -6196,7 +7110,7 @@ static int __pyx_pw_5_cdec_9BaseTRule_6scores_3__set__(PyObject *__pyx_v_self, P * scores_.clear() */ -static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_scores) { +static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_scores) { FastSparseVector<double> *__pyx_v_scores_; int __pyx_v_fid; float __pyx_v_fval; @@ -6218,7 +7132,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":112 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":146 * * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<< @@ -6227,7 +7141,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B */ __pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147 * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ * scores_.clear() # <<<<<<<<<<<<<< @@ -6236,23 +7150,23 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B */ __pyx_v_scores_->clear(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150 * cdef int fid * cdef float fval * for fname, fval in scores.items(): # <<<<<<<<<<<<<< * fid = FDConvert(<char *>as_str(fname)) * if fid < 0: raise KeyError(fname) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __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[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 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[2]; __pyx_lineno = 116; __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[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -6260,16 +7174,24 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B 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++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __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[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -6277,29 +7199,35 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; + #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[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -6307,24 +7235,25 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B __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[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } - __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_fname); __pyx_v_fname = __pyx_t_5; __pyx_t_5 = 0; __pyx_v_fval = __pyx_t_9; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":151 * cdef float fval * for fname, fval in scores.items(): * fid = FDConvert(<char *>as_str(fname)) # <<<<<<<<<<<<<< @@ -6333,7 +7262,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B */ __pyx_v_fid = FD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_v_fname, NULL))); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":118 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152 * for fname, fval in scores.items(): * fid = FDConvert(<char *>as_str(fname)) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -6342,22 +7271,22 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B */ __pyx_t_10 = (__pyx_v_fid < 0); if (__pyx_t_10) { - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fname); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fname); __Pyx_GIVEREF(__pyx_v_fname); - __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153 * fid = FDConvert(<char *>as_str(fname)) * if fid < 0: raise KeyError(fname) * scores_.set_value(fid, fval) # <<<<<<<<<<<<<< @@ -6376,7 +7305,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec.BaseTRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fname); @@ -6385,17 +7314,17 @@ static int __pyx_pf_5_cdec_9BaseTRule_6scores_2__set__(struct __pyx_obj_5_cdec_B } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_3lhs_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_3lhs___get__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":122 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":156 * * property lhs: * def __get__(self): # <<<<<<<<<<<<<< @@ -6403,7 +7332,7 @@ static PyObject *__pyx_pw_5_cdec_9BaseTRule_3lhs_1__get__(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6413,7 +7342,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157 * property lhs: * def __get__(self): * return NT(TDConvert(-self.rule.get().lhs_)) # <<<<<<<<<<<<<< @@ -6421,14 +7350,14 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec * def __set__(self, lhs): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __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[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = 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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 157; __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; @@ -6440,7 +7369,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.BaseTRule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6449,17 +7378,17 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_3lhs___get__(struct __pyx_obj_5_cdec } /* Python wrapper */ -static int __pyx_pw_5_cdec_9BaseTRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs); /*proto*/ -static int __pyx_pw_5_cdec_9BaseTRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self), ((PyObject *)__pyx_v_lhs)); + __pyx_r = __pyx_pf_5_cdec_5TRule_3lhs_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_lhs)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":125 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159 * return NT(TDConvert(-self.rule.get().lhs_)) * * def __set__(self, lhs): # <<<<<<<<<<<<<< @@ -6467,7 +7396,7 @@ static int __pyx_pw_5_cdec_9BaseTRule_3lhs_3__set__(PyObject *__pyx_v_self, PyOb * lhs = NT(lhs) */ -static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self, PyObject *__pyx_v_lhs) { +static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6481,7 +7410,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_Base __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_lhs); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":126 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160 * * def __set__(self, lhs): * if not isinstance(lhs, NT): # <<<<<<<<<<<<<< @@ -6495,19 +7424,19 @@ static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_Base __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161 * def __set__(self, lhs): * if not isinstance(lhs, NT): * lhs = NT(lhs) # <<<<<<<<<<<<<< * self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_lhs); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_lhs); __Pyx_GIVEREF(__pyx_v_lhs); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_lhs); @@ -6517,16 +7446,16 @@ static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_Base } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162 * if not isinstance(lhs, NT): * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_lhs, __pyx_n_s__cat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_lhs, __pyx_n_s__cat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_self->rule->get()->lhs_ = (-TD::Convert(((char *)__pyx_t_5))); @@ -6535,7 +7464,7 @@ static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_Base __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.BaseTRule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_lhs); @@ -6544,18 +7473,18 @@ static int __pyx_pf_5_cdec_9BaseTRule_3lhs_2__set__(struct __pyx_obj_5_cdec_Base } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9BaseTRule_3__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9BaseTRule_2__str__(((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_5TRule_4__str__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -6563,7 +7492,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato * _phrase(self.f), _phrase(self.e), scores) */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(PyObject *__pyx_self) { +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6581,7 +7510,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(PyObject *__pyx_sel __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_9BaseTRule_7__str___2generator18, (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_5_cdec_5TRule_7__str___2generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -6590,7 +7519,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(PyObject *__pyx_sel __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.BaseTRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -6599,7 +7528,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(PyObject *__pyx_sel return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -6617,15 +7546,15 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -6633,16 +7562,24 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato for (;;) { if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -6653,7 +7590,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_feat = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -6672,7 +7609,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -6684,11 +7621,12 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato __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/grammar.pxi":130 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164 * self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -6696,7 +7634,7 @@ static PyObject *__pyx_gb_5_cdec_9BaseTRule_7__str___2generator18(__pyx_Generato * return '%s ||| %s ||| %s ||| %s' % (self.lhs, */ -static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_BaseTRule *__pyx_v_self) { +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; PyObject *__pyx_v_scores = NULL; PyObject *__pyx_r = NULL; @@ -6720,30 +7658,30 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_Bas __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":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< * return '%s ||| %s ||| %s ||| %s' % (self.lhs, * _phrase(self.f), _phrase(self.e), scores) */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); 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_t_2 = __pyx_pf_5_cdec_9BaseTRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 165; __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __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[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_scores = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":166 * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<< @@ -6751,43 +7689,43 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_Bas * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167 * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, * _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<< * - * cdef class TRule(BaseTRule): + * cdef class Grammar: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __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); @@ -6801,7 +7739,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_Bas __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = ((PyObject *)__pyx_t_3); @@ -6816,7 +7754,7 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_Bas __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec.BaseTRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_scores); @@ -6827,199 +7765,6 @@ static PyObject *__pyx_pf_5_cdec_9BaseTRule_2__str__(struct __pyx_obj_5_cdec_Bas } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_1__cinit__(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; - PyObject *__pyx_v_scores = 0; - PyObject *__pyx_v_a = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0}; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - PyObject* values[5] = {0,0,0,0,0}; - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":136 - * - * cdef class TRule(BaseTRule): - * def __cinit__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<< - * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) - * self.lhs = lhs - */ - 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: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - 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[2]; __pyx_lineno = 136; __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_lhs = values[0]; - __pyx_v_f = values[1]; - __pyx_v_e = values[2]; - __pyx_v_scores = values[3]; - __pyx_v_a = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.TRule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_5TRule___cinit__(((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_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5_cdec_5TRule___cinit__(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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137 - * cdef class TRule(BaseTRule): - * def __cinit__(self, lhs, f, e, scores, a=None): - * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<< - * self.lhs = lhs - * self.e = e - */ - __pyx_v_self->__pyx_base.rule = new boost::shared_ptr<TRule>(new TRule()); - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":138 - * def __cinit__(self, lhs, f, e, scores, a=None): - * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) - * self.lhs = lhs # <<<<<<<<<<<<<< - * self.e = e - * self.f = f - */ - if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":139 - * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) - * self.lhs = lhs - * self.e = e # <<<<<<<<<<<<<< - * self.f = f - * self.scores = scores - */ - if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":140 - * self.lhs = lhs - * self.e = e - * self.f = f # <<<<<<<<<<<<<< - * self.scores = scores - * if a: - */ - if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":141 - * self.e = e - * self.f = f - * self.scores = scores # <<<<<<<<<<<<<< - * if a: - * self.a = a - */ - if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142 - * self.f = f - * self.scores = scores - * if a: # <<<<<<<<<<<<<< - * self.a = a - * self.rule.get().ComputeArity() - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143 - * self.scores = scores - * if a: - * self.a = a # <<<<<<<<<<<<<< - * self.rule.get().ComputeArity() - * - */ - if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":144 - * if a: - * self.a = a - * self.rule.get().ComputeArity() # <<<<<<<<<<<<<< - * - * cdef class Grammar: - */ - __pyx_v_self->__pyx_base.rule->get()->ComputeArity(); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.TRule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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) { __Pyx_RefNannyDeclarations @@ -7028,7 +7773,7 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":149 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172 * cdef shared_ptr[grammar.Grammar]* grammar * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7040,7 +7785,7 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173 * * def __dealloc__(self): * del self.grammar # <<<<<<<<<<<<<< @@ -7064,12 +7809,12 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< - * cdef grammar.GrammarIter* root = self.grammar.get().GetRoot() - * cdef grammar.RuleBin* rbin = root.GetRules() + * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() + * 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) { @@ -7090,7 +7835,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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -7125,63 +7870,64 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":176 * * def __iter__(self): - * cdef grammar.GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<< - * cdef grammar.RuleBin* rbin = root.GetRules() + * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<< + * cdef grammar.const_RuleBin* rbin = root.GetRules() * cdef TRule trule */ __pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":177 * def __iter__(self): - * cdef grammar.GrammarIter* root = self.grammar.get().GetRoot() - * cdef grammar.RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<< + * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() + * cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<< * cdef TRule trule * cdef unsigned i */ __pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":180 * cdef TRule trule * cdef unsigned i * for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<< - * trule = TRule() + * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) */ __pyx_t_1 = __pyx_cur_scope->__pyx_v_rbin->GetNumRules(); 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":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":181 * cdef unsigned i * for i in range(rbin.GetNumRules()): - * trule = TRule() # <<<<<<<<<<<<<< + * trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) * yield trule */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __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_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":182 * for i in range(rbin.GetNumRules()): - * trule = TRule() + * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<< * yield trule * */ - __pyx_cur_scope->__pyx_v_trule->__pyx_base.rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i)); + __pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160 - * trule = TRule() + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":183 + * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) * yield trule # <<<<<<<<<<<<<< * @@ -7199,7 +7945,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -7209,6 +7955,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -7224,7 +7971,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":163 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":186 * * property name: * def __get__(self): # <<<<<<<<<<<<<< @@ -7237,7 +7984,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187 * property name: * def __get__(self): * self.grammar.get().GetGrammarName().c_str() # <<<<<<<<<<<<<< @@ -7263,7 +8010,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":166 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":189 * self.grammar.get().GetGrammarName().c_str() * * def __set__(self, name): # <<<<<<<<<<<<<< @@ -7280,14 +8027,14 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":190 * * def __set__(self, name): * self.grammar.get().SetGrammarName(string(<char *>name)) # <<<<<<<<<<<<<< * * cdef class TextGrammar(Grammar): */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->grammar->get()->SetGrammarName(std::string(((char *)__pyx_t_1))); __pyx_r = 0; @@ -7304,11 +8051,11 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_rules = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -7321,12 +8068,11 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __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[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -7337,7 +8083,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb } 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[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_cdec.TextGrammar.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7348,7 +8094,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170 +/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":193 * * cdef class TextGrammar(Grammar): * def __cinit__(self, rules): # <<<<<<<<<<<<<< @@ -7366,13 +8112,14 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - int __pyx_t_6; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":194 * cdef class TextGrammar(Grammar): * def __cinit__(self, rules): * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<< @@ -7381,43 +8128,51 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG */ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar()); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":195 * def __cinit__(self, rules): * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<< * for trule in rules: - * if not isinstance(trule, BaseTRule): + * if isinstance(trule, _sa.Rule): */ __pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get()); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":196 * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: # <<<<<<<<<<<<<< - * if not isinstance(trule, BaseTRule): - * raise ValueError('the grammar should contain TRule objects') + * if isinstance(trule, _sa.Rule): + * trule = convert_rule(trule) */ if (PyList_CheckExact(__pyx_v_rules) || PyTuple_CheckExact(__pyx_v_rules)) { __pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __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[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -7427,41 +8182,73 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG __pyx_v_trule = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":174 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":197 * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: - * if not isinstance(trule, BaseTRule): # <<<<<<<<<<<<<< - * raise ValueError('the grammar should contain TRule objects') - * _g.AddRule((<BaseTRule> trule).rule[0]) + * if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<< + * trule = convert_rule(trule) + * elif not isinstance(trule, TRule): */ - __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_BaseTRule)); + __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (!__pyx_t_5); - if (__pyx_t_6) { + if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175 + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":198 * for trule in rules: - * if not isinstance(trule, BaseTRule): - * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< - * _g.AddRule((<BaseTRule> trule).rule[0]) + * if isinstance(trule, _sa.Rule): + * trule = convert_rule(trule) # <<<<<<<<<<<<<< + * elif not isinstance(trule, TRule): + * raise ValueError('the grammar should contain TRule objects') */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); + 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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_v_trule; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_t_4))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_v_trule); + __pyx_v_trule = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L5; + } + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199 + * 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> trule).rule[0]) + */ + __pyx_t_6 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = (!__pyx_t_5); + if (__pyx_t_7) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":200 + * trule = convert_rule(trule) + * elif not isinstance(trule, TRule): + * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< + * _g.AddRule((<TRule> trule).rule[0]) + */ + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":176 - * if not isinstance(trule, BaseTRule): + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201 + * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') - * _g.AddRule((<BaseTRule> trule).rule[0]) # <<<<<<<<<<<<<< + * _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<< */ - __pyx_v__g->AddRule((((struct __pyx_obj_5_cdec_BaseTRule *)__pyx_v_trule)->rule[0])); + __pyx_v__g->AddRule((((struct __pyx_obj_5_cdec_TRule *)__pyx_v_trule)->rule[0])); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7470,6 +8257,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("_cdec.TextGrammar.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -7738,7 +8526,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_ * return (f_tree, e_tree) * * def viterbi_features(self): # <<<<<<<<<<<<<< - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) */ @@ -7755,18 +8543,19 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":24 * * def viterbi_features(self): - * cdef SparseVector fmap = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":25 * def viterbi_features(self): - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<< * return fmap * @@ -7774,7 +8563,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0]))); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":26 - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap # <<<<<<<<<<<<<< * @@ -8078,6 +8867,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -8378,6 +9168,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -8496,7 +9287,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< * if not derivation: break - * fmap = SparseVector() + * fmap = SparseVector.__new__(SparseVector) */ __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); @@ -8504,7 +9295,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< - * fmap = SparseVector() + * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) */ __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_derivation != 0)); @@ -8517,12 +9308,13 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":70 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break - * fmap = SparseVector() # <<<<<<<<<<<<<< + * fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * fmap.vector = new FastSparseVector[weight_t](derivation._yield) * yield fmap */ - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_t_4 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(__pyx_t_4); + if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap)); __Pyx_GIVEREF(__pyx_t_4); @@ -8531,7 +9323,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71 * if not derivation: break - * fmap = SparseVector() + * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<< * yield fmap * finally: @@ -8539,7 +9331,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":72 - * fmap = SparseVector() + * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) * yield fmap # <<<<<<<<<<<<<< * finally: @@ -8603,6 +9395,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -8679,10 +9472,11 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; - size_t __pyx_t_2; - unsigned int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + MT19937 *__pyx_t_2; + size_t __pyx_t_3; + unsigned int __pyx_t_4; PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { @@ -8721,7 +9515,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos) * cdef unsigned k */ - __pyx_cur_scope->__pyx_v_self->rng = new MT19937(); + try {__pyx_t_2 = new MT19937();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + __pyx_cur_scope->__pyx_v_self->rng = __pyx_t_2; goto __pyx_L4; } __pyx_L4:; @@ -8751,9 +9546,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') * finally: */ - __pyx_t_2 = __pyx_cur_scope->__pyx_v_hypos->size(); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_cur_scope->__pyx_v_k = __pyx_t_3; + __pyx_t_3 = __pyx_cur_scope->__pyx_v_hypos->size(); + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_cur_scope->__pyx_v_k = __pyx_t_4; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":84 * try: @@ -8762,31 +9557,31 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject * finally: * del hypos */ - __pyx_t_4 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; __Pyx_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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;} } } @@ -8806,8 +9601,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject __pyx_why = 0; goto __pyx_L7; __pyx_L6: { __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); __pyx_exc_lineno = __pyx_lineno; goto __pyx_L7; @@ -8828,12 +9623,13 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("sample", __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; } @@ -8903,13 +9699,13 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(PyObject *__pyx_v_self, Py PyObject *__pyx_v_beam_alpha = 0; PyObject *__pyx_v_density = 0; PyObject *__pyx_v_kwargs = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("prune (wrapper)", 0); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)__pyx_int_0); values[1] = ((PyObject *)__pyx_int_0); @@ -9408,6 +10204,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__pyx_Generator __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -9534,6 +10331,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator9(__pyx_Generator __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -9666,15 +10464,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_31inside_outside(PyObject *__pyx_v * return self.hg.NumberOfPaths() * * def inside_outside(self): # <<<<<<<<<<<<<< - * cdef FastSparseVector[LogVal[double]]* result = new FastSparseVector[LogVal[double]]() - * cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) + * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() + * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) */ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { - FastSparseVector<LogVal<double> > *__pyx_v_result; - LogVal<double> __pyx_v_z; + FastSparseVector<prob_t> *__pyx_v_result; + prob_t __pyx_v_z; struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0; - FastSparseVector<LogVal<double> >::const_iterator *__pyx_v_it; + FastSparseVector<prob_t>::const_iterator *__pyx_v_it; CYTHON_UNUSED unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -9689,62 +10487,63 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":133 * * def inside_outside(self): - * cdef FastSparseVector[LogVal[double]]* result = new FastSparseVector[LogVal[double]]() # <<<<<<<<<<<<<< - * cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) + * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<< + * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z */ - __pyx_v_result = new FastSparseVector<LogVal<double> >(); + __pyx_v_result = new FastSparseVector<prob_t>(); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134 * def inside_outside(self): - * cdef FastSparseVector[LogVal[double]]* result = new FastSparseVector[LogVal[double]]() - * cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<< + * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() + * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<< * result[0] /= z - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) */ __pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135 - * cdef FastSparseVector[LogVal[double]]* result = new FastSparseVector[LogVal[double]]() - * cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) + * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() + * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z # <<<<<<<<<<<<<< - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() */ (__pyx_v_result[0]) /= __pyx_v_z; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136 - * cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) + * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z - * cdef SparseVector vector = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * vector.vector = new FastSparseVector[double]() - * cdef FastSparseVector[LogVal[double]].const_iterator* it = new FastSparseVector[LogVal[double]].const_iterator(result[0], False) + * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":137 * result[0] /= z - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<< - * cdef FastSparseVector[LogVal[double]].const_iterator* it = new FastSparseVector[LogVal[double]].const_iterator(result[0], False) + * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) * cdef unsigned i */ __pyx_v_vector->vector = new FastSparseVector<double>(); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138 - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() - * cdef FastSparseVector[LogVal[double]].const_iterator* it = new FastSparseVector[LogVal[double]].const_iterator(result[0], False) # <<<<<<<<<<<<<< + * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<< * cdef unsigned i * for i in range(result.size()): */ - __pyx_v_it = new FastSparseVector<LogVal<double> >::const_iterator((__pyx_v_result[0]), 0); + __pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":140 - * cdef FastSparseVector[LogVal[double]].const_iterator* it = new FastSparseVector[LogVal[double]].const_iterator(result[0], False) + * 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()): # <<<<<<<<<<<<<< * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) @@ -9817,7 +10616,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_ } /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":152 - * cdef public BaseTRule trule + * cdef public TRule trule * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< * self.hg = hg @@ -9838,7 +10637,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< * self.edge = &hg.edges_[i] - * self.trule = BaseTRule() + * self.trule = TRule.__new__(TRule) */ __pyx_v_self->hg = __pyx_v_hg; @@ -9846,7 +10645,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.edge = &hg.edges_[i] # <<<<<<<<<<<<<< - * self.trule = BaseTRule() + * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) */ __pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i])); @@ -9854,21 +10653,22 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155 * self.hg = hg * self.edge = &hg.edges_[i] - * self.trule = BaseTRule() # <<<<<<<<<<<<<< + * self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) * return self */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_BaseTRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_BaseTRule *)__pyx_t_1); + __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156 * self.edge = &hg.edges_[i] - * self.trule = BaseTRule() + * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<< * return self * @@ -9876,7 +10676,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy __pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157 - * self.trule = BaseTRule() + * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) * return self # <<<<<<<<<<<<<< * @@ -10120,6 +10920,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__py __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -10207,7 +11008,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb * * property feature_values: * def __get__(self): # <<<<<<<<<<<<<< - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) */ @@ -10224,18 +11025,19 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":178 * property feature_values: * def __get__(self): - * cdef SparseVector vector = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * vector.vector = new FastSparseVector[double](self.edge.feature_values_) * return vector */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":179 * def __get__(self): - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<< * return vector * @@ -10243,7 +11045,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc __pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_); /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180 - * cdef SparseVector vector = SparseVector() + * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) * return vector # <<<<<<<<<<<<<< * @@ -10457,7 +11259,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150 * cdef hypergraph.Hypergraph* hg * cdef hypergraph.HypergraphEdge* edge - * cdef public BaseTRule trule # <<<<<<<<<<<<<< + * cdef public TRule trule # <<<<<<<<<<<<<< * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): */ @@ -10496,12 +11298,12 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_c const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_BaseTRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __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_BaseTRule *)__pyx_v_value); + __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_v_value); __pyx_r = 0; goto __pyx_L0; @@ -10532,7 +11334,7 @@ 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_BaseTRule *)Py_None); + __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -10711,6 +11513,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__pyx_G __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -10837,6 +11640,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__pyx_ __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -11092,11 +11896,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 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) { PyObject *__pyx_v_inp = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -11109,8 +11913,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -11206,10 +12009,18 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_ for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_6 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_6)) { @@ -11332,7 +12143,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_ * self.lattice = new lattice.Lattice() * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) # <<<<<<<<<<<<<< * - * def __getitem__(self, int index): + * def __dealloc__(self): */ __pyx_t_8 = PyBytes_AsString(__pyx_v_inp); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} LatticeTools::ConvertTextToLattice(std::string(((char *)__pyx_t_8)), __pyx_v_self->lattice); @@ -11356,14 +12167,47 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { +static void __pyx_pw_5_cdec_7Lattice_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_5_cdec_7Lattice_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_5_cdec_7Lattice_2__dealloc__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19 + * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * del self.lattice + * + */ + +static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":20 + * + * def __dealloc__(self): + * del self.lattice # <<<<<<<<<<<<<< + * + * def __getitem__(self, int index): + */ + delete __pyx_v_self->lattice; + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { int __pyx_v_index; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11371,20 +12215,20 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_3__getitem__(PyObject *__pyx_v_self, P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_7Lattice_2__getitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index)); + __pyx_r = __pyx_pf_5_cdec_7Lattice_4__getitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19 - * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22 + * del self.lattice * * def __getitem__(self, int index): # <<<<<<<<<<<<<< * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') */ -static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) { +static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) { PyObject *__pyx_v_arcs = NULL; std::vector<LatticeArc> __pyx_v_arc_vector; LatticeArc *__pyx_v_arc; @@ -11406,7 +12250,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":23 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -11415,41 +12259,41 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L */ __pyx_t_1 = (0 <= __pyx_v_index); if (__pyx_t_1) { - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (__pyx_v_index < __pyx_t_2); } __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25 * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') * arcs = [] # <<<<<<<<<<<<<< * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] * cdef lattice.LatticeArc* arc */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_arcs = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26 * raise IndexError('lattice index out of range') * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<< @@ -11458,7 +12302,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__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":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29 * cdef lattice.LatticeArc* arc * cdef unsigned i * for i in range(arc_vector.size()): # <<<<<<<<<<<<<< @@ -11469,7 +12313,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__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":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30 * cdef unsigned i * for i in range(arc_vector.size()): * arc = &arc_vector[i] # <<<<<<<<<<<<<< @@ -11478,16 +12322,16 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__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":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31 * for i in range(arc_vector.size()): * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label), 'utf8') # <<<<<<<<<<<<<< * arcs.append((label, arc.cost, arc.dist2next)) * return tuple(arcs) */ - __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); @@ -11495,25 +12339,25 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_label)); __pyx_v_label = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32 * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<< * return tuple(arcs) * */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_v_label)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_label)); @@ -11524,11 +12368,11 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L __Pyx_GIVEREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_7 = 0; - __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33 * label = unicode(TDConvert(arc.label), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) * return tuple(arcs) # <<<<<<<<<<<<<< @@ -11536,7 +12380,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L * def __setitem__(self, int index, tuple arcs): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __pyx_r = ((PyObject *)__pyx_t_8); __pyx_t_8 = 0; @@ -11559,14 +12403,14 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/ -static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) { +static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/ +static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) { int __pyx_v_index; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11574,8 +12418,8 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_7Lattice_4__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_5_cdec_7Lattice_6__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -11584,7 +12428,7 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32 +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35 * return tuple(arcs) * * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<< @@ -11592,7 +12436,7 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec * raise IndexError('lattice index out of range') */ -static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) { +static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_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; @@ -11617,7 +12461,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":36 * * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -11626,29 +12470,29 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice */ __pyx_t_1 = (0 <= __pyx_v_index); if (__pyx_t_1) { - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (__pyx_v_index < __pyx_t_2); } __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39 * raise IndexError('lattice index out of range') * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<< @@ -11656,29 +12500,35 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice * label = label.encode('utf8') */ if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif 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[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); __pyx_t_8 = PyList_GET_ITEM(sequence, 2); @@ -11686,10 +12536,16 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; @@ -11699,14 +12555,15 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice __Pyx_GOTREF(__pyx_t_7); index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L7_unpacking_done; __pyx_L6_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L7_unpacking_done:; } __Pyx_XDECREF(__pyx_v_label); @@ -11719,7 +12576,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_v_dist2next = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40 * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: * if isinstance(label, unicode): # <<<<<<<<<<<<<< @@ -11732,16 +12589,16 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41 * for (label, cost, dist2next) in arcs: * if isinstance(label, unicode): * label = label.encode('utf8') # <<<<<<<<<<<<<< * arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_label); @@ -11751,19 +12608,19 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42 * if isinstance(label, unicode): * label = label.encode('utf8') * arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) # <<<<<<<<<<<<<< * self.lattice[0][index].push_back(arc[0]) * del arc */ - __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arc = new LatticeArc(TD::Convert(((char *)__pyx_t_11)), __pyx_t_12, __pyx_t_13); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43 * label = label.encode('utf8') * arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<< @@ -11772,7 +12629,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice */ ((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44 * arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) * del arc # <<<<<<<<<<<<<< @@ -11803,17 +12660,17 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_7Lattice_7__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_7Lattice_7__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_6__len__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_7Lattice_8__len__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43 +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46 * del arc * * def __len__(self): # <<<<<<<<<<<<<< @@ -11821,12 +12678,12 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_7__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_5_cdec_7Lattice_6__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +static Py_ssize_t __pyx_pf_5_cdec_7Lattice_8__len__(struct __pyx_obj_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":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47 * * def __len__(self): * return self.lattice.size() # <<<<<<<<<<<<<< @@ -11843,17 +12700,17 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_6__len__(struct __pyx_obj_5_cdec_Latt } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_9__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_9__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_8__str__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_7Lattice_10__str__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46 +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49 * return self.lattice.size() * * def __str__(self): # <<<<<<<<<<<<<< @@ -11861,7 +12718,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_9__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11870,7 +12727,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50 * * def __str__(self): * return hypergraph.AsPLF(self.lattice[0], True).c_str() # <<<<<<<<<<<<<< @@ -11878,7 +12735,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti * def __iter__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -11895,20 +12752,20 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_12generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_5_cdec_7Lattice_14generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_10__iter__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_5_cdec_7Lattice_12__iter__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49 +/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52 * return hypergraph.AsPLF(self.lattice[0], True).c_str() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -11916,7 +12773,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self) { * for i in range(len(self)): */ -static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -11934,7 +12791,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lat __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_12generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_14generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -11952,7 +12809,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lat return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_12generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_5_cdec_7Lattice_14generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -11969,27 +12826,27 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_12generator13(__pyx_GeneratorObject *_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< * yield self[i] * */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< * - * def __dealloc__(self): + * def todot(self): */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -12003,7 +12860,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_12generator13(__pyx_GeneratorObject *_ __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -12013,44 +12870,12 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_12generator13(__pyx_GeneratorObject *_ __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* Python wrapper */ -static void __pyx_pw_5_cdec_7Lattice_14__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_7Lattice_14__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5_cdec_7Lattice_13__dealloc__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54 - * yield self[i] - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self.lattice - * - */ - -static void __pyx_pf_5_cdec_7Lattice_13__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55 - * - * def __dealloc__(self): - * del self.lattice # <<<<<<<<<<<<<< - * - * def todot(self): - */ - delete __pyx_v_self->lattice; - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ static PyObject *__pyx_pw_5_cdec_7Lattice_16todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5_cdec_7Lattice_16todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; @@ -12069,7 +12894,6 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lines (wrapper)", 0); - __pyx_self = __pyx_self; __pyx_r = __pyx_pf_5_cdec_7Lattice_5todot_lines(__pyx_self); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -12237,10 +13061,18 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj 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++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __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++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) { @@ -12279,10 +13111,18 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj for (;;) { if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) { @@ -12296,21 +13136,22 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj } 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 != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_8 = PyList_GET_ITEM(sequence, 0); __pyx_t_9 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); @@ -12318,8 +13159,14 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); @@ -12332,12 +13179,13 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L12_unpacking_done; __pyx_L11_unpacking_failed:; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_12 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L12_unpacking_done:; } @@ -12472,12 +13320,13 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj __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/lattice.pxi":57 - * del self.lattice + * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< * def lines(): @@ -12777,7 +13626,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel * * property fmap: * def __get__(self): # <<<<<<<<<<<<<< - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) */ @@ -12794,18 +13643,19 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22 * property fmap: * def __get__(self): - * cdef SparseVector fmap = SparseVector() # <<<<<<<<<<<<<< + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) * return fmap */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":23 * def __get__(self): - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<< * return fmap * @@ -12813,7 +13663,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde __pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap); /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24 - * cdef SparseVector fmap = SparseVector() + * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) * return fmap # <<<<<<<<<<<<<< * @@ -12850,7 +13700,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14 * cdef class Candidate: - * cdef mteval.Candidate* candidate + * cdef mteval.const_Candidate* candidate * cdef public float score # <<<<<<<<<<<<<< * * property words: @@ -13202,10 +14052,18 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator14(__pyx_GeneratorO for (;;) { if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) { @@ -13261,6 +14119,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator14(__pyx_GeneratorO __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -13536,11 +14395,11 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x 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 PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -13553,8 +14412,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -13955,6 +14813,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator15(__pyx_GeneratorObj __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -13964,11 +14823,11 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se 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; unsigned int __pyx_v_k; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_kbest (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -13982,12 +14841,10 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -14260,11 +15117,11 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ 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) { PyObject *__pyx_v_name = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; PyObject* values[1] = {0}; /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":121 @@ -14410,11 +15267,11 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_ 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) { PyObject *__pyx_v_refs = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -14427,8 +15284,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -14551,10 +15407,18 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score for (;;) { if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_7 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_7)) { @@ -14954,9 +15818,10 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: * out.fields[i] = ss[i] */ if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); + __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_out->fields.resize(__pyx_t_7); /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":170 @@ -14967,9 +15832,10 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: * */ if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); + __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; @@ -14980,6 +15846,10 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: * * cdef class Metric: */ + if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ss), __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -15087,11 +15957,11 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p 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) { PyObject *__pyx_v_refs = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -15104,8 +15974,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -15230,11 +16099,11 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj static PyObject *__pyx_pw_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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("evaluate (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -15248,12 +16117,10 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -15334,7 +16201,6 @@ static PyObject *__pyx_pw_5_cdec_3_make_config(PyObject *__pyx_self, PyObject *_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_make_config (wrapper)", 0); - __pyx_self = __pyx_self; __pyx_r = __pyx_pf_5_cdec_2_make_config(__pyx_self, ((PyObject *)__pyx_v_config)); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -15438,10 +16304,18 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener 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++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_2 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_2)) { @@ -15455,27 +16329,33 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; + #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[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); @@ -15486,12 +16366,13 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; __pyx_L6_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L7_unpacking_done:; } @@ -15543,10 +16424,18 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener 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_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_6 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_6)) { @@ -15560,27 +16449,33 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener } 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 != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); @@ -15591,12 +16486,13 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L12_unpacking_done; __pyx_L11_unpacking_failed:; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L12_unpacking_done:; } @@ -15700,10 +16596,18 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener 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_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_6 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_6)) { @@ -15827,6 +16731,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -15836,13 +16741,13 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_config_str = 0; PyObject *__pyx_v_config = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0}; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); __pyx_v_config = PyDict_New(); if (unlikely(!__pyx_v_config)) return -1; __Pyx_GOTREF(__pyx_v_config); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0}; PyObject* values[1] = {0}; /* "_cdec.pyx":43 @@ -15985,10 +16890,18 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { @@ -16037,6 +16950,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } @@ -16221,7 +17135,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_ * cdef istringstream* config_stream = new istringstream(config_str) * self.dec = new decoder.Decoder(config_stream) # <<<<<<<<<<<<<< * del config_stream - * self.weights = DenseVector() + * self.weights = DenseVector.__new__(DenseVector) */ __pyx_v_self->dec = new Decoder(__pyx_v_config_stream); @@ -16229,7 +17143,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_ * cdef istringstream* config_stream = new istringstream(config_str) * self.dec = new decoder.Decoder(config_stream) * del config_stream # <<<<<<<<<<<<<< - * self.weights = DenseVector() + * self.weights = DenseVector.__new__(DenseVector) * self.weights.vector = &self.dec.CurrentWeightVector() */ delete __pyx_v_config_stream; @@ -16237,12 +17151,13 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_ /* "_cdec.pyx":58 * self.dec = new decoder.Decoder(config_stream) * del config_stream - * self.weights = DenseVector() # <<<<<<<<<<<<<< + * self.weights = DenseVector.__new__(DenseVector) # <<<<<<<<<<<<<< * self.weights.vector = &self.dec.CurrentWeightVector() - * + * self.weights.owned = True */ - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_DenseVector)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->weights); __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); @@ -16251,13 +17166,22 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_ /* "_cdec.pyx":59 * del config_stream - * self.weights = DenseVector() + * self.weights = DenseVector.__new__(DenseVector) * self.weights.vector = &self.dec.CurrentWeightVector() # <<<<<<<<<<<<<< + * self.weights.owned = True * - * def __dealloc__(self): */ __pyx_v_self->weights->vector = (&__pyx_v_self->dec->CurrentWeightVector()); + /* "_cdec.pyx":60 + * self.weights = DenseVector.__new__(DenseVector) + * self.weights.vector = &self.dec.CurrentWeightVector() + * self.weights.owned = True # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->weights->owned = 1; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -16283,8 +17207,8 @@ static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "_cdec.pyx":61 - * self.weights.vector = &self.dec.CurrentWeightVector() +/* "_cdec.pyx":62 + * self.weights.owned = True * * def __dealloc__(self): # <<<<<<<<<<<<<< * del self.dec @@ -16295,7 +17219,7 @@ static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "_cdec.pyx":62 + /* "_cdec.pyx":63 * * def __dealloc__(self): * del self.dec # <<<<<<<<<<<<<< @@ -16318,7 +17242,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_se return __pyx_r; } -/* "_cdec.pyx":65 +/* "_cdec.pyx":66 * * property weights: * def __get__(self): # <<<<<<<<<<<<<< @@ -16331,7 +17255,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "_cdec.pyx":66 + /* "_cdec.pyx":67 * property weights: * def __get__(self): * return self.weights # <<<<<<<<<<<<<< @@ -16361,7 +17285,7 @@ static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "_cdec.pyx":68 +/* "_cdec.pyx":69 * return self.weights * * def __set__(self, weights): # <<<<<<<<<<<<<< @@ -16388,7 +17312,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "_cdec.pyx":69 + /* "_cdec.pyx":70 * * def __set__(self, weights): * if isinstance(weights, DenseVector): # <<<<<<<<<<<<<< @@ -16401,7 +17325,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_cdec.pyx":70 + /* "_cdec.pyx":71 * def __set__(self, weights): * if isinstance(weights, DenseVector): * self.weights.vector[0] = (<DenseVector> weights).vector[0] # <<<<<<<<<<<<<< @@ -16412,7 +17336,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De goto __pyx_L3; } - /* "_cdec.pyx":71 + /* "_cdec.pyx":72 * if isinstance(weights, DenseVector): * self.weights.vector[0] = (<DenseVector> weights).vector[0] * elif isinstance(weights, SparseVector): # <<<<<<<<<<<<<< @@ -16425,7 +17349,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_cdec.pyx":72 + /* "_cdec.pyx":73 * self.weights.vector[0] = (<DenseVector> weights).vector[0] * elif isinstance(weights, SparseVector): * self.weights.vector.clear() # <<<<<<<<<<<<<< @@ -16434,23 +17358,23 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De */ __pyx_v_self->weights->vector->clear(); - /* "_cdec.pyx":73 + /* "_cdec.pyx":74 * elif isinstance(weights, SparseVector): * self.weights.vector.clear() * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) # <<<<<<<<<<<<<< * elif isinstance(weights, dict): - * for fname, fval in weights.items(): + * self.weights.vector.clear() */ (((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_weights)->vector[0]).init_vector(__pyx_v_self->weights->vector); goto __pyx_L3; } - /* "_cdec.pyx":74 + /* "_cdec.pyx":75 * self.weights.vector.clear() * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) * elif isinstance(weights, dict): # <<<<<<<<<<<<<< + * self.weights.vector.clear() * for fname, fval in weights.items(): - * self.weights[fname] = fval */ __pyx_t_1 = ((PyObject *)((PyObject*)(&PyDict_Type))); __Pyx_INCREF(__pyx_t_1); @@ -16458,23 +17382,32 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_cdec.pyx":75 + /* "_cdec.pyx":76 * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) * elif isinstance(weights, dict): + * self.weights.vector.clear() # <<<<<<<<<<<<<< + * for fname, fval in weights.items(): + * self.weights[fname] = fval + */ + __pyx_v_self->weights->vector->clear(); + + /* "_cdec.pyx":77 + * elif isinstance(weights, dict): + * self.weights.vector.clear() * for fname, fval in weights.items(): # <<<<<<<<<<<<<< * self.weights[fname] = fval * else: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -16482,16 +17415,24 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -16499,29 +17440,35 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De } 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[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; @@ -16529,14 +17476,15 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_GOTREF(__pyx_t_6); index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L7_unpacking_done:; } __Pyx_XDECREF(__pyx_v_fname); @@ -16546,40 +17494,40 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __pyx_v_fval = __pyx_t_7; __pyx_t_7 = 0; - /* "_cdec.pyx":76 - * elif isinstance(weights, dict): + /* "_cdec.pyx":78 + * self.weights.vector.clear() * for fname, fval in weights.items(): * self.weights[fname] = fval # <<<<<<<<<<<<<< * else: * raise TypeError('cannot initialize weights with %s' % type(weights)) */ - if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } /*else*/ { - /* "_cdec.pyx":78 + /* "_cdec.pyx":80 * self.weights[fname] = fval * else: * raise TypeError('cannot initialize weights with %s' % type(weights)) # <<<<<<<<<<<<<< * * property formalism: */ - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -16611,12 +17559,12 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_ return __pyx_r; } -/* "_cdec.pyx":81 +/* "_cdec.pyx":83 * * property formalism: * def __get__(self): # <<<<<<<<<<<<<< * cdef variables_map* conf = &self.dec.GetConf() - * return conf[0]['formalism'].as_str().c_str() + * return conf[0]['formalism'].as_str() */ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self) { @@ -16629,24 +17577,24 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "_cdec.pyx":82 + /* "_cdec.pyx":84 * property formalism: * def __get__(self): * cdef variables_map* conf = &self.dec.GetConf() # <<<<<<<<<<<<<< - * return conf[0]['formalism'].as_str().c_str() + * return conf[0]['formalism'].as_str() * */ __pyx_v_conf = (&__pyx_v_self->dec->GetConf()); - /* "_cdec.pyx":83 + /* "_cdec.pyx":85 * def __get__(self): * cdef variables_map* conf = &self.dec.GetConf() - * return conf[0]['formalism'].as_str().c_str() # <<<<<<<<<<<<<< + * return conf[0]['formalism'].as_str() # <<<<<<<<<<<<<< * * def read_weights(self, weights): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_convert_string_to_py_(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -16675,8 +17623,8 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, return __pyx_r; } -/* "_cdec.pyx":85 - * return conf[0]['formalism'].as_str().c_str() +/* "_cdec.pyx":87 + * return conf[0]['formalism'].as_str() * * def read_weights(self, weights): # <<<<<<<<<<<<<< * with open(weights) as fp: @@ -16711,7 +17659,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":86 + /* "_cdec.pyx":88 * * def read_weights(self, weights): * with open(weights) as fp: # <<<<<<<<<<<<<< @@ -16719,19 +17667,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ * if line.strip().startswith('#'): continue */ /*with:*/ { - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_weights); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_weights); __Pyx_GIVEREF(__pyx_v_weights); - __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -16746,7 +17694,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":87 + /* "_cdec.pyx":89 * def read_weights(self, weights): * with open(weights) as fp: * for line in fp: # <<<<<<<<<<<<<< @@ -16757,23 +17705,31 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_2 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -16783,25 +17739,25 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_v_line = __pyx_t_2; __pyx_t_2 = 0; - /* "_cdec.pyx":88 + /* "_cdec.pyx":90 * with open(weights) as fp: * for line in fp: * if line.strip().startswith('#'): continue # <<<<<<<<<<<<<< * fname, value = line.split() * self.weights[fname.strip()] = float(value) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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 = 90; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_10) { goto __pyx_L16_continue; @@ -16809,43 +17765,49 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ } __pyx_L18:; - /* "_cdec.pyx":89 + /* "_cdec.pyx":91 * for line in fp: * if line.strip().startswith('#'): continue * fname, value = line.split() # <<<<<<<<<<<<<< * self.weights[fname.strip()] = float(value) * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; + #if 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[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_11 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_11); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext; @@ -16853,14 +17815,15 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed; __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_13 = NULL; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L20_unpacking_done; __pyx_L19_unpacking_failed:; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_L20_unpacking_done:; } __Pyx_XDECREF(__pyx_v_fname); @@ -16870,22 +17833,22 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_v_value = __pyx_t_11; __pyx_t_11 = 0; - /* "_cdec.pyx":90 + /* "_cdec.pyx":92 * if line.strip().startswith('#'): continue * fname, value = line.split() * self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<< * * def translate(self, sentence, grammar=None): */ - __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_L16_continue:; @@ -16903,7 +17866,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":86 + /* "_cdec.pyx":88 * * def read_weights(self, weights): * with open(weights) as fp: # <<<<<<<<<<<<<< @@ -16912,11 +17875,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ */ /*except:*/ { __Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); @@ -16929,11 +17892,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_16 = (!__pyx_t_10); if (__pyx_t_16) { __Pyx_GIVEREF(__pyx_t_4); @@ -16941,7 +17904,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_GIVEREF(__pyx_t_1); __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_1); __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} goto __pyx_L23; } __pyx_L23:; @@ -16969,11 +17932,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ if (__pyx_t_3) { __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_52, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L24; @@ -17008,14 +17971,14 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_sentence = 0; PyObject *__pyx_v_grammar = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("translate (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0}; PyObject* values[2] = {0,0}; - /* "_cdec.pyx":92 + /* "_cdec.pyx":94 * self.weights[fname.strip()] = float(value) * * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<< @@ -17035,8 +17998,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -17045,7 +18007,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -17060,7 +18022,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -17088,7 +18050,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":94 + /* "_cdec.pyx":96 * def translate(self, sentence, grammar=None): * cdef bytes input_str * if isinstance(sentence, unicode) or isinstance(sentence, str): # <<<<<<<<<<<<<< @@ -17110,19 +18072,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } if (__pyx_t_4) { - /* "_cdec.pyx":95 + /* "_cdec.pyx":97 * cdef bytes input_str * if isinstance(sentence, unicode) or isinstance(sentence, str): * input_str = as_str(sentence.strip()) # <<<<<<<<<<<<<< * elif isinstance(sentence, Lattice): * input_str = str(sentence) # PLF format */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_5, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_5, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_input_str = __pyx_t_1; @@ -17130,7 +18092,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec goto __pyx_L3; } - /* "_cdec.pyx":96 + /* "_cdec.pyx":98 * if isinstance(sentence, unicode) or isinstance(sentence, str): * input_str = as_str(sentence.strip()) * elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<< @@ -17143,62 +18105,62 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "_cdec.pyx":97 + /* "_cdec.pyx":99 * input_str = as_str(sentence.strip()) * elif isinstance(sentence, Lattice): * input_str = str(sentence) # PLF format # <<<<<<<<<<<<<< * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_sentence); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sentence); __Pyx_GIVEREF(__pyx_v_sentence); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_input_str = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L3; } /*else*/ { - /* "_cdec.pyx":99 + /* "_cdec.pyx":101 * input_str = str(sentence) # PLF format * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<< * if grammar: * if isinstance(grammar, str) or isinstance(grammar, unicode): */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "_cdec.pyx":100 + /* "_cdec.pyx":102 * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) * if grammar: # <<<<<<<<<<<<<< * if isinstance(grammar, str) or isinstance(grammar, unicode): * self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { - /* "_cdec.pyx":101 + /* "_cdec.pyx":103 * raise TypeError('Cannot translate input type %s' % type(sentence)) * if grammar: * if isinstance(grammar, str) or isinstance(grammar, unicode): # <<<<<<<<<<<<<< @@ -17220,7 +18182,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } if (__pyx_t_3) { - /* "_cdec.pyx":102 + /* "_cdec.pyx":104 * if grammar: * if isinstance(grammar, str) or isinstance(grammar, unicode): * self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) # <<<<<<<<<<<<<< @@ -17232,19 +18194,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } /*else*/ { - /* "_cdec.pyx":104 + /* "_cdec.pyx":106 * self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) * else: * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) # <<<<<<<<<<<<<< * cdef decoder.BasicObserver observer = decoder.BasicObserver() * self.dec.Decode(string(input_str), &observer) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_grammar); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_grammar); __Pyx_GIVEREF(__pyx_v_grammar); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_1)->__pyx_base.grammar[0])); @@ -17255,7 +18217,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } __pyx_L4:; - /* "_cdec.pyx":105 + /* "_cdec.pyx":107 * else: * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) * cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<< @@ -17264,17 +18226,17 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec */ __pyx_v_observer = BasicObserver(); - /* "_cdec.pyx":106 + /* "_cdec.pyx":108 * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) * cdef decoder.BasicObserver observer = decoder.BasicObserver() * self.dec.Decode(string(input_str), &observer) # <<<<<<<<<<<<<< * if observer.hypergraph == NULL: * raise ParseFailed() */ - __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->dec->Decode(std::string(__pyx_t_6), (&__pyx_v_observer)); - /* "_cdec.pyx":107 + /* "_cdec.pyx":109 * cdef decoder.BasicObserver observer = decoder.BasicObserver() * self.dec.Decode(string(input_str), &observer) * if observer.hypergraph == NULL: # <<<<<<<<<<<<<< @@ -17284,38 +18246,38 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_t_3 = (__pyx_v_observer.hypergraph == NULL); if (__pyx_t_3) { - /* "_cdec.pyx":108 + /* "_cdec.pyx":110 * self.dec.Decode(string(input_str), &observer) * if observer.hypergraph == NULL: * raise ParseFailed() # <<<<<<<<<<<<<< * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "_cdec.pyx":109 + /* "_cdec.pyx":111 * if observer.hypergraph == NULL: * raise ParseFailed() * cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<< * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) * return hg */ - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_5); __pyx_t_5 = 0; - /* "_cdec.pyx":110 + /* "_cdec.pyx":112 * raise ParseFailed() * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<< @@ -17323,7 +18285,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":111 + /* "_cdec.pyx":113 * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) * return hg # <<<<<<<<<<<<<< @@ -17348,13 +18310,65 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec return __pyx_r; } -static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k) { +/* "string.to_py":25 + * + * @cname("__pyx_convert_string_to_py_") + * cdef object __pyx_convert_string_to_py_(string& s): # <<<<<<<<<<<<<< + * return s.data()[:s.size()] + * + */ + +static PyObject *__pyx_convert_string_to_py_(const std::string &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_string_to_py_", 0); + + /* "string.to_py":26 + * @cname("__pyx_convert_string_to_py_") + * cdef object __pyx_convert_string_to_py_(string& s): + * return s.data()[:s.size()] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_s.data() + 0, __pyx_v_s.size() - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_string_to_py_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; 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); + } (*Py_TYPE(o)->tp_free)(o); } static PyObject *__pyx_sq_item_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) { @@ -17367,7 +18381,7 @@ static PyObject *__pyx_sq_item_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) { static int __pyx_mp_ass_subscript_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_5_cdec_11DenseVector_5__setitem__(o, i, v); + return __pyx_pw_5_cdec_11DenseVector_9__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -17377,8 +18391,8 @@ static int __pyx_mp_ass_subscript_5_cdec_DenseVector(PyObject *o, PyObject *i, P } static PyMethodDef __pyx_methods_5_cdec_DenseVector[] = { - {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_10dot, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_12tosparse, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -17441,7 +18455,7 @@ static PyNumberMethods __pyx_tp_as_number_DenseVector = { }; static PySequenceMethods __pyx_tp_as_sequence_DenseVector = { - __pyx_pw_5_cdec_11DenseVector_1__len__, /*sq_length*/ + __pyx_pw_5_cdec_11DenseVector_5__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_5_cdec_DenseVector, /*sq_item*/ @@ -17454,8 +18468,8 @@ static PySequenceMethods __pyx_tp_as_sequence_DenseVector = { }; static PyMappingMethods __pyx_tp_as_mapping_DenseVector = { - __pyx_pw_5_cdec_11DenseVector_1__len__, /*mp_length*/ - __pyx_pw_5_cdec_11DenseVector_3__getitem__, /*mp_subscript*/ + __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*/ }; @@ -17510,7 +18524,7 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_11DenseVector_7__iter__, /*tp_iter*/ + __pyx_pw_5_cdec_11DenseVector_11__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5_cdec_DenseVector, /*tp_methods*/ 0, /*tp_members*/ @@ -17520,7 +18534,7 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_5_cdec_11DenseVector_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5_cdec_DenseVector, /*tp_new*/ 0, /*tp_free*/ @@ -17536,7 +18550,7 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -17547,7 +18561,7 @@ 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_1__dealloc__(o); + __pyx_pw_5_cdec_12SparseVector_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -17564,7 +18578,7 @@ static PyObject *__pyx_sq_item_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) { static int __pyx_mp_ass_subscript_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_5_cdec_12SparseVector_7__setitem__(o, i, v); + return __pyx_pw_5_cdec_12SparseVector_9__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -17574,22 +18588,22 @@ static int __pyx_mp_ass_subscript_5_cdec_SparseVector(PyObject *o, PyObject *i, } static PyMethodDef __pyx_methods_5_cdec_SparseVector[] = { - {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_3copy, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_12dot, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_30__add__, /*nb_add*/ - __pyx_pw_5_cdec_12SparseVector_32__sub__, /*nb_subtract*/ - __pyx_pw_5_cdec_12SparseVector_34__mul__, /*nb_multiply*/ + __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_36__div__, /*nb_divide*/ + __pyx_pw_5_cdec_12SparseVector_38__div__, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ - __pyx_pw_5_cdec_12SparseVector_20__neg__, /*nb_negative*/ + __pyx_pw_5_cdec_12SparseVector_22__neg__, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ @@ -17615,11 +18629,11 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = { #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif - __pyx_pw_5_cdec_12SparseVector_22__iadd__, /*nb_inplace_add*/ - __pyx_pw_5_cdec_12SparseVector_24__isub__, /*nb_inplace_subtract*/ - __pyx_pw_5_cdec_12SparseVector_26__imul__, /*nb_inplace_multiply*/ + __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_28__idiv__, /*nb_inplace_divide*/ + __pyx_pw_5_cdec_12SparseVector_30__idiv__, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ @@ -17638,21 +18652,21 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = { }; static PySequenceMethods __pyx_tp_as_sequence_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_16__len__, /*sq_length*/ + __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_18__contains__, /*sq_contains*/ + __pyx_pw_5_cdec_12SparseVector_20__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_16__len__, /*mp_length*/ - __pyx_pw_5_cdec_12SparseVector_5__getitem__, /*mp_subscript*/ + __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*/ }; @@ -17705,9 +18719,9 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = { 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ - __pyx_pw_5_cdec_12SparseVector_14__richcmp__, /*tp_richcompare*/ + __pyx_pw_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_12SparseVector_9__iter__, /*tp_iter*/ + __pyx_pw_5_cdec_12SparseVector_11__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5_cdec_SparseVector, /*tp_methods*/ 0, /*tp_members*/ @@ -17717,7 +18731,7 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_5_cdec_12SparseVector_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5_cdec_SparseVector, /*tp_new*/ 0, /*tp_free*/ @@ -17733,7 +18747,7 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -17743,11 +18757,11 @@ static void __pyx_tp_dealloc_5_cdec_NT(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_2NT_cat(PyObject *o, void *x) { +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, void *x) { +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); } @@ -17757,11 +18771,11 @@ static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, void *x) { } } -static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, void *x) { +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, void *x) { +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); } @@ -17935,7 +18949,7 @@ static PyTypeObject __pyx_type_5_cdec_NT = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -17945,11 +18959,11 @@ static void __pyx_tp_dealloc_5_cdec_NTRef(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, void *x) { +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 int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_5_cdec_5NTRef_3ref_3__set__(o, v); } @@ -18122,18 +19136,18 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_BaseTRule(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; } -static void __pyx_tp_dealloc_5_cdec_BaseTRule(PyObject *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_9BaseTRule_1__dealloc__(o); + __pyx_pw_5_cdec_5TRule_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -18141,17 +19155,17 @@ static void __pyx_tp_dealloc_5_cdec_BaseTRule(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_9BaseTRule_arity(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_5arity_1__get__(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_9BaseTRule_f(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_1f_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_9BaseTRule_f(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_9BaseTRule_1f_3__set__(o, v); + return __pyx_pw_5_cdec_5TRule_1f_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -18159,13 +19173,13 @@ static int __pyx_setprop_5_cdec_9BaseTRule_f(PyObject *o, PyObject *v, void *x) } } -static PyObject *__pyx_getprop_5_cdec_9BaseTRule_e(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_1e_1__get__(o); +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_9BaseTRule_e(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_9BaseTRule_1e_3__set__(o, v); + return __pyx_pw_5_cdec_5TRule_1e_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -18173,13 +19187,13 @@ static int __pyx_setprop_5_cdec_9BaseTRule_e(PyObject *o, PyObject *v, void *x) } } -static PyObject *__pyx_getprop_5_cdec_9BaseTRule_a(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_1a_1__get__(o); +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_9BaseTRule_a(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_9BaseTRule_1a_4__set__(o, v); + return __pyx_pw_5_cdec_5TRule_1a_4__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -18187,13 +19201,13 @@ static int __pyx_setprop_5_cdec_9BaseTRule_a(PyObject *o, PyObject *v, void *x) } } -static PyObject *__pyx_getprop_5_cdec_9BaseTRule_scores(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_6scores_1__get__(o); +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 int __pyx_setprop_5_cdec_9BaseTRule_scores(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_9BaseTRule_6scores_3__set__(o, v); + return __pyx_pw_5_cdec_5TRule_6scores_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -18201,13 +19215,13 @@ static int __pyx_setprop_5_cdec_9BaseTRule_scores(PyObject *o, PyObject *v, void } } -static PyObject *__pyx_getprop_5_cdec_9BaseTRule_lhs(PyObject *o, void *x) { - return __pyx_pw_5_cdec_9BaseTRule_3lhs_1__get__(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 int __pyx_setprop_5_cdec_9BaseTRule_lhs(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_9BaseTRule_3lhs_3__set__(o, v); + return __pyx_pw_5_cdec_5TRule_3lhs_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -18215,187 +19229,20 @@ static int __pyx_setprop_5_cdec_9BaseTRule_lhs(PyObject *o, PyObject *v, void *x } } -static PyMethodDef __pyx_methods_5_cdec_BaseTRule[] = { +static PyMethodDef __pyx_methods_5_cdec_TRule[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_BaseTRule[] = { - {(char *)"arity", __pyx_getprop_5_cdec_9BaseTRule_arity, 0, 0, 0}, - {(char *)"f", __pyx_getprop_5_cdec_9BaseTRule_f, __pyx_setprop_5_cdec_9BaseTRule_f, 0, 0}, - {(char *)"e", __pyx_getprop_5_cdec_9BaseTRule_e, __pyx_setprop_5_cdec_9BaseTRule_e, 0, 0}, - {(char *)"a", __pyx_getprop_5_cdec_9BaseTRule_a, __pyx_setprop_5_cdec_9BaseTRule_a, 0, 0}, - {(char *)"scores", __pyx_getprop_5_cdec_9BaseTRule_scores, __pyx_setprop_5_cdec_9BaseTRule_scores, 0, 0}, - {(char *)"lhs", __pyx_getprop_5_cdec_9BaseTRule_lhs, __pyx_setprop_5_cdec_9BaseTRule_lhs, 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}, {0, 0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_BaseTRule = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BaseTRule = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BaseTRule = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_BaseTRule = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_5_cdec_BaseTRule = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.BaseTRule"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_BaseTRule), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_BaseTRule, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_BaseTRule, /*tp_as_number*/ - &__pyx_tp_as_sequence_BaseTRule, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BaseTRule, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_5_cdec_9BaseTRule_3__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BaseTRule, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5_cdec_BaseTRule, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5_cdec_BaseTRule, /*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_BaseTRule, /*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_TRule(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5_cdec_BaseTRule(t, a, k); - if (!o) return 0; - if (__pyx_pw_5_cdec_5TRule_1__cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static PyMethodDef __pyx_methods_5_cdec_TRule[] = { - {0, 0, 0, 0} -}; - static PyNumberMethods __pyx_tp_as_number_TRule = { 0, /*nb_add*/ 0, /*nb_subtract*/ @@ -18499,7 +19346,7 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { __Pyx_NAMESTR("_cdec.TRule"), /*tp_name*/ sizeof(struct __pyx_obj_5_cdec_TRule), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_BaseTRule, /*tp_dealloc*/ + __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -18514,7 +19361,7 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { &__pyx_tp_as_mapping_TRule, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_TRule, /*tp_as_buffer*/ @@ -18528,13 +19375,13 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { 0, /*tp_iternext*/ __pyx_methods_5_cdec_TRule, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_5_cdec_TRule, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_5_cdec_5TRule_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5_cdec_TRule, /*tp_new*/ 0, /*tp_free*/ @@ -18550,7 +19397,7 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -18569,11 +19416,11 @@ static void __pyx_tp_dealloc_5_cdec_Grammar(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_7Grammar_name(PyObject *o, void *x) { +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, void *x) { +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); } @@ -18887,7 +19734,11 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = { 0, /*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*/ 0, /*tp_members*/ @@ -18913,7 +19764,7 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -18932,19 +19783,19 @@ static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, void *x) { +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, void *x) { +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, void *x) { +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 PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, void *x) { +static PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(o); } @@ -19128,13 +19979,13 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = { }; static struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge; -static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_5_cdec_HypergraphEdge *)o); p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphEdge; - p->trule = ((struct __pyx_obj_5_cdec_BaseTRule *)Py_None); Py_INCREF(Py_None); + p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); return o; } @@ -19157,36 +20008,36 @@ 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_BaseTRule *)Py_None); Py_INCREF(Py_None); + p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, void *x) { +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_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, void *x) { +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_5_cdec_14HypergraphEdge_span(PyObject *o, void *x) { +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_5_cdec_14HypergraphEdge_feature_values(PyObject *o, void *x) { +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, void *x) { +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, void *x) { +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, void *x) { +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); } @@ -19364,7 +20215,7 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = { }; static struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode; -static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -19377,19 +20228,19 @@ static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, void *x) { +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, void *x) { +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 PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, void *x) { +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 PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, void *x) { +static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o); } @@ -19573,7 +20424,7 @@ 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_14__dealloc__(o); + __pyx_pw_5_cdec_7Lattice_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -19590,7 +20441,7 @@ static PyObject *__pyx_sq_item_5_cdec_Lattice(PyObject *o, Py_ssize_t i) { static int __pyx_mp_ass_subscript_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_5_cdec_7Lattice_5__setitem__(o, i, v); + return __pyx_pw_5_cdec_7Lattice_7__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -19663,7 +20514,7 @@ static PyNumberMethods __pyx_tp_as_number_Lattice = { }; static PySequenceMethods __pyx_tp_as_sequence_Lattice = { - __pyx_pw_5_cdec_7Lattice_7__len__, /*sq_length*/ + __pyx_pw_5_cdec_7Lattice_9__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_5_cdec_Lattice, /*sq_item*/ @@ -19676,8 +20527,8 @@ static PySequenceMethods __pyx_tp_as_sequence_Lattice = { }; static PyMappingMethods __pyx_tp_as_mapping_Lattice = { - __pyx_pw_5_cdec_7Lattice_7__len__, /*mp_length*/ - __pyx_pw_5_cdec_7Lattice_3__getitem__, /*mp_subscript*/ + __pyx_pw_5_cdec_7Lattice_9__len__, /*mp_length*/ + __pyx_pw_5_cdec_7Lattice_5__getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_5_cdec_Lattice, /*mp_ass_subscript*/ }; @@ -19722,7 +20573,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = { &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_5_cdec_7Lattice_9__str__, /*tp_str*/ + __pyx_pw_5_cdec_7Lattice_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Lattice, /*tp_as_buffer*/ @@ -19732,7 +20583,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_7Lattice_11__iter__, /*tp_iter*/ + __pyx_pw_5_cdec_7Lattice_13__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5_cdec_Lattice, /*tp_methods*/ 0, /*tp_members*/ @@ -19758,7 +20609,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -19768,19 +20619,19 @@ 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, void *x) { +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, void *x) { +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, void *x) { +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, void *x) { +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); } @@ -19955,7 +20806,7 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -19981,11 +20832,11 @@ static PyObject *__pyx_sq_item_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i) return r; } -static PyObject *__pyx_getprop_5_cdec_15SufficientStats_score(PyObject *o, void *x) { +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 PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, void *x) { +static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(o); } @@ -20341,7 +21192,7 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -20700,7 +21551,7 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -20941,11 +21792,11 @@ static int __pyx_tp_clear_5_cdec_Decoder(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, void *x) { +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, void *x) { +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); } @@ -20955,7 +21806,7 @@ static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, void } } -static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, void *x) { +static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(o); } @@ -21125,7 +21976,7 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -21316,7 +22167,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -21507,7 +22358,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k) { +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 = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -21698,7 +22549,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -21905,7 +22756,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -21933,7 +22784,7 @@ 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_BaseTRule *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } @@ -22096,7 +22947,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -22124,7 +22975,7 @@ 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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_BaseTRule *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } @@ -22287,7 +23138,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -22494,7 +23345,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -22693,7 +23544,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -22892,7 +23743,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -23107,7 +23958,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k) { +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 = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -23314,7 +24165,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -23505,7 +24356,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -23696,7 +24547,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -23887,7 +24738,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -24078,7 +24929,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -24269,7 +25120,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k) { +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -24460,7 +25311,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -24651,7 +25502,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18_todot(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -24842,7 +25693,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18_todot = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_lines(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -25081,7 +25932,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_lines = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -25288,7 +26139,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -25479,7 +26330,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22__make_config(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -25718,7 +26569,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22__make_config = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23___cinit__(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23___cinit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -25909,7 +26760,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23___cinit__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -26135,7 +26986,6 @@ static struct PyModuleDef __pyx_moduledef = { #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_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, @@ -26166,8 +27016,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0}, {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0}, - {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0}, - {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, + {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1}, + {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1}, + {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, + {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 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}, @@ -26180,6 +27032,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1}, {&__pyx_n_s__ParseFailed, __pyx_k__ParseFailed, sizeof(__pyx_k__ParseFailed), 0, 0, 1, 1}, + {&__pyx_n_s__PhraseModel_, __pyx_k__PhraseModel_, sizeof(__pyx_k__PhraseModel_), 0, 0, 1, 1}, {&__pyx_n_s__TER, __pyx_k__TER, sizeof(__pyx_k__TER), 0, 0, 1, 1}, {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, @@ -26192,6 +27045,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, {&__pyx_n_s__beam_alpha, __pyx_k__beam_alpha, sizeof(__pyx_k__beam_alpha), 0, 0, 1, 1}, {&__pyx_n_s__cat, __pyx_k__cat, sizeof(__pyx_k__cat), 0, 0, 1, 1}, @@ -26210,6 +27064,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__evaluator, __pyx_k__evaluator, sizeof(__pyx_k__evaluator), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__formalism, __pyx_k__formalism, sizeof(__pyx_k__formalism), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__fst, __pyx_k__fst, sizeof(__pyx_k__fst), 0, 0, 1, 1}, {&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1}, {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, @@ -26257,14 +27112,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -26288,41 +27143,41 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":89 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< * * def __len__(self): */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":4 + /* "/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) # <<<<<<<<<<<<<< * * cdef class NT: */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175 - * for trule in rules: - * if not isinstance(trule, BaseTRule): + /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":200 + * trule = convert_rule(trule) + * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< - * _g.AddRule((<BaseTRule> trule).rule[0]) + * _g.AddRule((<TRule> trule).rule[0]) */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); @@ -26369,42 +27224,42 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] */ - __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: */ - __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_23)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41 * for (label, cost, dist2next) in arcs: * if isinstance(label, unicode): * label = label.encode('utf8') # <<<<<<<<<<<<<< * arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) */ - __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__utf8)); @@ -26509,28 +27364,28 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); - /* "_cdec.pyx":88 + /* "_cdec.pyx":90 * with open(weights) as fp: * for line in fp: * if line.strip().startswith('#'): continue # <<<<<<<<<<<<<< * fname, value = line.split() * self.weights[fname.strip()] = float(value) */ - __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "_cdec.pyx":86 + /* "_cdec.pyx":88 * * def read_weights(self, weights): * with open(weights) as fp: # <<<<<<<<<<<<<< * for line in fp: * if line.strip().startswith('#'): continue */ - __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_52); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, Py_None); @@ -26543,26 +27398,26 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3 - * cimport grammar + /* "/Users/vchahun/Sandbox/cdec/python/src/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_54 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_54); + __pyx_k_tuple_56 = PyTuple_New(3); 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_INCREF(((PyObject *)__pyx_n_s__phrase)); - PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_n_s__phrase)); + PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_n_s__phrase)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phrase)); __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); - PyTuple_SET_ITEM(__pyx_k_tuple_54, 1, ((PyObject *)__pyx_n_s__genexpr)); + PyTuple_SET_ITEM(__pyx_k_tuple_56, 1, ((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); - PyTuple_SET_ITEM(__pyx_k_tuple_54, 2, ((PyObject *)__pyx_n_s__genexpr)); + PyTuple_SET_ITEM(__pyx_k_tuple_56, 2, ((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); - __pyx_k_codeobj_55 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s___phrase, 3, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":190 * return [] @@ -26571,12 +27426,12 @@ static int __Pyx_InitCachedConstants(void) { * TER = Scorer('TER') * CER = Scorer('CER') */ - __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_57); + __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_59); __Pyx_INCREF(((PyObject *)__pyx_n_s__IBM_BLEU)); - PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_n_s__IBM_BLEU)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__IBM_BLEU)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IBM_BLEU)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191 * @@ -26584,24 +27439,24 @@ static int __Pyx_InitCachedConstants(void) { * TER = Scorer('TER') # <<<<<<<<<<<<<< * CER = Scorer('CER') */ - __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_58); + __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_60); __Pyx_INCREF(((PyObject *)__pyx_n_s__TER)); - PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_n_s__TER)); + PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__TER)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192 * BLEU = Scorer('IBM_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< */ - __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_59); + __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_61); __Pyx_INCREF(((PyObject *)__pyx_n_s__CER)); - PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__CER)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__CER)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CER)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); /* "_cdec.pyx":28 * class ParseFailed(Exception): pass @@ -26610,25 +27465,25 @@ static int __Pyx_InitCachedConstants(void) { * for key, value in config.items(): * if isinstance(value, dict): */ - __pyx_k_tuple_60 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_60); + __pyx_k_tuple_62 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_62); __Pyx_INCREF(((PyObject *)__pyx_n_s__config)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__config)); + PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__config)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__config)); __Pyx_INCREF(((PyObject *)__pyx_n_s__key)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 1, ((PyObject *)__pyx_n_s__key)); + PyTuple_SET_ITEM(__pyx_k_tuple_62, 1, ((PyObject *)__pyx_n_s__key)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key)); __Pyx_INCREF(((PyObject *)__pyx_n_s__value)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 2, ((PyObject *)__pyx_n_s__value)); + PyTuple_SET_ITEM(__pyx_k_tuple_62, 2, ((PyObject *)__pyx_n_s__value)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value)); __Pyx_INCREF(((PyObject *)__pyx_n_s__name)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 3, ((PyObject *)__pyx_n_s__name)); + PyTuple_SET_ITEM(__pyx_k_tuple_62, 3, ((PyObject *)__pyx_n_s__name)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__name)); __Pyx_INCREF(((PyObject *)__pyx_n_s__info)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 4, ((PyObject *)__pyx_n_s__info)); + PyTuple_SET_ITEM(__pyx_k_tuple_62, 4, ((PyObject *)__pyx_n_s__info)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); - __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_62, __pyx_n_s___make_config, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s___make_config, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -26640,6 +27495,7 @@ 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_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -26656,6 +27512,7 @@ PyMODINIT_FUNC PyInit__cdec(void) PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); @@ -26698,6 +27555,9 @@ PyMODINIT_FUNC PyInit__cdec(void) #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__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;} @@ -26715,28 +27575,24 @@ PyMODINIT_FUNC PyInit__cdec(void) 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, "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_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_SparseVector = &__pyx_type_5_cdec_SparseVector; - if (PyType_Ready(&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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, "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; - if (PyType_Ready(&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_NTRef = &__pyx_type_5_cdec_NTRef; - if (PyType_Ready(&__pyx_type_5_cdec_BaseTRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BaseTRule", (PyObject *)&__pyx_type_5_cdec_BaseTRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_BaseTRule = &__pyx_type_5_cdec_BaseTRule; - __pyx_type_5_cdec_TRule.tp_base = __pyx_ptype_5_cdec_BaseTRule; - if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_TRule = &__pyx_type_5_cdec_TRule; - if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __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 = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_Grammar = &__pyx_type_5_cdec_Grammar; __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 = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar; 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_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;} @@ -26777,21 +27633,21 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec_Decoder = &__pyx_type_5_cdec_Decoder; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_1___iter__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __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_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __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_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __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___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_7___iter__; if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_5_cdec___pyx_scope_struct_8_kbest; @@ -26811,7 +27667,7 @@ PyMODINIT_FUNC PyInit__cdec(void) __pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_5_cdec___pyx_scope_struct_15___get__; if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_17___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_17___iter__; if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_18_todot = &__pyx_type_5_cdec___pyx_scope_struct_18_todot; @@ -26828,21 +27684,48 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_24_genexpr; /*--- Type import code ---*/ + __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ + __pyx_t_1 = __Pyx_ImportModule("cdec.sa._sa"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "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_ImportFunction(__pyx_t_1, "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_ImportFunction(__pyx_t_1, "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_ImportFunction(__pyx_t_1, "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;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3 * cimport grammar + * cimport cdec.sa._sa as _sa + * import cdec.sa._sa as _sa # <<<<<<<<<<<<<< + * + * def _phrase(phrase): + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s_55)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_55)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_55)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_54), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __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 + * 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_1 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_1_phrase, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___phrase, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __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":190 * return [] @@ -26851,10 +27734,10 @@ PyMODINIT_FUNC PyInit__cdec(void) * TER = Scorer('TER') * CER = Scorer('CER') */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191 * @@ -26862,20 +27745,20 @@ PyMODINIT_FUNC PyInit__cdec(void) * TER = Scorer('TER') # <<<<<<<<<<<<<< * CER = Scorer('CER') */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192 * BLEU = Scorer('IBM_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "_cdec.pyx":22 * include "mteval.pxi" @@ -26902,19 +27785,19 @@ PyMODINIT_FUNC PyInit__cdec(void) * class ParseFailed(Exception): pass * */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__InvalidConfig, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __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_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__InvalidConfig, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __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 * @@ -26923,19 +27806,19 @@ PyMODINIT_FUNC PyInit__cdec(void) * * def _make_config(config): */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_builtin_Exception); - PyTuple_SET_ITEM(__pyx_t_3, 0, __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_3), ((PyObject *)__pyx_t_1), __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 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___cdec); 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_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_m, __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_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; /* "_cdec.pyx":28 * class ParseFailed(Exception): pass @@ -26944,25 +27827,34 @@ PyMODINIT_FUNC PyInit__cdec(void) * for key, value in config.items(): * if isinstance(value, dict): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "_cdec.pyx":1 * from libcpp.string cimport string # <<<<<<<<<<<<<< * from libcpp.vector cimport vector * from utils cimport * */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "string.to_py":25 + * + * @cname("__pyx_convert_string_to_py_") + * cdef object __pyx_convert_string_to_py_(string& s): # <<<<<<<<<<<<<< + * return s.data()[:s.size()] + * + */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { __Pyx_AddTraceback("init _cdec", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -27163,6 +28055,71 @@ bad: } #endif +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 %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +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))) + #else + if (unlikely(!PyUnicode_Check(key))) + #endif + 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 int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { @@ -27289,42 +28246,49 @@ 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 %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected); } - - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + "need more than %" PY_FORMAT_SIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +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) { @@ -27332,79 +28296,54 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; - } else if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } + } else { + return __Pyx_IterFinish(); } return 0; } static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { PyObject* next; - if (unlikely(!PyIter_Check(iterator))) { + iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(!iternext)) { +#else + if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) { +#endif PyErr_Format(PyExc_TypeError, - "%.200s object is not an iterator", iterator->ob_type->tp_name); + "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); return NULL; } - next = (*(Py_TYPE(iterator)->tp_iternext))(iterator); - if (likely(next)) { + next = iternext(iterator); + if (likely(next)) return next; - } else if (defval) { - if (PyErr_Occurred()) { - if(!PyErr_ExceptionMatches(PyExc_StopIteration)) +#if CYTHON_COMPILING_IN_CPYTHON +#if PY_VERSION_HEX >= 0x03010000 || (PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000) + if (unlikely(iternext == &_PyObject_NextNotImplemented)) + return NULL; +#endif +#endif + if (defval) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(exc_type != PyExc_StopIteration) && + !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) return NULL; PyErr_Clear(); } Py_INCREF(defval); return defval; - } else if (PyErr_Occurred()) { - return NULL; - } else { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } -} - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_Check(key))) - #endif - 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; -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; + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_StopIteration); + return NULL; } static double __Pyx__PyObject_AsDouble(PyObject* obj) { PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { return PyFloat_AsDouble(obj); } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { @@ -27421,6 +28360,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { 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); @@ -27432,6 +28372,7 @@ bad: 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; @@ -27440,19 +28381,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) 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 - *type = local_type; - *value = local_value; - *tb = local_tb; 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; @@ -27460,10 +28409,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ + 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; @@ -27476,6 +28428,7 @@ bad: } 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; @@ -27483,8 +28436,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, 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; @@ -27496,11 +28453,82 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *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, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + 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, '.')) { + /* try package relative import first */ + 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); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + 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 + 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: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; } static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { PyObject *metaclass; - /* Default metaclass */ #if PY_MAJOR_VERSION < 3 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); @@ -27530,7 +28558,6 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na PyObject *metaclass; if (PyDict_SetItemString(dict, "__module__", modname) < 0) return NULL; - /* Python2 __metaclass__ */ metaclass = PyDict_GetItemString(dict, "__metaclass__"); if (metaclass) { Py_INCREF(metaclass); @@ -27912,6 +28939,56 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) PyString_AsString(func_name), (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*/ @@ -27931,7 +29008,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - __Pyx_PyCFunction_Call, /*tp_call*/ + __Pyx_CyFunction_Call, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ @@ -27967,15 +29044,16 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, /*tp_version_tag*/ #endif }; -static int __Pyx_CyFunction_init(void) -{ +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; } -void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) -{ +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) @@ -27984,14 +29062,16 @@ void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) m->defaults_pyobjects = pyobjects; return m->defaults; } -static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) -{ +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 int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { @@ -28019,9 +29099,13 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq Py_DECREF(py_result); return result; } +#endif } static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else if (s1 == s2) { return (equals == Py_EQ); } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { @@ -28061,6 +29145,7 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int Py_DECREF(py_result); return result; } +#endif } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -28463,8 +29548,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +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); @@ -28484,6 +29569,7 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, 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; @@ -28491,6 +29577,10 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, 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; @@ -28500,9 +29590,70 @@ 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_GetAttrString(ev, "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) -{ +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; @@ -28514,14 +29665,18 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) Py_XDECREF(exc_traceback); } static CYTHON_INLINE -PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) -{ - PyObject *retval; - if (unlikely(self->is_running)) { +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); - return NULL; + 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, @@ -28534,81 +29689,240 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) PyErr_SetNone(PyExc_StopIteration); return NULL; } - if (value) - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); - else + 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); - else + 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 PyObject *__Pyx_Generator_Next(PyObject *self) -{ - return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None); +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) -{ - return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value); +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 = PyObject_CallMethod(yf, (char*)"send", (char*)"O", 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_GetAttrString(yf, "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 *generator = (__pyx_GeneratorObject *) self; - PyObject *retval; +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); + PyErr_SetNone(PyExc_StopIteration); #else - PyErr_SetNone(PyExc_GeneratorExit); + PyErr_SetNone(PyExc_GeneratorExit); #endif - retval = __Pyx_Generator_SendEx(generator, NULL); + retval = __Pyx_Generator_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } -#if PY_VERSION_HEX < 0x02050000 - if (PyErr_ExceptionMatches(PyExc_StopIteration)) -#else - if (PyErr_ExceptionMatches(PyExc_StopIteration) - || PyErr_ExceptionMatches(PyExc_GeneratorExit)) + 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)) { - PyErr_Clear(); /* ignore these errors */ + 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 *generator = (__pyx_GeneratorObject *) self; +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_GetAttrString(yf, "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(generator, NULL); + return __Pyx_Generator_SendEx(gen, NULL); } -static int -__Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) -{ +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 void -__Pyx_Generator_dealloc(PyObject *self) -{ +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) @@ -28620,16 +29934,10 @@ __Pyx_Generator_dealloc(PyObject *self) return; /* resurrected. :( */ } PyObject_GC_UnTrack(self); - Py_CLEAR(gen->closure); - Py_CLEAR(gen->classobj); - Py_CLEAR(gen->exc_type); - Py_CLEAR(gen->exc_value); - Py_CLEAR(gen->exc_traceback); + __Pyx_Generator_clear(self); PyObject_GC_Del(gen); } -static void -__Pyx_Generator_del(PyObject *self) -{ +static void __Pyx_Generator_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; @@ -28658,11 +29966,13 @@ __Pyx_Generator_del(PyObject *self) _Py_NewReference(self); self->ob_refcnt = refcnt; } +#if CYTHON_COMPILING_FOR_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 @@ -28670,13 +29980,17 @@ __Pyx_Generator_del(PyObject *self) * undone. */ #ifdef COUNT_ALLOCS - --self->ob_type->tp_frees; - --self->ob_type->tp_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_INT, +#endif offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL}, @@ -28688,7 +30002,7 @@ static PyMethodDef __pyx_Generator_methods[] = { {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_GeneratorType = { +static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("generator"), /*tp_name*/ sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ @@ -28709,7 +30023,7 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr, /*tp_getattro*/ + 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ @@ -28718,7 +30032,7 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ - PyObject_SelfIter, /*tp_iter*/ + 0, /*tp_iter*/ (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ __pyx_Generator_methods, /*tp_methods*/ __pyx_Generator_memberlist, /*tp_members*/ @@ -28743,12 +30057,10 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_version_tag*/ #endif }; -static -__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure) -{ +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { __pyx_GeneratorObject *gen = - PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType); + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); if (gen == NULL) return NULL; gen->body = body; @@ -28757,6 +30069,7 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, 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; @@ -28764,9 +30077,14 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, PyObject_GC_Track(gen); return gen; } -static int __pyx_Generator_init(void) -{ - return PyType_Ready(&__pyx_GeneratorType); +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) { @@ -28805,6 +30123,147 @@ bad: return -1; } +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj);} +#endif + *f = tmp.fp; + if (!(*f)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { diff --git a/python/src/_cdec.pyx b/python/src/_cdec.pyx index c60f342f..e93474fe 100644 --- a/python/src/_cdec.pyx +++ b/python/src/_cdec.pyx @@ -3,14 +3,14 @@ from libcpp.vector cimport vector from utils cimport * cimport decoder -cdef char* as_str(data, error_msg='Cannot convert type %s to str'): +cdef char* as_str(data, char* error_msg='Cannot convert type %s to str'): cdef bytes ret if isinstance(data, unicode): ret = data.encode('utf8') elif isinstance(data, str): ret = data else: - raise TypeError(error_msg % type(data)) + raise TypeError(error_msg.format(type(data))) return ret include "vectors.pxi" @@ -55,8 +55,9 @@ cdef class Decoder: cdef istringstream* config_stream = new istringstream(config_str) self.dec = new decoder.Decoder(config_stream) del config_stream - self.weights = DenseVector() + self.weights = DenseVector.__new__(DenseVector) self.weights.vector = &self.dec.CurrentWeightVector() + self.weights.owned = True def __dealloc__(self): del self.dec @@ -72,6 +73,7 @@ cdef class Decoder: self.weights.vector.clear() ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) elif isinstance(weights, dict): + self.weights.vector.clear() for fname, fval in weights.items(): self.weights[fname] = fval else: @@ -80,7 +82,7 @@ cdef class Decoder: property formalism: def __get__(self): cdef variables_map* conf = &self.dec.GetConf() - return conf[0]['formalism'].as_str().c_str() + return conf[0]['formalism'].as_str() def read_weights(self, weights): with open(weights) as fp: diff --git a/python/src/grammar.pxd b/python/src/grammar.pxd index 8853a614..833de2e3 100644 --- a/python/src/grammar.pxd +++ b/python/src/grammar.pxd @@ -21,17 +21,20 @@ cdef extern from "decoder/trule.h": void ComputeArity() cdef extern from "decoder/grammar.h": - cdef cppclass RuleBin "const RuleBin": + cdef cppclass RuleBin: int GetNumRules() shared_ptr[TRule] GetIthRule(int i) int Arity() - cdef cppclass GrammarIter "const GrammarIter": - RuleBin* GetRules() - GrammarIter* Extend(int symbol) + ctypedef RuleBin const_RuleBin "const RuleBin" + + cdef cppclass GrammarIter: + const_RuleBin* GetRules() + + ctypedef GrammarIter const_GrammarIter "const GrammarIter" cdef cppclass Grammar: - GrammarIter* GetRoot() + const_GrammarIter* GetRoot() bint HasRuleForSpan(int i, int j, int distance) unsigned GetCTFLevels() string GetGrammarName() diff --git a/python/src/grammar.pxi b/python/src/grammar.pxi index 80d9fbf5..5ec21422 100644 --- a/python/src/grammar.pxi +++ b/python/src/grammar.pxi @@ -1,4 +1,6 @@ cimport grammar +cimport cdec.sa._sa as _sa +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) @@ -23,9 +25,41 @@ cdef class NTRef: def __str__(self): return '[%d]' % self.ref -cdef class BaseTRule: +cdef TRule convert_rule(_sa.Rule rule): + cdef unsigned i + cdef lhs = _sa.sym_tocat(rule.lhs) + cdef scores = {} + for i in range(rule.n_scores): + scores['PhraseModel_'+str(i)] = rule.cscores[i] + f, e = [], [] + cdef int* fsyms = rule.f.syms + for i in range(rule.f.n): + if _sa.sym_isvar(fsyms[i]): + f.append(NT(_sa.sym_tocat(fsyms[i]))) + else: + f.append(_sa.sym_tostring(fsyms[i])) + cdef int* esyms = rule.e.syms + for i in range(rule.e.n): + if _sa.sym_isvar(esyms[i]): + e.append(NTRef(_sa.sym_getindex(esyms[i]))) + else: + e.append(_sa.sym_tostring(esyms[i])) + cdef a = [(point/65536, point%65536) for point in rule.word_alignments] + return TRule(lhs, f, e, scores, a) + +cdef class TRule: cdef shared_ptr[grammar.TRule]* rule + def __init__(self, lhs, f, e, scores, a=None): + self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) + self.lhs = lhs + self.e = e + self.f = f + self.scores = scores + if a: + self.a = a + self.rule.get().ComputeArity() + def __dealloc__(self): del self.rule @@ -104,7 +138,7 @@ cdef class BaseTRule: property scores: def __get__(self): - cdef SparseVector scores = SparseVector() + cdef SparseVector scores = SparseVector.__new__(SparseVector) scores.vector = new FastSparseVector[double](self.rule.get().scores_) return scores @@ -132,17 +166,6 @@ cdef class BaseTRule: return '%s ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores) -cdef class TRule(BaseTRule): - def __cinit__(self, lhs, f, e, scores, a=None): - self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) - self.lhs = lhs - self.e = e - self.f = f - self.scores = scores - if a: - self.a = a - self.rule.get().ComputeArity() - cdef class Grammar: cdef shared_ptr[grammar.Grammar]* grammar @@ -150,12 +173,12 @@ cdef class Grammar: del self.grammar def __iter__(self): - cdef grammar.GrammarIter* root = self.grammar.get().GetRoot() - cdef grammar.RuleBin* rbin = root.GetRules() + cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() + cdef grammar.const_RuleBin* rbin = root.GetRules() cdef TRule trule cdef unsigned i for i in range(rbin.GetNumRules()): - trule = TRule() + trule = TRule.__new__(TRule) trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) yield trule @@ -171,6 +194,8 @@ cdef class TextGrammar(Grammar): self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() for trule in rules: - if not isinstance(trule, BaseTRule): + if isinstance(trule, _sa.Rule): + trule = convert_rule(trule) + elif not isinstance(trule, TRule): raise ValueError('the grammar should contain TRule objects') - _g.AddRule((<BaseTRule> trule).rule[0]) + _g.AddRule((<TRule> trule).rule[0]) diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd index e51ccf5c..886660bf 100644 --- a/python/src/hypergraph.pxd +++ b/python/src/hypergraph.pxd @@ -9,23 +9,27 @@ cdef extern from "decoder/hg.h": EdgeMask(int size) bint& operator[](int) - cdef cppclass HypergraphEdge "const Hypergraph::Edge": + cdef cppclass HypergraphEdge "Hypergraph::Edge": int id_ int head_node_ # position in hg.nodes_ SmallVector[unsigned] tail_nodes_ # positions in hg.nodes_ shared_ptr[TRule] rule_ FastSparseVector[weight_t] feature_values_ - LogVal[double] edge_prob_ # weights.dot(feature_values_) + prob_t edge_prob_ # weights.dot(feature_values_) # typically source span: short int i_ short int j_ - cdef cppclass HypergraphNode "const Hypergraph::Node": + ctypedef HypergraphEdge const_HypergraphEdge "const Hypergraph::Edge" + + cdef cppclass HypergraphNode "Hypergraph::Node": int id_ WordID cat_ # non-terminal category if <0, 0 if not set vector[int] in_edges_ # positions in hg.edge_prob_ vector[int] out_edges_ # positions in hg.edge_prob_ + ctypedef HypergraphNode const_HypergraphNode "const Hypergraph::Node" + cdef cppclass Hypergraph: Hypergraph(Hypergraph) vector[HypergraphNode] nodes_ @@ -42,9 +46,9 @@ cdef extern from "decoder/hg.h": bint safe_inside) cdef extern from "decoder/viterbi.h": - LogVal[double] ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) + prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) string ViterbiETree(Hypergraph& hg) - LogVal[double] ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) + prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) string ViterbiFTree(Hypergraph& hg) FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg) FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg, @@ -67,7 +71,7 @@ cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler": cdef cppclass Hypothesis: vector[WordID] words FastSparseVector[weight_t] fmap - LogVal[double] model_score + prob_t model_score void sample_hypotheses(Hypergraph& hg, unsigned n, MT19937* rng, @@ -77,4 +81,4 @@ cdef extern from "decoder/csplit.h" namespace "CompoundSplit": int GetFullWordEdgeIndex(Hypergraph& forest) cdef extern from "decoder/inside_outside.h": - LogVal[double] InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[LogVal[double]]* result) + prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result) diff --git a/python/src/hypergraph.pxi b/python/src/hypergraph.pxi index 86751cc9..b210f440 100644 --- a/python/src/hypergraph.pxi +++ b/python/src/hypergraph.pxi @@ -21,7 +21,7 @@ cdef class Hypergraph: return (f_tree, e_tree) def viterbi_features(self): - cdef SparseVector fmap = SparseVector() + cdef SparseVector fmap = SparseVector.__new__(SparseVector) fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) return fmap @@ -67,7 +67,7 @@ cdef class Hypergraph: for k in range(size): derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) if not derivation: break - fmap = SparseVector() + fmap = SparseVector.__new__(SparseVector) fmap.vector = new FastSparseVector[weight_t](derivation._yield) yield fmap finally: @@ -130,12 +130,12 @@ cdef class Hypergraph: return self.hg.NumberOfPaths() def inside_outside(self): - cdef FastSparseVector[LogVal[double]]* result = new FastSparseVector[LogVal[double]]() - cdef LogVal[double] z = hypergraph.InsideOutside(self.hg[0], result) + cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() + cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) result[0] /= z - cdef SparseVector vector = SparseVector() + cdef SparseVector vector = SparseVector.__new__(SparseVector) vector.vector = new FastSparseVector[double]() - cdef FastSparseVector[LogVal[double]].const_iterator* it = new FastSparseVector[LogVal[double]].const_iterator(result[0], False) + 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()): vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) @@ -147,12 +147,12 @@ cdef class Hypergraph: cdef class HypergraphEdge: cdef hypergraph.Hypergraph* hg cdef hypergraph.HypergraphEdge* edge - cdef public BaseTRule trule + cdef public TRule trule cdef init(self, hypergraph.Hypergraph* hg, unsigned i): self.hg = hg self.edge = &hg.edges_[i] - self.trule = BaseTRule() + self.trule = TRule.__new__(TRule) self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) return self @@ -175,7 +175,7 @@ cdef class HypergraphEdge: property feature_values: def __get__(self): - cdef SparseVector vector = SparseVector() + cdef SparseVector vector = SparseVector.__new__(SparseVector) vector.vector = new FastSparseVector[double](self.edge.feature_values_) return vector diff --git a/python/src/lattice.pxi b/python/src/lattice.pxi index 08405188..14864549 100644 --- a/python/src/lattice.pxi +++ b/python/src/lattice.pxi @@ -16,6 +16,9 @@ cdef class Lattice: self.lattice = new lattice.Lattice() lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) + def __dealloc__(self): + del self.lattice + def __getitem__(self, int index): if not 0 <= index < len(self): raise IndexError('lattice index out of range') @@ -51,9 +54,6 @@ cdef class Lattice: for i in range(len(self)): yield self[i] - def __dealloc__(self): - del self.lattice - def todot(self): def lines(): yield 'digraph lattice {' diff --git a/python/src/mteval.pxd b/python/src/mteval.pxd index 27c2808d..c97c4b34 100644 --- a/python/src/mteval.pxd +++ b/python/src/mteval.pxd @@ -38,15 +38,17 @@ cdef extern from "py_scorer.h": string& metric_id, void*, MetricStatsCallback, MetricScoreCallback) cdef extern from "training/candidate_set.h" namespace "training": - cdef cppclass Candidate "const training::Candidate": + cdef cppclass Candidate: vector[WordID] ewords FastSparseVector[weight_t] fmap SufficientStats eval_feats + ctypedef Candidate const_Candidate "const training::Candidate" + cdef cppclass CandidateSet: CandidateSet() unsigned size() - Candidate& operator[](unsigned i) + const_Candidate& operator[](unsigned i) void ReadFromFile(string& file) void WriteToFile(string& file) void AddKBestCandidates(Hypergraph& hg, diff --git a/python/src/mteval.pxi b/python/src/mteval.pxi index 52d2abc6..cd1c3c81 100644 --- a/python/src/mteval.pxi +++ b/python/src/mteval.pxi @@ -10,7 +10,7 @@ cdef SufficientStats as_stats(x, y): return stats cdef class Candidate: - cdef mteval.Candidate* candidate + cdef mteval.const_Candidate* candidate cdef public float score property words: @@ -19,7 +19,7 @@ cdef class Candidate: property fmap: def __get__(self): - cdef SparseVector fmap = SparseVector() + cdef SparseVector fmap = SparseVector.__new__(SparseVector) fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) return fmap diff --git a/python/src/sa/_cdec_sa.c b/python/src/sa/_sa.c index 5bd9b28c..34f170bf 100644 --- a/python/src/sa/_cdec_sa.c +++ b/python/src/sa/_sa.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.16 on Fri Jul 27 00:18:44 2012 */ +/* Generated by Cython 0.17.beta1 on Fri Jul 27 22:15:31 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -47,12 +47,6 @@ #define CYTHON_COMPILING_IN_CPYTHON 1 #endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCFunction_Call PyObject_Call -#else - #define __Pyx_PyCFunction_Call PyCFunction_Call -#endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -60,8 +54,11 @@ #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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 PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else @@ -130,14 +127,20 @@ #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #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_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #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 @@ -268,8 +271,8 @@ #define _USE_MATH_DEFINES #endif #include <math.h> -#define __PYX_HAVE___cdec_sa -#define __PYX_HAVE_API___cdec_sa +#define __PYX_HAVE___sa +#define __PYX_HAVE_API___sa #include "stdio.h" #include "stdlib.h" #include "string.h" @@ -329,7 +332,11 @@ 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)) #ifdef __GNUC__ @@ -357,7 +364,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "_cdec_sa.pyx", + "_sa.pyx", "float_list.pxi", "int_list.pxi", "data_array.pxi", @@ -368,44 +375,46 @@ static const char *__pyx_f[] = { "rulefactory.pxi", "lcp.pxi", "sym.pxi", + "_sa.pxd", "precomputation.pxi", "suffix_array.pxi", "str_map.pxi", }; /*--- Type declarations ---*/ -struct __pyx_obj_8_cdec_sa_VEB; -struct __pyx_obj_8_cdec_sa_Sampler; -struct __pyx_obj_8_cdec_sa_BitSet; -struct __pyx_obj_8_cdec_sa_DataArray; -struct __pyx_obj_8_cdec_sa_TrieNode; -struct __pyx_obj_8_cdec_sa_VEBIterator; -struct __pyx_obj_8_cdec_sa_BitSetIterator; -struct __pyx_obj_8_cdec_sa_Phrase; -struct __pyx_obj_8_cdec_sa_IntList; -struct __pyx_obj_8_cdec_sa_ExtendedTrieNode; -struct __pyx_obj_8_cdec_sa_PhraseLocation; -struct __pyx_obj_8_cdec_sa_Rule; -struct __pyx_obj_8_cdec_sa_LCP; -struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory; -struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats; -struct __pyx_obj_8_cdec_sa_BiLex; -struct __pyx_obj_8_cdec_sa_SuffixArray; -struct __pyx_obj_8_cdec_sa_StringMap; -struct __pyx_obj_8_cdec_sa_TrieMap; -struct __pyx_obj_8_cdec_sa_Alphabet; -struct __pyx_obj_8_cdec_sa_Alignment; -struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input; -struct __pyx_obj_8_cdec_sa_Precomputation; -struct __pyx_obj_8_cdec_sa_FloatList; -struct __pyx_obj_8_cdec_sa_TrieTable; -struct __pyx_t_8_cdec_sa__node; -struct __pyx_t_8_cdec_sa__BitSet; -struct __pyx_t_8_cdec_sa__VEB; -struct __pyx_t_8_cdec_sa__Trie_Edge; -struct __pyx_t_8_cdec_sa__Trie_Node; -struct __pyx_t_8_cdec_sa_match_node; -struct __pyx_t_8_cdec_sa_Matching; +struct __pyx_obj_3_sa_HieroCachingRuleFactory; +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_LCP; +struct __pyx_obj_3_sa_DataArray; +struct __pyx_obj_3_sa_BitSetIterator; +struct __pyx_obj_3_sa_Precomputation; +struct __pyx_obj_3_sa_SuffixArray; +struct __pyx_obj_3_sa_Alphabet; +struct __pyx_obj_3_sa_Rule; +struct __pyx_obj_3_sa_PhraseLocation; +struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats; +struct __pyx_obj_3_sa___pyx_scope_struct_2_input; +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_1___iter__; +struct __pyx_obj_3_sa_TrieNode; +struct __pyx_obj_3_sa_ExtendedTrieNode; +struct __pyx_obj_3_sa_TrieMap; +struct __pyx_obj_3_sa_Phrase; +struct __pyx_obj_3_sa_TrieTable; +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 * from libc.string cimport memset, strcpy, strlen @@ -414,9 +423,9 @@ struct __pyx_t_8_cdec_sa_Matching; * _node* smaller * _node* bigger */ -struct __pyx_t_8_cdec_sa__node { - struct __pyx_t_8_cdec_sa__node *smaller; - struct __pyx_t_8_cdec_sa__node *bigger; +struct __pyx_t_3_sa__node { + struct __pyx_t_3_sa__node *smaller; + struct __pyx_t_3_sa__node *bigger; int key; int val; }; @@ -428,7 +437,7 @@ struct __pyx_t_8_cdec_sa__node { * long bitset * int min_val */ -struct __pyx_t_8_cdec_sa__BitSet { +struct __pyx_t_3_sa__BitSet { long bitset; int min_val; int max_val; @@ -442,7 +451,7 @@ struct __pyx_t_8_cdec_sa__BitSet { * int top_universe_size * int num_bottom_bits */ -struct __pyx_t_8_cdec_sa__VEB { +struct __pyx_t_3_sa__VEB { int top_universe_size; int num_bottom_bits; int max_val; @@ -459,11 +468,11 @@ struct __pyx_t_8_cdec_sa__VEB { * int val * _Trie_Node* node */ -struct __pyx_t_8_cdec_sa__Trie_Edge { +struct __pyx_t_3_sa__Trie_Edge { int val; - struct __pyx_t_8_cdec_sa__Trie_Node *node; - struct __pyx_t_8_cdec_sa__Trie_Edge *bigger; - struct __pyx_t_8_cdec_sa__Trie_Edge *smaller; + struct __pyx_t_3_sa__Trie_Node *node; + struct __pyx_t_3_sa__Trie_Edge *bigger; + struct __pyx_t_3_sa__Trie_Edge *smaller; }; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":8 @@ -473,8 +482,8 @@ struct __pyx_t_8_cdec_sa__Trie_Edge { * * cdef struct _Trie_Edge: */ -struct __pyx_t_8_cdec_sa__Trie_Node { - struct __pyx_t_8_cdec_sa__Trie_Edge *root; +struct __pyx_t_3_sa__Trie_Node { + struct __pyx_t_3_sa__Trie_Edge *root; int *arr; int arr_len; }; @@ -486,9 +495,9 @@ struct __pyx_t_8_cdec_sa__Trie_Node { * int* match * match_node* next */ -struct __pyx_t_8_cdec_sa_match_node { +struct __pyx_t_3_sa_match_node { int *match; - struct __pyx_t_8_cdec_sa_match_node *next; + struct __pyx_t_3_sa_match_node *next; }; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":145 @@ -498,7 +507,7 @@ struct __pyx_t_8_cdec_sa_match_node { * int* arr * int start */ -struct __pyx_t_8_cdec_sa_Matching { +struct __pyx_t_3_sa_Matching { int *arr; int start; int end; @@ -506,90 +515,150 @@ struct __pyx_t_8_cdec_sa_Matching { int size; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":201 * * - * cdef class VEB: # <<<<<<<<<<<<<< - * cdef _VEB* veb - * cdef int _findsucc(self, int i) + * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< + * '''This RuleFactory implements a caching + * method using TrieTable, which makes phrase */ -struct __pyx_obj_8_cdec_sa_VEB { +struct __pyx_obj_3_sa_HieroCachingRuleFactory { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_VEB *__pyx_vtab; - struct __pyx_t_8_cdec_sa__VEB *veb; + struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *__pyx_vtab; + struct __pyx_obj_3_sa_TrieTable *rules; + struct __pyx_obj_3_sa_Sampler *sampler; + 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; + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":79 - * +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":9 + * from libc.string cimport memset, memcpy * - * cdef class Sampler: # <<<<<<<<<<<<<< - * '''A Sampler implements a logic for choosing - * samples from a population range''' + * cdef class IntList: # <<<<<<<<<<<<<< + * cdef int size + * cdef int increment */ -struct __pyx_obj_8_cdec_sa_Sampler { +struct __pyx_obj_3_sa_IntList { PyObject_HEAD - int sample_size; - struct __pyx_obj_8_cdec_sa_IntList *sa; + struct __pyx_vtabstruct_3_sa_IntList *__pyx_vtab; + int size; + int increment; + int len; + int *arr; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":118 - * # (entirely C-implemented) _BitSet struct. - * # Very slow; use only for debugging - * cdef class BitSet: # <<<<<<<<<<<<<< +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":340 * - * cdef _BitSet* b + * + * cdef class VEBIterator: # <<<<<<<<<<<<<< + * cdef _VEB* v + * cdef int next_val */ -struct __pyx_obj_8_cdec_sa_BitSet { +struct __pyx_obj_3_sa_VEBIterator { PyObject_HEAD - struct __pyx_t_8_cdec_sa__BitSet *b; + struct __pyx_t_3_sa__VEB *v; + int next_val; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 - * from libc.string cimport memset, strcpy, strlen +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 * - * cdef class DataArray: # <<<<<<<<<<<<<< - * cdef word2id - * cdef id2word + * + * cdef class BiLex: # <<<<<<<<<<<<<< + * cdef FloatList col1 + * cdef FloatList col2 */ -struct __pyx_obj_8_cdec_sa_DataArray { +struct __pyx_obj_3_sa_BiLex { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_DataArray *__pyx_vtab; - PyObject *word2id; - PyObject *id2word; - struct __pyx_obj_8_cdec_sa_IntList *data; - struct __pyx_obj_8_cdec_sa_IntList *sent_id; - struct __pyx_obj_8_cdec_sa_IntList *sent_index; - int use_sent_id; + 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/rulefactory.pxi":18 - * cdef int EPSILON = sym_fromstring('*EPS*', True) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 * - * cdef class TrieNode: # <<<<<<<<<<<<<< - * cdef public children * + * cdef class VEB: # <<<<<<<<<<<<<< + * cdef _VEB* veb + * cdef int _findsucc(self, int i) */ -struct __pyx_obj_8_cdec_sa_TrieNode { +struct __pyx_obj_3_sa_VEB { PyObject_HEAD - PyObject *children; + struct __pyx_vtabstruct_3_sa_VEB *__pyx_vtab; + struct __pyx_t_3_sa__VEB *veb; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":340 +/* "/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, strlen * - * cdef class VEBIterator: # <<<<<<<<<<<<<< - * cdef _VEB* v - * cdef int next_val + * cdef class DataArray: # <<<<<<<<<<<<<< + * cdef word2id + * cdef id2word */ -struct __pyx_obj_8_cdec_sa_VEBIterator { +struct __pyx_obj_3_sa_DataArray { PyObject_HEAD - struct __pyx_t_8_cdec_sa__VEB *v; - int next_val; + 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; }; @@ -600,59 +669,75 @@ struct __pyx_obj_8_cdec_sa_VEBIterator { * cdef _BitSet* b * cdef int next_val */ -struct __pyx_obj_8_cdec_sa_BitSetIterator { +struct __pyx_obj_3_sa_BitSetIterator { PyObject_HEAD - struct __pyx_t_8_cdec_sa__BitSet *b; + struct __pyx_t_3_sa__BitSet *b; int next_val; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":4 - * from libc.string cimport strsep, strcpy, strlen +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 * - * cdef class Phrase: # <<<<<<<<<<<<<< - * cdef int *syms - * cdef int n, *varpos, n_vars + * + * cdef class Precomputation: # <<<<<<<<<<<<<< + * cdef int precompute_rank + * cdef int precompute_secondary_rank */ -struct __pyx_obj_8_cdec_sa_Phrase { +struct __pyx_obj_3_sa_Precomputation { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_Phrase *__pyx_vtab; - int *syms; - int n; - int *varpos; - int n_vars; + 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/int_list.pxi":9 - * from libc.string cimport memset, memcpy +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":6 + * from libc.stdio cimport FILE, fclose, fopen * - * cdef class IntList: # <<<<<<<<<<<<<< - * cdef int size - * cdef int increment + * cdef class SuffixArray: # <<<<<<<<<<<<<< + * cdef DataArray darray + * cdef IntList sa */ -struct __pyx_obj_8_cdec_sa_IntList { +struct __pyx_obj_3_sa_SuffixArray { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_IntList *__pyx_vtab; - int size; - int increment; - int len; - int *arr; + 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/rulefactory.pxi":24 - * self.children = {} +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 + * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 * - * cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<< - * cdef public phrase - * cdef public phrase_location + * cdef class Alphabet: # <<<<<<<<<<<<<< + * cdef readonly StringMap terminals, nonterminals + * cdef int first_nonterminal, last_nonterminal */ -struct __pyx_obj_8_cdec_sa_ExtendedTrieNode { - struct __pyx_obj_8_cdec_sa_TrieNode __pyx_base; - PyObject *phrase; - PyObject *phrase_location; - PyObject *suffix_link; +struct __pyx_obj_3_sa_Alphabet { + PyObject_HEAD + struct __pyx_vtabstruct_3_sa_Alphabet *__pyx_vtab; + struct __pyx_obj_3_sa_StringMap *terminals; + struct __pyx_obj_3_sa_StringMap *nonterminals; + int first_nonterminal; + int last_nonterminal; + PyObject *id2sym; +}; + +struct __pyx_obj_3_sa_Rule { + PyObject_HEAD + int lhs; + struct __pyx_obj_3_sa_Phrase *f; + struct __pyx_obj_3_sa_Phrase *e; + float *cscores; + int n_scores; + PyObject *word_alignments; }; @@ -663,98 +748,18 @@ struct __pyx_obj_8_cdec_sa_ExtendedTrieNode { * cdef int sa_low * cdef int sa_high */ -struct __pyx_obj_8_cdec_sa_PhraseLocation { +struct __pyx_obj_3_sa_PhraseLocation { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_PhraseLocation *__pyx_vtab; + struct __pyx_vtabstruct_3_sa_PhraseLocation *__pyx_vtab; int sa_low; int sa_high; int arr_low; int arr_high; - struct __pyx_obj_8_cdec_sa_IntList *arr; + struct __pyx_obj_3_sa_IntList *arr; int num_subpatterns; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":159 - * return start - * - * cdef class Rule: # <<<<<<<<<<<<<< - * cdef public int lhs - * cdef readonly Phrase f, e - */ -struct __pyx_obj_8_cdec_sa_Rule { - PyObject_HEAD - int lhs; - struct __pyx_obj_8_cdec_sa_Phrase *f; - struct __pyx_obj_8_cdec_sa_Phrase *e; - float *cscores; - int n_scores; - PyObject *word_alignments; -}; - - -/* "/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_8_cdec_sa_LCP { - PyObject_HEAD - struct __pyx_obj_8_cdec_sa_SuffixArray *sa; - struct __pyx_obj_8_cdec_sa_IntList *lcp; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":201 - * - * - * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< - * '''This RuleFactory implements a caching - * method using TrieTable, which makes phrase - */ -struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *__pyx_vtab; - struct __pyx_obj_8_cdec_sa_TrieTable *rules; - struct __pyx_obj_8_cdec_sa_Sampler *sampler; - 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; - struct __pyx_obj_8_cdec_sa_SuffixArray *fsa; - struct __pyx_obj_8_cdec_sa_DataArray *fda; - struct __pyx_obj_8_cdec_sa_DataArray *eda; - struct __pyx_obj_8_cdec_sa_Alignment *alignment; - struct __pyx_obj_8_cdec_sa_IntList *eid2symid; - struct __pyx_obj_8_cdec_sa_IntList *fid2symid; - int tight_phrases; - int require_aligned_terminal; - int require_aligned_chunks; - struct __pyx_obj_8_cdec_sa_IntList *findexes; - struct __pyx_obj_8_cdec_sa_IntList *findexes1; -}; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":36 * logger.info("LCP array completed") * @@ -762,7 +767,7 @@ struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory { * """Note: the output of this function is not exact. In * particular, the frequency associated with each word is */ -struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats { +struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats { PyObject_HEAD int __pyx_v_N; int __pyx_v_freq; @@ -775,116 +780,17 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats { int __pyx_v_max_n; int __pyx_v_n; PyObject *__pyx_v_ngram; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_ngram_start; + struct __pyx_obj_3_sa_IntList *__pyx_v_ngram_start; PyObject *__pyx_v_ngram_starts; int __pyx_v_rs; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_run_start; - struct __pyx_obj_8_cdec_sa_LCP *__pyx_v_self; + 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_8_cdec_sa_VEB *__pyx_v_veb; + struct __pyx_obj_3_sa_VEB *__pyx_v_veb; int __pyx_t_0; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 - * - * - * cdef class BiLex: # <<<<<<<<<<<<<< - * cdef FloatList col1 - * cdef FloatList col2 - */ -struct __pyx_obj_8_cdec_sa_BiLex { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_BiLex *__pyx_vtab; - struct __pyx_obj_8_cdec_sa_FloatList *col1; - struct __pyx_obj_8_cdec_sa_FloatList *col2; - struct __pyx_obj_8_cdec_sa_IntList *f_index; - struct __pyx_obj_8_cdec_sa_IntList *e_index; - PyObject *id2eword; - PyObject *id2fword; - PyObject *eword2id; - PyObject *fword2id; -}; - - -/* "/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_8_cdec_sa_SuffixArray { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_SuffixArray *__pyx_vtab; - struct __pyx_obj_8_cdec_sa_DataArray *darray; - struct __pyx_obj_8_cdec_sa_IntList *sa; - struct __pyx_obj_8_cdec_sa_IntList *ha; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_StringMap { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_StringMap *__pyx_vtab; - StrMap *vocab; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 - * trie_node_to_map(edge.node, result, prefix, include_zeros) - * - * cdef class TrieMap: # <<<<<<<<<<<<<< - * - * cdef _Trie_Node** root - */ -struct __pyx_obj_8_cdec_sa_TrieMap { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_TrieMap *__pyx_vtab; - struct __pyx_t_8_cdec_sa__Trie_Node **root; - int V; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 - * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 - * - * cdef class Alphabet: # <<<<<<<<<<<<<< - * cdef readonly StringMap terminals, nonterminals - * cdef int first_nonterminal, last_nonterminal - */ -struct __pyx_obj_8_cdec_sa_Alphabet { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_Alphabet *__pyx_vtab; - struct __pyx_obj_8_cdec_sa_StringMap *terminals; - struct __pyx_obj_8_cdec_sa_StringMap *nonterminals; - int first_nonterminal; - int last_nonterminal; - PyObject *id2sym; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 - * # May need to revisit if things get really tight, though. - * - * cdef class Alignment: # <<<<<<<<<<<<<< - * cdef IntList links - * cdef IntList sent_index - */ -struct __pyx_obj_8_cdec_sa_Alignment { - PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_Alignment *__pyx_vtab; - struct __pyx_obj_8_cdec_sa_IntList *links; - struct __pyx_obj_8_cdec_sa_IntList *sent_index; -}; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":919 * return sorted(result); * @@ -892,7 +798,7 @@ struct __pyx_obj_8_cdec_sa_Alignment { * '''When this function is called on the RuleFactory, * it looks up all of the rules that can be used to translate */ -struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { +struct __pyx_obj_3_sa___pyx_scope_struct_2_input { PyObject_HEAD PyObject *__pyx_v_alignment; PyObject *__pyx_v_als; @@ -900,7 +806,7 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { int __pyx_v_alt; int __pyx_v_alt_id; int __pyx_v_arity; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_chunklen; + struct __pyx_obj_3_sa_IntList *__pyx_v_chunklen; PyObject *__pyx_v_count; PyObject *__pyx_v_currcount; PyObject *__pyx_v_e; @@ -918,7 +824,7 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { PyObject *__pyx_v_frontier; PyObject *__pyx_v_frontier_nodes; PyObject *__pyx_v_fwords; - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_hiero_phrase; + struct __pyx_obj_3_sa_Phrase *__pyx_v_hiero_phrase; long __pyx_v_hit; int __pyx_v_i; PyObject *__pyx_v_is_shadow_path; @@ -926,7 +832,7 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { int __pyx_v_k; PyObject *__pyx_v_key; int __pyx_v_lookup_required; - struct __pyx_t_8_cdec_sa_Matching __pyx_v_matching; + struct __pyx_t_3_sa_Matching __pyx_v_matching; PyObject *__pyx_v_model; PyObject *__pyx_v_models; PyObject *__pyx_v_new_frontier; @@ -939,17 +845,16 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { int __pyx_v_num_subpatterns; PyObject *__pyx_v_pathlen; PyObject *__pyx_v_phrase; - struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_phrase_location; + struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location; PyObject *__pyx_v_prefix; PyObject *__pyx_v_reachable_buffer; PyObject *__pyx_v_sa_range; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_sample; + struct __pyx_obj_3_sa_IntList *__pyx_v_sample; PyObject *__pyx_v_scores; - struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self; + struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self; PyObject *__pyx_v_spanlen; float __pyx_v_start_time; PyObject *__pyx_v_stop_time; - PyObject *__pyx_v_str_phrase; PyObject *__pyx_v_suffix_link; int __pyx_v_suffix_link_xcat; PyObject *__pyx_v_suffix_link_xcat_index; @@ -960,142 +865,178 @@ struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input { PyObject *__pyx_v_xnode; PyObject *__pyx_v_xroot; Py_ssize_t __pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2; - PyObject *__pyx_t_3; + PyObject *__pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 - * +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 + * # May need to revisit if things get really tight, though. * - * cdef class Precomputation: # <<<<<<<<<<<<<< - * cdef int precompute_rank - * cdef int precompute_secondary_rank + * cdef class Alignment: # <<<<<<<<<<<<<< + * cdef IntList links + * cdef IntList sent_index */ -struct __pyx_obj_8_cdec_sa_Precomputation { +struct __pyx_obj_3_sa_Alignment { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_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; + struct __pyx_vtabstruct_3_sa_Alignment *__pyx_vtab; + struct __pyx_obj_3_sa_IntList *links; + struct __pyx_obj_3_sa_IntList *sent_index; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":9 - * from libc.string cimport memset, strcpy, strlen +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":118 + * # (entirely C-implemented) _BitSet struct. + * # Very slow; use only for debugging + * cdef class BitSet: # <<<<<<<<<<<<<< * - * cdef class FloatList: # <<<<<<<<<<<<<< - * cdef int size - * cdef int increment + * cdef _BitSet* b */ -struct __pyx_obj_8_cdec_sa_FloatList { +struct __pyx_obj_3_sa_BitSet { PyObject_HEAD - struct __pyx_vtabstruct_8_cdec_sa_FloatList *__pyx_vtab; - int size; - int increment; - int len; - float *arr; + struct __pyx_t_3_sa__BitSet *b; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":35 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":79 * * - * cdef class TrieTable: # <<<<<<<<<<<<<< - * cdef public int extended - * cdef public int count + * cdef class Sampler: # <<<<<<<<<<<<<< + * '''A Sampler implements a logic for choosing + * samples from a population range''' */ -struct __pyx_obj_8_cdec_sa_TrieTable { +struct __pyx_obj_3_sa_Sampler { PyObject_HEAD - int extended; - int count; - PyObject *root; + int sample_size; + struct __pyx_obj_3_sa_IntList *sa; }; - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":6 - * from libc.stdio cimport FILE, fclose, fopen +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":8 + * char* stringmap_word(StrMap *vocab, int i) * - * cdef class SuffixArray: # <<<<<<<<<<<<<< - * cdef DataArray darray - * cdef IntList sa + * cdef class StringMap: # <<<<<<<<<<<<<< + * cdef StrMap *vocab + * cdef char *word(self, int i) */ +struct __pyx_obj_3_sa_StringMap { + PyObject_HEAD + struct __pyx_vtabstruct_3_sa_StringMap *__pyx_vtab; + StrMap *vocab; +}; + -struct __pyx_vtabstruct_8_cdec_sa_SuffixArray { - int (*__pyx___search_high)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int); - int (*__pyx___search_low)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int); - PyObject *(*__pyx___get_range)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int, int); - PyObject *(*__pyx___lookup_helper)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int); +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 + * return self.syms[i] + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: + */ +struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ { + PyObject_HEAD + int __pyx_v_i; + struct __pyx_obj_3_sa_Phrase *__pyx_v_self; + int __pyx_t_0; }; -static struct __pyx_vtabstruct_8_cdec_sa_SuffixArray *__pyx_vtabptr_8_cdec_sa_SuffixArray; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":201 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":18 + * cdef int EPSILON = sym_fromstring('*EPS*', True) * + * cdef class TrieNode: # <<<<<<<<<<<<<< + * cdef public children * - * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< - * '''This RuleFactory implements a caching - * method using TrieTable, which makes phrase */ +struct __pyx_obj_3_sa_TrieNode { + PyObject_HEAD + PyObject *children; +}; + -struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory { - PyObject *(*set_idmap)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_DataArray *); - int *(*baeza_yates_helper)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *); - long (*compare_matchings_set)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_8_cdec_sa_Matching *, int, int); - long (*compare_matchings)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_t_8_cdec_sa_Matching *, struct __pyx_t_8_cdec_sa_Matching *, int, int); - int *(*merge_helper)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *); - void (*sort_phrase_loc)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_IntList *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, struct __pyx_obj_8_cdec_sa_Phrase *); - PyObject *(*intersect_helper)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, int); - PyObject *(*loc2str)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_PhraseLocation *); - struct __pyx_obj_8_cdec_sa_PhraseLocation *(*intersect)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_8_cdec_sa_Phrase *); - int (*find_fixpoint)(struct __pyx_obj_8_cdec_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); - PyObject *(*find_projection)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *); - int *(*int_arr_extend)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int *, int *, int *, int); - PyObject *(*extract_phrases)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int); - PyObject *(*create_alignments)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int *, int, PyObject *, PyObject *); - PyObject *(*extract)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_t_8_cdec_sa_Matching *, int *, int); +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":24 + * self.children = {} + * + * cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<< + * cdef public phrase + * cdef public phrase_location + */ +struct __pyx_obj_3_sa_ExtendedTrieNode { + struct __pyx_obj_3_sa_TrieNode __pyx_base; + PyObject *phrase; + PyObject *phrase_location; + PyObject *suffix_link; }; -static struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *__pyx_vtabptr_8_cdec_sa_HieroCachingRuleFactory; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 + * trie_node_to_map(edge.node, result, prefix, include_zeros) * + * cdef class TrieMap: # <<<<<<<<<<<<<< * - * cdef class Precomputation: # <<<<<<<<<<<<<< - * cdef int precompute_rank - * cdef int precompute_secondary_rank + * cdef _Trie_Node** root */ +struct __pyx_obj_3_sa_TrieMap { + PyObject_HEAD + struct __pyx_vtabstruct_3_sa_TrieMap *__pyx_vtab; + struct __pyx_t_3_sa__Trie_Node **root; + int V; +}; + -struct __pyx_vtabstruct_8_cdec_sa_Precomputation { - PyObject *(*read_map)(struct __pyx_obj_8_cdec_sa_Precomputation *, FILE *); - PyObject *(*write_map)(struct __pyx_obj_8_cdec_sa_Precomputation *, PyObject *, FILE *); +/* "_sa.pxd":1 + * cdef class Phrase: # <<<<<<<<<<<<<< + * cdef int *syms + * cdef int n, *varpos, n_vars + */ +struct __pyx_obj_3_sa_Phrase { + PyObject_HEAD + struct __pyx_vtabstruct_3_sa_Phrase *__pyx_vtab; + int *syms; + int n; + int *varpos; + int n_vars; }; -static struct __pyx_vtabstruct_8_cdec_sa_Precomputation *__pyx_vtabptr_8_cdec_sa_Precomputation; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":56 - * # 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 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":35 + * + * + * cdef class TrieTable: # <<<<<<<<<<<<<< + * cdef public int extended + * cdef public int count */ +struct __pyx_obj_3_sa_TrieTable { + PyObject_HEAD + int extended; + int count; + PyObject *root; +}; + -struct __pyx_vtabstruct_8_cdec_sa_PhraseLocation { - int (*contains)(struct __pyx_obj_8_cdec_sa_PhraseLocation *, int); +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":9 + * from libc.string cimport memset, strcpy, strlen + * + * cdef class FloatList: # <<<<<<<<<<<<<< + * cdef int size + * cdef int increment + */ +struct __pyx_obj_3_sa_FloatList { + PyObject_HEAD + struct __pyx_vtabstruct_3_sa_FloatList *__pyx_vtab; + int size; + int increment; + int len; + float *arr; }; -static struct __pyx_vtabstruct_8_cdec_sa_PhraseLocation *__pyx_vtabptr_8_cdec_sa_PhraseLocation; + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":8 @@ -1106,11 +1047,57 @@ static struct __pyx_vtabstruct_8_cdec_sa_PhraseLocation *__pyx_vtabptr_8_cdec_sa * cdef char *word(self, int i) */ -struct __pyx_vtabstruct_8_cdec_sa_StringMap { - char *(*word)(struct __pyx_obj_8_cdec_sa_StringMap *, int); - int (*index)(struct __pyx_obj_8_cdec_sa_StringMap *, char *); +struct __pyx_vtabstruct_3_sa_StringMap { + char *(*word)(struct __pyx_obj_3_sa_StringMap *, int); + int (*index)(struct __pyx_obj_3_sa_StringMap *, char *); +}; +static struct __pyx_vtabstruct_3_sa_StringMap *__pyx_vtabptr_3_sa_StringMap; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 + * from libc.string cimport memset, strcpy, strlen + * + * cdef class DataArray: # <<<<<<<<<<<<<< + * cdef word2id + * cdef id2word + */ + +struct __pyx_vtabstruct_3_sa_DataArray { + void (*read_handle)(struct __pyx_obj_3_sa_DataArray *, FILE *); + void (*write_handle)(struct __pyx_obj_3_sa_DataArray *, FILE *); }; -static struct __pyx_vtabstruct_8_cdec_sa_StringMap *__pyx_vtabptr_8_cdec_sa_StringMap; +static struct __pyx_vtabstruct_3_sa_DataArray *__pyx_vtabptr_3_sa_DataArray; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 + * trie_node_to_map(edge.node, result, prefix, include_zeros) + * + * cdef class TrieMap: # <<<<<<<<<<<<<< + * + * cdef _Trie_Node** root + */ + +struct __pyx_vtabstruct_3_sa_TrieMap { + struct __pyx_t_3_sa__Trie_Node *(*_insert)(struct __pyx_obj_3_sa_TrieMap *, int *, int); + struct __pyx_t_3_sa__Trie_Node *(*_contains)(struct __pyx_obj_3_sa_TrieMap *, int *, int); +}; +static struct __pyx_vtabstruct_3_sa_TrieMap *__pyx_vtabptr_3_sa_TrieMap; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 + * # May need to revisit if things get really tight, though. + * + * cdef class Alignment: # <<<<<<<<<<<<<< + * cdef IntList links + * cdef IntList sent_index + */ + +struct __pyx_vtabstruct_3_sa_Alignment { + int (*link)(struct __pyx_obj_3_sa_Alignment *, int, int); + PyObject *(*_unlink)(struct __pyx_obj_3_sa_Alignment *, int, int *, int *); + int *(*_get_sent_links)(struct __pyx_obj_3_sa_Alignment *, int, int *); +}; +static struct __pyx_vtabstruct_3_sa_Alignment *__pyx_vtabptr_3_sa_Alignment; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 @@ -1121,82 +1108,79 @@ static struct __pyx_vtabstruct_8_cdec_sa_StringMap *__pyx_vtabptr_8_cdec_sa_Stri * cdef FloatList col2 */ -struct __pyx_vtabstruct_8_cdec_sa_BiLex { - PyObject *(*compute_from_data)(struct __pyx_obj_8_cdec_sa_BiLex *, struct __pyx_obj_8_cdec_sa_SuffixArray *, struct __pyx_obj_8_cdec_sa_DataArray *, struct __pyx_obj_8_cdec_sa_Alignment *); - PyObject *(*_add_node)(struct __pyx_obj_8_cdec_sa_BiLex *, struct __pyx_t_8_cdec_sa__node *, int *, float, int *); - PyObject *(*write_wordlist)(struct __pyx_obj_8_cdec_sa_BiLex *, PyObject *, FILE *); - PyObject *(*read_wordlist)(struct __pyx_obj_8_cdec_sa_BiLex *, PyObject *, PyObject *, FILE *); - PyObject *(*swap)(struct __pyx_obj_8_cdec_sa_BiLex *, int, int); - PyObject *(*qsort)(struct __pyx_obj_8_cdec_sa_BiLex *, int, int, PyObject *); +struct __pyx_vtabstruct_3_sa_BiLex { + PyObject *(*compute_from_data)(struct __pyx_obj_3_sa_BiLex *, struct __pyx_obj_3_sa_SuffixArray *, struct __pyx_obj_3_sa_DataArray *, struct __pyx_obj_3_sa_Alignment *); + PyObject *(*_add_node)(struct __pyx_obj_3_sa_BiLex *, struct __pyx_t_3_sa__node *, int *, float, int *); + PyObject *(*write_wordlist)(struct __pyx_obj_3_sa_BiLex *, PyObject *, FILE *); + PyObject *(*read_wordlist)(struct __pyx_obj_3_sa_BiLex *, PyObject *, PyObject *, FILE *); + PyObject *(*swap)(struct __pyx_obj_3_sa_BiLex *, int, int); + PyObject *(*qsort)(struct __pyx_obj_3_sa_BiLex *, int, int, PyObject *); }; -static struct __pyx_vtabstruct_8_cdec_sa_BiLex *__pyx_vtabptr_8_cdec_sa_BiLex; +static struct __pyx_vtabstruct_3_sa_BiLex *__pyx_vtabptr_3_sa_BiLex; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 - * +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":9 + * from libc.string cimport memset, memcpy * - * cdef class VEB: # <<<<<<<<<<<<<< - * cdef _VEB* veb - * cdef int _findsucc(self, int i) + * cdef class IntList: # <<<<<<<<<<<<<< + * cdef int size + * cdef int increment */ -struct __pyx_vtabstruct_8_cdec_sa_VEB { - int (*_findsucc)(struct __pyx_obj_8_cdec_sa_VEB *, int); - int (*_insert)(struct __pyx_obj_8_cdec_sa_VEB *, int); - int (*_first)(struct __pyx_obj_8_cdec_sa_VEB *); +struct __pyx_vtabstruct_3_sa_IntList { + void (*set)(struct __pyx_obj_3_sa_IntList *, int, int); + void (*_append)(struct __pyx_obj_3_sa_IntList *, int); + void (*_extend)(struct __pyx_obj_3_sa_IntList *, struct __pyx_obj_3_sa_IntList *); + void (*_extend_arr)(struct __pyx_obj_3_sa_IntList *, int *, int); + void (*_clear)(struct __pyx_obj_3_sa_IntList *); + void (*write_handle)(struct __pyx_obj_3_sa_IntList *, FILE *); + void (*read_handle)(struct __pyx_obj_3_sa_IntList *, FILE *); }; -static struct __pyx_vtabstruct_8_cdec_sa_VEB *__pyx_vtabptr_8_cdec_sa_VEB; +static struct __pyx_vtabstruct_3_sa_IntList *__pyx_vtabptr_3_sa_IntList; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":4 * from libc.string cimport strsep, strcpy, strlen * * cdef class Phrase: # <<<<<<<<<<<<<< - * cdef int *syms - * cdef int n, *varpos, n_vars + * + * def __cinit__(self, words): */ -struct __pyx_vtabstruct_8_cdec_sa_Phrase { - int (*chunkpos)(struct __pyx_obj_8_cdec_sa_Phrase *, int); - int (*chunklen)(struct __pyx_obj_8_cdec_sa_Phrase *, int); +struct __pyx_vtabstruct_3_sa_Phrase { + int (*chunkpos)(struct __pyx_obj_3_sa_Phrase *, int); + int (*chunklen)(struct __pyx_obj_3_sa_Phrase *, int); }; -static struct __pyx_vtabstruct_8_cdec_sa_Phrase *__pyx_vtabptr_8_cdec_sa_Phrase; +static struct __pyx_vtabstruct_3_sa_Phrase *__pyx_vtabptr_3_sa_Phrase; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":9 - * from libc.string cimport memset, memcpy - * - * cdef class IntList: # <<<<<<<<<<<<<< - * cdef int size - * cdef int increment +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":56 + * # 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_vtabstruct_8_cdec_sa_IntList { - void (*set)(struct __pyx_obj_8_cdec_sa_IntList *, int, int); - void (*_append)(struct __pyx_obj_8_cdec_sa_IntList *, int); - void (*_extend)(struct __pyx_obj_8_cdec_sa_IntList *, struct __pyx_obj_8_cdec_sa_IntList *); - void (*_extend_arr)(struct __pyx_obj_8_cdec_sa_IntList *, int *, int); - void (*_clear)(struct __pyx_obj_8_cdec_sa_IntList *); - void (*write_handle)(struct __pyx_obj_8_cdec_sa_IntList *, FILE *); - void (*read_handle)(struct __pyx_obj_8_cdec_sa_IntList *, FILE *); +struct __pyx_vtabstruct_3_sa_PhraseLocation { + int (*contains)(struct __pyx_obj_3_sa_PhraseLocation *, int); }; -static struct __pyx_vtabstruct_8_cdec_sa_IntList *__pyx_vtabptr_8_cdec_sa_IntList; +static struct __pyx_vtabstruct_3_sa_PhraseLocation *__pyx_vtabptr_3_sa_PhraseLocation; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 - * # May need to revisit if things get really tight, though. +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 * - * cdef class Alignment: # <<<<<<<<<<<<<< - * cdef IntList links - * cdef IntList sent_index + * + * cdef class Precomputation: # <<<<<<<<<<<<<< + * cdef int precompute_rank + * cdef int precompute_secondary_rank */ -struct __pyx_vtabstruct_8_cdec_sa_Alignment { - int (*link)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int); - PyObject *(*_unlink)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int *, int *); - int *(*_get_sent_links)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int *); +struct __pyx_vtabstruct_3_sa_Precomputation { + PyObject *(*read_map)(struct __pyx_obj_3_sa_Precomputation *, FILE *); + PyObject *(*write_map)(struct __pyx_obj_3_sa_Precomputation *, PyObject *, FILE *); }; -static struct __pyx_vtabstruct_8_cdec_sa_Alignment *__pyx_vtabptr_8_cdec_sa_Alignment; +static struct __pyx_vtabstruct_3_sa_Precomputation *__pyx_vtabptr_3_sa_Precomputation; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":9 @@ -1207,65 +1191,96 @@ static struct __pyx_vtabstruct_8_cdec_sa_Alignment *__pyx_vtabptr_8_cdec_sa_Alig * cdef int increment */ -struct __pyx_vtabstruct_8_cdec_sa_FloatList { - void (*set)(struct __pyx_obj_8_cdec_sa_FloatList *, int, float); - void (*write_handle)(struct __pyx_obj_8_cdec_sa_FloatList *, FILE *); - void (*read_handle)(struct __pyx_obj_8_cdec_sa_FloatList *, FILE *); +struct __pyx_vtabstruct_3_sa_FloatList { + void (*set)(struct __pyx_obj_3_sa_FloatList *, int, float); + void (*write_handle)(struct __pyx_obj_3_sa_FloatList *, FILE *); + void (*read_handle)(struct __pyx_obj_3_sa_FloatList *, FILE *); }; -static struct __pyx_vtabstruct_8_cdec_sa_FloatList *__pyx_vtabptr_8_cdec_sa_FloatList; +static struct __pyx_vtabstruct_3_sa_FloatList *__pyx_vtabptr_3_sa_FloatList; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 - * trie_node_to_map(edge.node, result, prefix, include_zeros) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 * - * cdef class TrieMap: # <<<<<<<<<<<<<< * - * cdef _Trie_Node** root + * cdef class VEB: # <<<<<<<<<<<<<< + * cdef _VEB* veb + * cdef int _findsucc(self, int i) */ -struct __pyx_vtabstruct_8_cdec_sa_TrieMap { - struct __pyx_t_8_cdec_sa__Trie_Node *(*_insert)(struct __pyx_obj_8_cdec_sa_TrieMap *, int *, int); - struct __pyx_t_8_cdec_sa__Trie_Node *(*_contains)(struct __pyx_obj_8_cdec_sa_TrieMap *, int *, int); +struct __pyx_vtabstruct_3_sa_VEB { + int (*_findsucc)(struct __pyx_obj_3_sa_VEB *, int); + int (*_insert)(struct __pyx_obj_3_sa_VEB *, int); + int (*_first)(struct __pyx_obj_3_sa_VEB *); }; -static struct __pyx_vtabstruct_8_cdec_sa_TrieMap *__pyx_vtabptr_8_cdec_sa_TrieMap; +static struct __pyx_vtabstruct_3_sa_VEB *__pyx_vtabptr_3_sa_VEB; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 - * from libc.string cimport memset, strcpy, strlen +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 + * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 * - * cdef class DataArray: # <<<<<<<<<<<<<< - * cdef word2id - * cdef id2word + * cdef class Alphabet: # <<<<<<<<<<<<<< + * cdef readonly StringMap terminals, nonterminals + * cdef int first_nonterminal, last_nonterminal */ -struct __pyx_vtabstruct_8_cdec_sa_DataArray { - void (*read_handle)(struct __pyx_obj_8_cdec_sa_DataArray *, FILE *); - void (*write_handle)(struct __pyx_obj_8_cdec_sa_DataArray *, FILE *); +struct __pyx_vtabstruct_3_sa_Alphabet { + int (*isvar)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*isword)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*getindex)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*setindex)(struct __pyx_obj_3_sa_Alphabet *, int, int); + int (*clearindex)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*match)(struct __pyx_obj_3_sa_Alphabet *, int, int); + char *(*tocat)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*fromcat)(struct __pyx_obj_3_sa_Alphabet *, char *); + char *(*tostring)(struct __pyx_obj_3_sa_Alphabet *, int); + int (*fromstring)(struct __pyx_obj_3_sa_Alphabet *, char *, int); }; -static struct __pyx_vtabstruct_8_cdec_sa_DataArray *__pyx_vtabptr_8_cdec_sa_DataArray; +static struct __pyx_vtabstruct_3_sa_Alphabet *__pyx_vtabptr_3_sa_Alphabet; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 - * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":201 * - * cdef class Alphabet: # <<<<<<<<<<<<<< - * cdef readonly StringMap terminals, nonterminals - * cdef int first_nonterminal, last_nonterminal + * + * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< + * '''This RuleFactory implements a caching + * method using TrieTable, which makes phrase */ -struct __pyx_vtabstruct_8_cdec_sa_Alphabet { - int (*isvar)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*isword)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*getindex)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*setindex)(struct __pyx_obj_8_cdec_sa_Alphabet *, int, int); - int (*clearindex)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*match)(struct __pyx_obj_8_cdec_sa_Alphabet *, int, int); - char *(*tocat)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*fromcat)(struct __pyx_obj_8_cdec_sa_Alphabet *, char *); - char *(*tostring)(struct __pyx_obj_8_cdec_sa_Alphabet *, int); - int (*fromstring)(struct __pyx_obj_8_cdec_sa_Alphabet *, char *, int); +struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory { + PyObject *(*set_idmap)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_DataArray *); + int *(*baeza_yates_helper)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *); + long (*compare_matchings_set)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_3_sa_Matching *, int, int); + long (*compare_matchings)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_t_3_sa_Matching *, struct __pyx_t_3_sa_Matching *, int, int); + int *(*merge_helper)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *); + void (*sort_phrase_loc)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_IntList *, struct __pyx_obj_3_sa_PhraseLocation *, struct __pyx_obj_3_sa_Phrase *); + PyObject *(*intersect_helper)(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); + PyObject *(*loc2str)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_PhraseLocation *); + struct __pyx_obj_3_sa_PhraseLocation *(*intersect)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_3_sa_Phrase *); + int (*find_fixpoint)(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); + PyObject *(*find_projection)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *); + int *(*int_arr_extend)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int *, int *, int *, int); + PyObject *(*extract_phrases)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int); + PyObject *(*create_alignments)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int *, int, PyObject *, PyObject *); + PyObject *(*extract)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_Phrase *, struct __pyx_t_3_sa_Matching *, int *, int); }; -static struct __pyx_vtabstruct_8_cdec_sa_Alphabet *__pyx_vtabptr_8_cdec_sa_Alphabet; +static struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *__pyx_vtabptr_3_sa_HieroCachingRuleFactory; + + +/* "/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_vtabstruct_3_sa_SuffixArray { + int (*__pyx___search_high)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); + int (*__pyx___search_low)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); + PyObject *(*__pyx___get_range)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int); + PyObject *(*__pyx___lookup_helper)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); +}; +static struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtabptr_3_sa_SuffixArray; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1425,42 +1440,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -1476,13 +1496,22 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) Py_INCREF(r); return r; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } return m->sq_item(o, i); } } +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } @@ -1495,11 +1524,10 @@ static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; + if (unlikely(PyList_Append(L, x) < 0)) return NULL; Py_INCREF(Py_None); return Py_None; /* this is just to have an accurate signature */ - } - else { + } else { PyObject *r, *m; m = __Pyx_GetAttrString(L, "append"); if (!m) return NULL; @@ -1515,9 +1543,11 @@ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ @@ -1532,6 +1562,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -1541,26 +1572,74 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje Py_DECREF(old); return 1; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_SetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } return m->sq_ass_item(o, i, v); } } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (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); /* 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 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_PyList_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_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2, + int is_tuple, int has_known_size, int decref_tuple); + +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_is_dict); +static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); + #if PY_VERSION_HEX < 0x02050000 #ifndef PyAnySet_CheckExact #define PyAnySet_CheckExact(ob) \ @@ -1594,15 +1673,9 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { #endif /* PyAnySet_CheckExact (<= Py2.4) */ #endif /* < Py2.5 */ -static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); - #if PY_MAJOR_VERSION >= 3 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; - if (unlikely(d == Py_None)) { - __Pyx_RaiseNoneIndexingError(); - return NULL; - } value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) @@ -1712,6 +1785,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #define __Pyx_Generator_USED #include <structmember.h> +#include <frameobject.h> typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD @@ -1724,13 +1798,22 @@ typedef struct { PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; + PyObject *yieldfrom; } __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*/ + static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ typedef struct { @@ -1761,76 +1844,80 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'libc.math' */ -/* Module declarations from '_cdec_sa' */ -static PyTypeObject *__pyx_ptype_8_cdec_sa_FloatList = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_IntList = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_StringMap = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_DataArray = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Alignment = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_BiLex = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_BitSetIterator = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_BitSet = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_VEBIterator = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_VEB = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_LCP = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Alphabet = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Phrase = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Rule = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_TrieMap = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Precomputation = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_SuffixArray = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_TrieNode = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_ExtendedTrieNode = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_TrieTable = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_PhraseLocation = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_Sampler = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa_HieroCachingRuleFactory = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa___pyx_scope_struct__compute_stats = 0; -static PyTypeObject *__pyx_ptype_8_cdec_sa___pyx_scope_struct_1_input = 0; -static int __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE; -static int __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS; -static int __pyx_v_8_cdec_sa_LOWER_MASK[32]; -static int __pyx_v_8_cdec_sa_INDEX_SHIFT; -static int __pyx_v_8_cdec_sa_INDEX_MASK; -static struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_8_cdec_sa_ALPHABET = 0; -static int __pyx_v_8_cdec_sa_PRECOMPUTE; -static int __pyx_v_8_cdec_sa_MERGE; -static int __pyx_v_8_cdec_sa_BAEZA_YATES; -static int __pyx_v_8_cdec_sa_EPSILON; -static float __pyx_f_8_cdec_sa_monitor_cpu(void); /*proto*/ -static struct __pyx_t_8_cdec_sa__node *__pyx_f_8_cdec_sa_new_node(int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *); /*proto*/ -static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *, int); /*proto*/ -static void __pyx_f_8_cdec_sa__init_lower_mask(void); /*proto*/ -static struct __pyx_t_8_cdec_sa__BitSet *__pyx_f_8_cdec_sa_new_BitSet(void); /*proto*/ -static int __pyx_f_8_cdec_sa_bitset_findsucc(struct __pyx_t_8_cdec_sa__BitSet *, int); /*proto*/ -static int __pyx_f_8_cdec_sa_bitset_insert(struct __pyx_t_8_cdec_sa__BitSet *, int); /*proto*/ -static int __pyx_f_8_cdec_sa_bitset_contains(struct __pyx_t_8_cdec_sa__BitSet *, int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_dec2bin(long); /*proto*/ -static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int); /*proto*/ -static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *, int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *); /*proto*/ -static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *, int); /*proto*/ -static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *, int); /*proto*/ -static int __pyx_f_8_cdec_sa_sym_setindex(int, int); /*proto*/ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_new_trie_node(void); /*proto*/ -static struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_f_8_cdec_sa_new_trie_edge(int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_free_trie_node(struct __pyx_t_8_cdec_sa__Trie_Node *); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie_Edge *); /*proto*/ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_find(struct __pyx_t_8_cdec_sa__Trie_Node *, int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_trie_node_data_append(struct __pyx_t_8_cdec_sa__Trie_Node *, int); /*proto*/ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_insert(struct __pyx_t_8_cdec_sa__Trie_Node *, int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Trie_Node *, PyObject *, PyObject *, int); /*proto*/ -static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Trie_Edge *, PyObject *, PyObject *, int); /*proto*/ -static void __pyx_f_8_cdec_sa_assign_matching(struct __pyx_t_8_cdec_sa_Matching *, int *, int, int, int *); /*proto*/ -static int *__pyx_f_8_cdec_sa_append_combined_matching(int *, struct __pyx_t_8_cdec_sa_Matching *, struct __pyx_t_8_cdec_sa_Matching *, int, int, int *); /*proto*/ -static int *__pyx_f_8_cdec_sa_extend_arr(int *, int *, int *, int); /*proto*/ -static int __pyx_f_8_cdec_sa_median(int, int, int); /*proto*/ -static void __pyx_f_8_cdec_sa_find_comparable_matchings(int, int, int *, int, int, int *, int *); /*proto*/ -#define __Pyx_MODULE_NAME "_cdec_sa" -int __pyx_module_is_main__cdec_sa = 0; - -/* Implementation of '_cdec_sa' */ +/* Module declarations from '_sa' */ +static PyTypeObject *__pyx_ptype_3_sa_Phrase = 0; +static PyTypeObject *__pyx_ptype_3_sa_Rule = 0; +static PyTypeObject *__pyx_ptype_3_sa_FloatList = 0; +static PyTypeObject *__pyx_ptype_3_sa_IntList = 0; +static PyTypeObject *__pyx_ptype_3_sa_StringMap = 0; +static PyTypeObject *__pyx_ptype_3_sa_DataArray = 0; +static PyTypeObject *__pyx_ptype_3_sa_Alignment = 0; +static PyTypeObject *__pyx_ptype_3_sa_BiLex = 0; +static PyTypeObject *__pyx_ptype_3_sa_BitSetIterator = 0; +static PyTypeObject *__pyx_ptype_3_sa_BitSet = 0; +static PyTypeObject *__pyx_ptype_3_sa_VEBIterator = 0; +static PyTypeObject *__pyx_ptype_3_sa_VEB = 0; +static PyTypeObject *__pyx_ptype_3_sa_LCP = 0; +static PyTypeObject *__pyx_ptype_3_sa_Alphabet = 0; +static PyTypeObject *__pyx_ptype_3_sa_TrieMap = 0; +static PyTypeObject *__pyx_ptype_3_sa_Precomputation = 0; +static PyTypeObject *__pyx_ptype_3_sa_SuffixArray = 0; +static PyTypeObject *__pyx_ptype_3_sa_TrieNode = 0; +static PyTypeObject *__pyx_ptype_3_sa_ExtendedTrieNode = 0; +static PyTypeObject *__pyx_ptype_3_sa_TrieTable = 0; +static PyTypeObject *__pyx_ptype_3_sa_PhraseLocation = 0; +static PyTypeObject *__pyx_ptype_3_sa_Sampler = 0; +static PyTypeObject *__pyx_ptype_3_sa_HieroCachingRuleFactory = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct__compute_stats = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_1___iter__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_2_input = 0; +static int __pyx_v_3_sa_MIN_BOTTOM_SIZE; +static int __pyx_v_3_sa_MIN_BOTTOM_BITS; +static int __pyx_v_3_sa_LOWER_MASK[32]; +static int __pyx_v_3_sa_INDEX_SHIFT; +static int __pyx_v_3_sa_INDEX_MASK; +static struct __pyx_obj_3_sa_Alphabet *__pyx_v_3_sa_ALPHABET = 0; +static int __pyx_v_3_sa_PRECOMPUTE; +static int __pyx_v_3_sa_MERGE; +static int __pyx_v_3_sa_BAEZA_YATES; +static int __pyx_v_3_sa_EPSILON; +static char *__pyx_f_3_sa_sym_tostring(int); /*proto*/ +static int __pyx_f_3_sa_sym_isvar(int); /*proto*/ +static int __pyx_f_3_sa_sym_getindex(int); /*proto*/ +static float __pyx_f_3_sa_monitor_cpu(void); /*proto*/ +static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int); /*proto*/ +static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *); /*proto*/ +static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *, int); /*proto*/ +static void __pyx_f_3_sa__init_lower_mask(void); /*proto*/ +static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void); /*proto*/ +static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *, int); /*proto*/ +static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *, int); /*proto*/ +static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *, int); /*proto*/ +static PyObject *__pyx_f_3_sa_dec2bin(long); /*proto*/ +static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int); /*proto*/ +static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *, int); /*proto*/ +static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *); /*proto*/ +static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *, int); /*proto*/ +static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *, int); /*proto*/ +static int __pyx_f_3_sa_sym_setindex(int, int); /*proto*/ +static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void); /*proto*/ +static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int); /*proto*/ +static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *); /*proto*/ +static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *); /*proto*/ +static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ +static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ +static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ +static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *, PyObject *, PyObject *, int); /*proto*/ +static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *, PyObject *, PyObject *, int); /*proto*/ +static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *, int *, int, int, int *); /*proto*/ +static int *__pyx_f_3_sa_append_combined_matching(int *, struct __pyx_t_3_sa_Matching *, struct __pyx_t_3_sa_Matching *, int, int, int *); /*proto*/ +static int *__pyx_f_3_sa_extend_arr(int *, int *, int *, int); /*proto*/ +static int __pyx_f_3_sa_median(int, int, int); /*proto*/ +static void __pyx_f_3_sa_find_comparable_matchings(int, int, int *, int, int, int *, int *); /*proto*/ +#define __Pyx_MODULE_NAME "_sa" +int __pyx_module_is_main__sa = 0; + +/* Implementation of '_sa' */ static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_range; @@ -1843,187 +1930,186 @@ static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_cmp; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_sorted; -static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_8_cdec_sa_9FloatList___cinit__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ -static void __pyx_pf_8_cdec_sa_9FloatList_2__dealloc__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_4__getitem__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_8_cdec_sa_9FloatList_6__setitem__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_9FloatList_8__len__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_10append(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, float __pyx_v_val); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_12write(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_14read(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_8_cdec_sa_7IntList___cinit__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_2__str__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_4index(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_6partition(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_8_doquicksort(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_10sort(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_12reset(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static void __pyx_pf_8_cdec_sa_7IntList_14__dealloc__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_16__getitem__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static int __pyx_pf_8_cdec_sa_7IntList_18__setitem__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_7IntList_20__len__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_22getSize(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_24append(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_26extend(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_28write(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_30read(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_8_cdec_sa_9StringMap___cinit__(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self); /* proto */ -static void __pyx_pf_8_cdec_sa_9StringMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, int __pyx_v_use_sent_id); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_9DataArray_2__len__(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_4getSentId(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_6getSent(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_8getSentPos(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_10get_id(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_12get_word(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_18read_binary(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_20write_binary(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id); /* proto */ -static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_8read_binary(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_12write_binary(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_16alignment(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_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_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_6get_e_id(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_8get_f_id(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_14get_score(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_16write_text(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_14BitSetIterator___next__(struct __pyx_obj_8_cdec_sa_BitSetIterator *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_6BitSet___cinit__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static void __pyx_pf_8_cdec_sa_6BitSet_2__dealloc__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_4__iter__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_6insert(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_8findsucc(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_10__str__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_12min(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_14max(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_6BitSet_16__len__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_6BitSet_18__contains__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11VEBIterator___next__(struct __pyx_obj_8_cdec_sa_VEBIterator *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_3VEB___cinit__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, int __pyx_v_size); /* proto */ -static void __pyx_pf_8_cdec_sa_3VEB_2__dealloc__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_4__iter__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_6insert(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_8findsucc(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_3VEB_10__len__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_3VEB_12__contains__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_8_cdec_sa_3LCP___cinit__(struct __pyx_obj_8_cdec_sa_LCP *__pyx_v_self, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sa); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_3LCP_2compute_stats(struct __pyx_obj_8_cdec_sa_LCP *__pyx_v_self, int __pyx_v_max_n); /* proto */ -static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self); /* proto */ -static void __pyx_pf_8_cdec_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_9terminals___get__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_2sym_tostring(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sym); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6sym_isvar(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sym); /* proto */ -static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */ -static void __pyx_pf_8_cdec_sa_6Phrase_2__dealloc__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_4__str__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci); /* proto */ +static PyObject *__pyx_pf_3_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ +static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +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); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, float __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_16__getitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_pf_3_sa_7IntList_18__setitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_7IntList_20__len__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_22getSize(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_24append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_26extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_28write(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_30read(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self); /* proto */ +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, int __pyx_v_use_sent_id); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_4getSentId(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_6getSent(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_8getSentPos(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_10get_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_12get_word(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_18read_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_20write_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_22write_enhanced_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_24write_enhanced(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_size); /* proto */ +static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n); /* proto */ +static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal); /* proto */ +static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */ +static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci); /* proto */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ #endif -static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_8_cdec_sa_6Phrase_24__len__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_26__getitem__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_28__iter__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children); /* proto */ -static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_f, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments); /* proto */ -static void __pyx_pf_8_cdec_sa_4Rule_2__dealloc__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ +static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +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); /* proto */ +static void __pyx_pf_3_sa_4Rule_2__dealloc__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static Py_hash_t __pyx_pf_3_sa_4Rule_4__hash__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_other); /* proto */ +static int __pyx_pf_3_sa_4Rule_6__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other); /* proto */ #endif -static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_10fmerge(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_f); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_s); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_3lhs___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_4Rule_3lhs_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_1f___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_1e___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_15word_alignments___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_4__del__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_7TrieMap___cinit__(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size); /* proto */ -static void __pyx_pf_8_cdec_sa_7TrieMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */ -static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec_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_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sarray); /* proto */ -static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_6getSent(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_14write_text(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_word, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto */ -static int __pyx_pf_8_cdec_sa_8TrieNode___cinit__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_8TrieNode_8children___get__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_8TrieNode_8children_2__set__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_8TrieNode_8children_4__del__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_8extended___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_5count___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_9TrieTable_5count_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_4root___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_9TrieTable_4root_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_8_cdec_sa_9TrieTable_4root_4__del__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(struct __pyx_obj_8_cdec_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_8_cdec_sa_7Sampler___cinit__(struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsarray); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_self, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_phrase_location); /* proto */ -static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_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_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_sampler); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_8_cdec_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_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist); /* proto */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_models); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_8__iadd__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_10fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_f); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_12arity(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_14__str__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_6scores___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_4Rule_6scores_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_3lhs___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_4Rule_3lhs_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_15word_alignments___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_4Rule_15word_alignments_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_4Rule_15word_alignments_4__del__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size); /* proto */ +static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_4getSentId(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_6getSent(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_8getSentPos(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_12q3sort(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); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_16read_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_18write_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_22lookup(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); /* proto */ +static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable___cinit__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_models); /* 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["; @@ -2116,12 +2202,13 @@ static char __pyx_k_128[] = "Inside edges of following subphrase are not tight"; static char __pyx_k_129[] = "Subphrase [%d, %d] failed integrity check"; static char __pyx_k_130[] = "Didn't extract anything from [%d, %d] -> [%d, %d]"; static char __pyx_k_131[] = "Unable to extract basic phrase"; -static char __pyx_k_134[] = "/Users/vchahun/Sandbox/cdec/python/src/sa/_cdec_sa.pyx"; +static char __pyx_k_134[] = "/Users/vchahun/Sandbox/cdec/python/src/sa/_sa.pyx"; static char __pyx_k_135[] = "cdec.sa"; static char __pyx_k_139[] = "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi"; -static char __pyx_k_144[] = "*EPS*"; +static char __pyx_k_140[] = "*EPS*"; static char __pyx_k__gc[] = "gc"; static char __pyx_k__sa[] = "sa"; +static char __pyx_k___sa[] = "_sa"; static char __pyx_k__arr[] = "arr"; static char __pyx_k__cmp[] = "cmp"; static char __pyx_k__col[] = "col"; @@ -2133,7 +2220,6 @@ static char __pyx_k__low[] = "low"; static char __pyx_k__map[] = "map"; static char __pyx_k__pad[] = "pad"; static char __pyx_k__res[] = "res"; -static char __pyx_k__sym[] = "sym"; static char __pyx_k__zip[] = "zip"; static char __pyx_k__NULL[] = "NULL"; static char __pyx_k__dist[] = "dist"; @@ -2197,7 +2283,6 @@ static char __pyx_k__GzipFile[] = "GzipFile"; static char __pyx_k____exit__[] = "__exit__"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k___cdec_sa[] = "_cdec_sa"; static char __pyx_k___columns[] = "_columns"; static char __pyx_k__arr_high[] = "arr_high"; static char __pyx_k__category[] = "category"; @@ -2231,7 +2316,6 @@ static char __pyx_k__iteritems[] = "iteritems"; static char __pyx_k__partition[] = "partition"; static char __pyx_k__reachable[] = "reachable"; static char __pyx_k__read_text[] = "read_text"; -static char __pyx_k__sym_isvar[] = "sym_isvar"; static char __pyx_k__use_index[] = "use_index"; static char __pyx_k__IndexError[] = "IndexError"; static char __pyx_k__ValueError[] = "ValueError"; @@ -2256,7 +2340,6 @@ static char __pyx_k__use_sent_id[] = "use_sent_id"; static char __pyx_k___doquicksort[] = "_doquicksort"; static char __pyx_k__gzip_or_text[] = "gzip_or_text"; static char __pyx_k__min_gap_size[] = "min_gap_size"; -static char __pyx_k__sym_tostring[] = "sym_tostring"; static char __pyx_k__StopIteration[] = "StopIteration"; static char __pyx_k__alphabet_size[] = "alphabet_size"; static char __pyx_k__tight_phrases[] = "tight_phrases"; @@ -2312,7 +2395,7 @@ static PyObject *__pyx_kp_s_134; static PyObject *__pyx_kp_s_135; static PyObject *__pyx_kp_s_139; static PyObject *__pyx_kp_s_14; -static PyObject *__pyx_kp_s_144; +static PyObject *__pyx_kp_s_140; static PyObject *__pyx_kp_s_18; static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_s_22; @@ -2380,9 +2463,9 @@ static PyObject *__pyx_n_s____enter__; static PyObject *__pyx_n_s____exit__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___cdec_sa; static PyObject *__pyx_n_s___columns; static PyObject *__pyx_n_s___doquicksort; +static PyObject *__pyx_n_s___sa; static PyObject *__pyx_n_s__advance; static PyObject *__pyx_n_s__alignment; static PyObject *__pyx_n_s__alphabet_size; @@ -2508,10 +2591,7 @@ static PyObject *__pyx_n_s__stats; static PyObject *__pyx_n_s__stop; static PyObject *__pyx_n_s__string; static PyObject *__pyx_n_s__suffix_link; -static PyObject *__pyx_n_s__sym; static PyObject *__pyx_n_s__sym_fromstring; -static PyObject *__pyx_n_s__sym_isvar; -static PyObject *__pyx_n_s__sym_tostring; static PyObject *__pyx_n_s__terminal; static PyObject *__pyx_n_s__tight_phrases; static PyObject *__pyx_n_s__toMap; @@ -2589,14 +2669,10 @@ static PyObject *__pyx_k_tuple_120; static PyObject *__pyx_k_tuple_132; static PyObject *__pyx_k_tuple_136; static PyObject *__pyx_k_tuple_137; -static PyObject *__pyx_k_tuple_140; -static PyObject *__pyx_k_tuple_142; static PyObject *__pyx_k_codeobj_133; static PyObject *__pyx_k_codeobj_138; -static PyObject *__pyx_k_codeobj_141; -static PyObject *__pyx_k_codeobj_143; -/* "_cdec_sa.pyx":5 +/* "_sa.pyx":5 * import gzip * * cdef float monitor_cpu(): # <<<<<<<<<<<<<< @@ -2604,7 +2680,7 @@ static PyObject *__pyx_k_codeobj_143; * resource.getrusage(resource.RUSAGE_SELF).ru_stime) */ -static float __pyx_f_8_cdec_sa_monitor_cpu(void) { +static float __pyx_f_3_sa_monitor_cpu(void) { float __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2617,7 +2693,7 @@ static float __pyx_f_8_cdec_sa_monitor_cpu(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("monitor_cpu", 0); - /* "_cdec_sa.pyx":6 + /* "_sa.pyx":6 * * cdef float monitor_cpu(): * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ # <<<<<<<<<<<<<< @@ -2647,7 +2723,7 @@ static float __pyx_f_8_cdec_sa_monitor_cpu(void) { __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_cdec_sa.pyx":7 + /* "_sa.pyx":7 * cdef float monitor_cpu(): * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ * resource.getrusage(resource.RUSAGE_SELF).ru_stime) # <<<<<<<<<<<<<< @@ -2692,7 +2768,7 @@ static float __pyx_f_8_cdec_sa_monitor_cpu(void) { __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("_cdec_sa.monitor_cpu", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.monitor_cpu", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2700,29 +2776,28 @@ static float __pyx_f_8_cdec_sa_monitor_cpu(void) { } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyMethodDef __pyx_mdef_8_cdec_sa_1gzip_or_text = {__Pyx_NAMESTR("gzip_or_text"), (PyCFunction)__pyx_pw_8_cdec_sa_1gzip_or_text, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_8_cdec_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_1gzip_or_text = {__Pyx_NAMESTR("gzip_or_text"), (PyCFunction)__pyx_pw_3_sa_1gzip_or_text, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gzip_or_text (wrapper)", 0); - __pyx_self = __pyx_self; assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_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.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_gzip_or_text(__pyx_self, ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_gzip_or_text(__pyx_self, ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec_sa.pyx":9 +/* "_sa.pyx":9 * resource.getrusage(resource.RUSAGE_SELF).ru_stime) * * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< @@ -2730,7 +2805,7 @@ static PyObject *__pyx_pw_8_cdec_sa_1gzip_or_text(PyObject *__pyx_self, PyObject * return gzip.GzipFile(filename) */ -static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2742,7 +2817,7 @@ static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gzip_or_text", 0); - /* "_cdec_sa.pyx":10 + /* "_sa.pyx":10 * * def gzip_or_text(char* filename): * if filename.endswith('.gz'): # <<<<<<<<<<<<<< @@ -2755,7 +2830,7 @@ static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_s __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_cdec_sa.pyx":11 + /* "_sa.pyx":11 * def gzip_or_text(char* filename): * if filename.endswith('.gz'): * return gzip.GzipFile(filename) # <<<<<<<<<<<<<< @@ -2786,7 +2861,7 @@ static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_s } /*else*/ { - /* "_cdec_sa.pyx":13 + /* "_sa.pyx":13 * return gzip.GzipFile(filename) * else: * return open(filename) # <<<<<<<<<<<<<< @@ -2816,7 +2891,7 @@ static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_s __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2825,16 +2900,16 @@ static PyObject *__pyx_pf_8_cdec_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_s } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,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; @@ -2867,18 +2942,6 @@ static int __pyx_pw_8_cdec_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyOb if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[0]) { - } else { - __pyx_v_size = ((int)0); - } - if (values[1]) { - } else { - __pyx_v_increment = ((int)1); - } - if (values[2]) { - } else { - __pyx_v_initial_len = ((int)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2908,11 +2971,11 @@ static int __pyx_pw_8_cdec_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyOb __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.FloatList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList___cinit__(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __pyx_r = __pyx_pf_3_sa_9FloatList___cinit__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2925,7 +2988,7 @@ static int __pyx_pw_8_cdec_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyOb * size = initial_len */ -static int __pyx_pf_8_cdec_sa_9FloatList___cinit__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { +static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_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; @@ -3004,11 +3067,11 @@ static int __pyx_pf_8_cdec_sa_9FloatList___cinit__(struct __pyx_obj_8_cdec_sa_Fl } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_9FloatList_2__dealloc__(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self)); + __pyx_pf_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -3020,7 +3083,7 @@ static void __pyx_pw_8_cdec_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_9FloatList_2__dealloc__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self) { +static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -3037,12 +3100,12 @@ static void __pyx_pf_8_cdec_sa_9FloatList_2__dealloc__(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_4__getitem__(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3055,7 +3118,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_5__getitem__(PyObject *__pyx_v_se * if i<0: */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_4__getitem__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_v_j = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3192,7 +3255,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_4__getitem__(struct __pyx_obj_8_c __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_j); @@ -3209,7 +3272,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_4__getitem__(struct __pyx_obj_8_c * if i<0: */ -static void __pyx_f_8_cdec_sa_9FloatList_set(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, int __pyx_v_i, float __pyx_v_v) { +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) { int __pyx_v_j; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3321,18 +3384,18 @@ static void __pyx_f_8_cdec_sa_9FloatList_set(struct __pyx_obj_8_cdec_sa_FloatLis __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_cdec_sa.FloatList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.FloatList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_8_cdec_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_6__setitem__(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -3345,7 +3408,7 @@ static int __pyx_pw_8_cdec_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, Py * */ -static int __pyx_pf_8_cdec_sa_9FloatList_6__setitem__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3364,12 +3427,12 @@ static int __pyx_pf_8_cdec_sa_9FloatList_6__setitem__(struct __pyx_obj_8_cdec_sa */ __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 = 44; __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); + ((struct __pyx_vtabstruct_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.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3377,12 +3440,12 @@ static int __pyx_pf_8_cdec_sa_9FloatList_6__setitem__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_8__len__(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9FloatList_8__len__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3395,7 +3458,7 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_9FloatList_9__len__(PyObject *__pyx_v_self) * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_9FloatList_8__len__(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); @@ -3417,8 +3480,8 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_9FloatList_8__len__(struct __pyx_obj_8_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +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) { float __pyx_v_val; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -3428,11 +3491,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_11append(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_10append(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); + __pyx_r = __pyx_pf_3_sa_9FloatList_10append(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3445,7 +3508,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_11append(PyObject *__pyx_v_self, * self.size = self.size + self.increment */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_10append(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, float __pyx_v_val) { +static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3514,7 +3577,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_10append(struct __pyx_obj_8_cdec_ * fwrite(self.arr, sizeof(float), self.len, f) */ -static void __pyx_f_8_cdec_sa_9FloatList_write_handle(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_handle", 0); @@ -3540,8 +3603,8 @@ static void __pyx_f_8_cdec_sa_9FloatList_write_handle(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -3551,11 +3614,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_13write(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_12write(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9FloatList_12write(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3568,7 +3631,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_13write(PyObject *__pyx_v_self, P * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_12write(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3590,7 +3653,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_12write(struct __pyx_obj_8_cdec_s * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":64 * f = fopen(filename, "w") @@ -3615,7 +3678,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_12write(struct __pyx_obj_8_cdec_s * fread(&(self.len), sizeof(float), 1, f) */ -static void __pyx_f_8_cdec_sa_9FloatList_read_handle(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_handle", 0); @@ -3668,8 +3731,8 @@ static void __pyx_f_8_cdec_sa_9FloatList_read_handle(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -3679,11 +3742,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_15read(PyObject *__pyx_v_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9FloatList_14read(((struct __pyx_obj_8_cdec_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9FloatList_14read(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3696,7 +3759,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9FloatList_15read(PyObject *__pyx_v_self, Py * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_9FloatList_14read(struct __pyx_obj_8_cdec_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3717,7 +3780,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_14read(struct __pyx_obj_8_cdec_sa * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":77 * f = fopen(filename, "r") @@ -3733,16 +3796,16 @@ static PyObject *__pyx_pf_8_cdec_sa_9FloatList_14read(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { int __pyx_v_size; int __pyx_v_increment; int __pyx_v_initial_len; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,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; @@ -3775,18 +3838,6 @@ static int __pyx_pw_8_cdec_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObje 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 = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[0]) { - } else { - __pyx_v_size = ((int)0); - } - if (values[1]) { - } else { - __pyx_v_increment = ((int)1); - } - if (values[2]) { - } else { - __pyx_v_initial_len = ((int)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3816,11 +3867,11 @@ static int __pyx_pw_8_cdec_sa_7IntList_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[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList___cinit__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -3833,7 +3884,7 @@ static int __pyx_pw_8_cdec_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObje * size = initial_len */ -static int __pyx_pf_8_cdec_sa_7IntList___cinit__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3912,12 +3963,12 @@ static int __pyx_pf_8_cdec_sa_7IntList___cinit__(struct __pyx_obj_8_cdec_sa_IntL } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_3__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_2__str__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_7IntList_2__str__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3930,7 +3981,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_3__str__(PyObject *__pyx_v_self) { * ret = "IntList[" */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_2__str__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_v_ret = NULL; int __pyx_v_idx; PyObject *__pyx_r = NULL; @@ -4076,7 +4127,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_2__str__(struct __pyx_obj_8_cdec_sa __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); @@ -4086,12 +4137,12 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_2__str__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { +static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("index (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_4index(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_val)); + __pyx_r = __pyx_pf_3_sa_7IntList_4index(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4104,7 +4155,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_5index(PyObject *__pyx_v_self, PyOb * for i in range(self.len): */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_4index(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val) { +static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val) { unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4180,7 +4231,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_4index(struct __pyx_obj_8_cdec_sa_I __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4189,15 +4240,15 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_4index(struct __pyx_obj_8_cdec_sa_I } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,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; @@ -4211,12 +4262,10 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_7partition(PyObject *__pyx_v_self, kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); - if (likely(values[1])) kw_args--; + 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 = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -4237,11 +4286,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_7partition(PyObject *__pyx_v_self, __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_6partition(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __pyx_r = __pyx_pf_3_sa_7IntList_6partition(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4254,7 +4303,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_7partition(PyObject *__pyx_v_self, * bottom = start-1 */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_6partition(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { +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) { PyObject *__pyx_v_pivot = NULL; PyObject *__pyx_v_bottom = NULL; PyObject *__pyx_v_top = NULL; @@ -4556,7 +4605,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_6partition(struct __pyx_obj_8_cdec_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pivot); @@ -4568,15 +4617,15 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_6partition(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,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; @@ -4590,12 +4639,10 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_9_doquicksort(PyObject *__pyx_v_sel kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); - if (likely(values[1])) kw_args--; + 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 = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -4616,11 +4663,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_9_doquicksort(PyObject *__pyx_v_sel __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_8_doquicksort(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -4633,7 +4680,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_9_doquicksort(PyObject *__pyx_v_sel * split = self.partition(start,end) */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_8_doquicksort(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_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) { PyObject *__pyx_v_split = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4755,7 +4802,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_8_doquicksort(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_split); @@ -4765,12 +4812,12 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_8_doquicksort(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sort (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_10sort(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_7IntList_10sort(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4783,7 +4830,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTH * */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_10sort(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4825,7 +4872,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_10sort(struct __pyx_obj_8_cdec_sa_I __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4834,12 +4881,12 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_10sort(struct __pyx_obj_8_cdec_sa_I } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_12reset(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_7IntList_12reset(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4852,7 +4899,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_13reset(PyObject *__pyx_v_self, CYT * */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_12reset(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset", 0); @@ -4873,11 +4920,11 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_12reset(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_7IntList_14__dealloc__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_pf_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -4889,7 +4936,7 @@ static void __pyx_pw_8_cdec_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_7IntList_14__dealloc__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -4906,12 +4953,12 @@ static void __pyx_pf_8_cdec_sa_7IntList_14__dealloc__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pw_3_sa_7IntList_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_16__getitem__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __pyx_r = __pyx_pf_3_sa_7IntList_16__getitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4924,7 +4971,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_17__getitem__(PyObject *__pyx_v_sel * if isinstance(index, int): */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_16__getitem__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pf_3_sa_7IntList_16__getitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -5298,7 +5345,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_16__getitem__(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_cdec_sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -5315,7 +5362,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_16__getitem__(struct __pyx_obj_8_cd * if i<0: */ -static void __pyx_f_8_cdec_sa_7IntList_set(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_i, int __pyx_v_val) { +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) { int __pyx_v_j; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5427,18 +5474,18 @@ static void __pyx_f_8_cdec_sa_7IntList_set(struct __pyx_obj_8_cdec_sa_IntList *_ __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_cdec_sa.IntList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.IntList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_7IntList_19__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_8_cdec_sa_7IntList_19__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pw_3_sa_7IntList_19__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_3_sa_7IntList_19__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_8_cdec_sa_7IntList_18__setitem__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __pyx_r = __pyx_pf_3_sa_7IntList_18__setitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5451,7 +5498,7 @@ static int __pyx_pw_8_cdec_sa_7IntList_19__setitem__(PyObject *__pyx_v_self, PyO * */ -static int __pyx_pf_8_cdec_sa_7IntList_18__setitem__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pf_3_sa_7IntList_18__setitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5470,12 +5517,12 @@ static int __pyx_pf_8_cdec_sa_7IntList_18__setitem__(struct __pyx_obj_8_cdec_sa_ */ __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 = 119; __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 = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); + ((struct __pyx_vtabstruct_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.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5483,12 +5530,12 @@ static int __pyx_pf_8_cdec_sa_7IntList_18__setitem__(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_7IntList_21__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_7IntList_21__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_3_sa_7IntList_21__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_7IntList_21__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_20__len__(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_7IntList_20__len__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5501,7 +5548,7 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_7IntList_21__len__(PyObject *__pyx_v_self) * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_7IntList_20__len__(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_7IntList_20__len__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); @@ -5523,12 +5570,12 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_7IntList_20__len__(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_23getSize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_23getSize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3_sa_7IntList_23getSize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_23getSize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSize (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_22getSize(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_7IntList_22getSize(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5541,7 +5588,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_23getSize(PyObject *__pyx_v_self, C * */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_22getSize(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_22getSize(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5568,7 +5615,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_22getSize(struct __pyx_obj_8_cdec_s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.IntList.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5577,8 +5624,8 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_22getSize(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_25append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_25append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +static PyObject *__pyx_pw_3_sa_7IntList_25append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_25append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { int __pyx_v_val; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -5588,11 +5635,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_25append(PyObject *__pyx_v_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_24append(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __pyx_r = __pyx_pf_3_sa_7IntList_24append(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5605,7 +5652,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_25append(PyObject *__pyx_v_self, Py * */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_24append(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_val) { +static PyObject *__pyx_pf_3_sa_7IntList_24append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append", 0); @@ -5617,7 +5664,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_24append(struct __pyx_obj_8_cdec_sa * * cdef void _append(self, int val): */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); + ((struct __pyx_vtabstruct_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); @@ -5633,7 +5680,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_24append(struct __pyx_obj_8_cdec_sa * self.size = self.size + self.increment */ -static void __pyx_f_8_cdec_sa_7IntList__append(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int __pyx_v_val) { +static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("_append", 0); @@ -5691,12 +5738,12 @@ static void __pyx_f_8_cdec_sa_7IntList__append(struct __pyx_obj_8_cdec_sa_IntLis } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_27extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_27extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_3_sa_7IntList_27extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_27extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("extend (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_26extend(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_3_sa_7IntList_26extend(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5709,7 +5756,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_27extend(PyObject *__pyx_v_self, Py * */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_26extend(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_3_sa_7IntList_26extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5725,17 +5772,17 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_26extend(struct __pyx_obj_8_cdec_sa * * cdef void _extend(self, IntList other): */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_other; __Pyx_INCREF(__pyx_t_1); - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1)); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend(__pyx_v_self, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1)); __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_AddTraceback("_cdec_sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5751,7 +5798,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_26extend(struct __pyx_obj_8_cdec_sa * */ -static void __pyx_f_8_cdec_sa_7IntList__extend(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_other) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_extend", 0); @@ -5762,7 +5809,7 @@ static void __pyx_f_8_cdec_sa_7IntList__extend(struct __pyx_obj_8_cdec_sa_IntLis * * cdef void _extend_arr(self, int* other, int other_len): */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend_arr(__pyx_v_self, __pyx_v_other->arr, __pyx_v_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); __Pyx_RefNannyFinishContext(); } @@ -5775,7 +5822,7 @@ static void __pyx_f_8_cdec_sa_7IntList__extend(struct __pyx_obj_8_cdec_sa_IntLis * self.size = self.len + other_len */ -static void __pyx_f_8_cdec_sa_7IntList__extend_arr(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, int *__pyx_v_other, int __pyx_v_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) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("_extend_arr", 0); @@ -5840,7 +5887,7 @@ static void __pyx_f_8_cdec_sa_7IntList__extend_arr(struct __pyx_obj_8_cdec_sa_In * self.len = 0 */ -static void __pyx_f_8_cdec_sa_7IntList__clear(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self) { +static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_clear", 0); @@ -5891,7 +5938,7 @@ static void __pyx_f_8_cdec_sa_7IntList__clear(struct __pyx_obj_8_cdec_sa_IntList * fwrite(self.arr, sizeof(int), self.len, f) */ -static void __pyx_f_8_cdec_sa_7IntList_write_handle(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_handle", 0); @@ -5917,8 +5964,8 @@ static void __pyx_f_8_cdec_sa_7IntList_write_handle(struct __pyx_obj_8_cdec_sa_I } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_29write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_29write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_7IntList_29write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_29write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -5928,11 +5975,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_29write(PyObject *__pyx_v_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_28write(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_7IntList_28write(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5945,7 +5992,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_29write(PyObject *__pyx_v_self, PyO * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_28write(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_7IntList_28write(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5967,7 +6014,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_28write(struct __pyx_obj_8_cdec_sa_ * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":164 * f = fopen(filename, "w") @@ -5992,7 +6039,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_28write(struct __pyx_obj_8_cdec_sa_ * fread(&(self.len), sizeof(int), 1, f) */ -static void __pyx_f_8_cdec_sa_7IntList_read_handle(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_handle", 0); @@ -6045,8 +6092,8 @@ static void __pyx_f_8_cdec_sa_7IntList_read_handle(struct __pyx_obj_8_cdec_sa_In } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_31read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7IntList_31read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_7IntList_31read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_31read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -6056,11 +6103,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_31read(PyObject *__pyx_v_self, PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7IntList_30read(((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_7IntList_30read(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6073,7 +6120,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7IntList_31read(PyObject *__pyx_v_self, PyOb * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_7IntList_30read(struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_7IntList_30read(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6094,7 +6141,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_30read(struct __pyx_obj_8_cdec_sa_I * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":177 * f = fopen(filename, "r") @@ -6110,15 +6157,15 @@ static PyObject *__pyx_pf_8_cdec_sa_7IntList_30read(struct __pyx_obj_8_cdec_sa_I } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { 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_8_cdec_sa_9StringMap___cinit__(((struct __pyx_obj_8_cdec_sa_StringMap *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9StringMap___cinit__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6131,7 +6178,7 @@ static int __pyx_pw_8_cdec_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyOb * */ -static int __pyx_pf_8_cdec_sa_9StringMap___cinit__(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self) { +static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); @@ -6151,11 +6198,11 @@ static int __pyx_pf_8_cdec_sa_9StringMap___cinit__(struct __pyx_obj_8_cdec_sa_St } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_9StringMap_2__dealloc__(((struct __pyx_obj_8_cdec_sa_StringMap *)__pyx_v_self)); + __pyx_pf_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -6167,7 +6214,7 @@ static void __pyx_pw_8_cdec_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_9StringMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self) { +static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -6191,7 +6238,7 @@ static void __pyx_pf_8_cdec_sa_9StringMap_2__dealloc__(struct __pyx_obj_8_cdec_s * */ -static char *__pyx_f_8_cdec_sa_9StringMap_word(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self, int __pyx_v_i) { +static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, int __pyx_v_i) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("word", 0); @@ -6219,7 +6266,7 @@ static char *__pyx_f_8_cdec_sa_9StringMap_word(struct __pyx_obj_8_cdec_sa_String * return stringmap_index(self.vocab, s) */ -static int __pyx_f_8_cdec_sa_9StringMap_index(struct __pyx_obj_8_cdec_sa_StringMap *__pyx_v_self, char *__pyx_v_s) { +static int __pyx_f_3_sa_9StringMap_index(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, char *__pyx_v_s) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("index", 0); @@ -6239,16 +6286,16 @@ static int __pyx_f_8_cdec_sa_9StringMap_index(struct __pyx_obj_8_cdec_sa_StringM } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; int __pyx_v_use_sent_id; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__use_sent_id,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__use_sent_id,0}; PyObject* values[3] = {0,0,0}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":17 @@ -6291,10 +6338,6 @@ static int __pyx_pw_8_cdec_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyOb if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[2]) { - } else { - __pyx_v_use_sent_id = ((int)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -6316,16 +6359,16 @@ static int __pyx_pw_8_cdec_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyOb __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, 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.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray___cinit__(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_use_sent_id); + __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_use_sent_id); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, int __pyx_v_use_sent_id) { +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, int __pyx_v_use_sent_id) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6382,12 +6425,12 @@ static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_Da * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_k_tuple_10), 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_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_10), 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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->data = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":21 @@ -6397,12 +6440,12 @@ static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_Da * self.sent_index = IntList(1000,1000) * self.use_sent_id = use_sent_id */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), 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_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), 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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_id = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":22 @@ -6412,12 +6455,12 @@ static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_Da * self.use_sent_id = use_sent_id * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), 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_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), 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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":23 @@ -6500,7 +6543,7 @@ static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_Da __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6508,12 +6551,12 @@ static int __pyx_pf_8_cdec_sa_9DataArray___cinit__(struct __pyx_obj_8_cdec_sa_Da } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_2__len__(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9DataArray_2__len__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6526,7 +6569,7 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_9DataArray_3__len__(PyObject *__pyx_v_self) * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_9DataArray_2__len__(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6554,7 +6597,7 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_9DataArray_2__len__(struct __pyx_obj_8_cdec goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6562,12 +6605,12 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_9DataArray_2__len__(struct __pyx_obj_8_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_3_sa_9DataArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSentId (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_4getSentId(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_9DataArray_4getSentId(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6580,7 +6623,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_5getSentId(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_4getSentId(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9DataArray_4getSentId(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -6609,7 +6652,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_4getSentId(struct __pyx_obj_8_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.DataArray.getSentId", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.getSentId", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6618,12 +6661,12 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_4getSentId(struct __pyx_obj_8_cde } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_3_sa_9DataArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSent (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_6getSent(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_9DataArray_6getSent(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6636,7 +6679,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_7getSent(PyObject *__pyx_v_self, * sent = [] */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_6getSent(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9DataArray_6getSent(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_sent = NULL; @@ -6747,7 +6790,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_6getSent(struct __pyx_obj_8_cdec_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.DataArray.getSent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.getSent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_sent); @@ -6758,12 +6801,12 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_6getSent(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pw_3_sa_9DataArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSentPos (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_8getSentPos(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __pyx_r = __pyx_pf_3_sa_9DataArray_8getSentPos(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6776,7 +6819,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_9getSentPos(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_8getSentPos(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_3_sa_9DataArray_8getSentPos(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -6810,7 +6853,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_8getSentPos(struct __pyx_obj_8_cd __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.DataArray.getSentPos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.getSentPos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6819,12 +6862,12 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_8getSentPos(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_11get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_11get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { +static PyObject *__pyx_pw_3_sa_9DataArray_11get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_11get_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_8_cdec_sa_9DataArray_10get_id(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); + __pyx_r = __pyx_pf_3_sa_9DataArray_10get_id(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6837,7 +6880,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_11get_id(PyObject *__pyx_v_self, * self.word2id[word] = len(self.id2word) */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_10get_id(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { +static PyObject *__pyx_pf_3_sa_9DataArray_10get_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -6908,7 +6951,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_10get_id(struct __pyx_obj_8_cdec_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6917,12 +6960,12 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_10get_id(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_13get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_13get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id) { +static PyObject *__pyx_pw_3_sa_9DataArray_13get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_13get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_word (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_12get_word(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_id)); + __pyx_r = __pyx_pf_3_sa_9DataArray_12get_word(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_id)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6935,7 +6978,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_13get_word(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_12get_word(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id) { +static PyObject *__pyx_pf_3_sa_9DataArray_12get_word(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6962,7 +7005,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_12get_word(struct __pyx_obj_8_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.DataArray.get_word", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.get_word", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6971,8 +7014,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_12get_word(struct __pyx_obj_8_cde } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -6982,11 +7025,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_15write_text(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_14write_text(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9DataArray_14write_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -6999,7 +7042,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_15write_text(PyObject *__pyx_v_se * for w_id in self.data: */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_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; @@ -7081,10 +7124,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_c 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++; + #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 = 58; __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++; + #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 = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) { @@ -7201,7 +7252,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_c * if w_id > 1: */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 57; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_12); @@ -7281,7 +7332,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_c __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_cdec_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -7292,8 +7343,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_14write_text(struct __pyx_obj_8_c } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -7303,11 +7354,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_17read_text(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_16read_text(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9DataArray_16read_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -7320,7 +7371,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_17read_text(PyObject *__pyx_v_sel * with gzip_or_text(filename) as fp: */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { int __pyx_v_word_count; PyObject *__pyx_v_fp = NULL; PyObject *__pyx_v_line_num = NULL; @@ -7419,10 +7470,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cd 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_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __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_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_3 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_3)) { @@ -7484,10 +7543,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cd for (;;) { if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_10)) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_10, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_10)) { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_10, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_3 = __pyx_t_12(__pyx_t_10); if (unlikely(!__pyx_t_3)) { @@ -7651,7 +7718,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cd * self.sent_index.append(word_count) */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); @@ -7732,7 +7799,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("_cdec_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fp); @@ -7745,8 +7812,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_16read_text(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_19read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_19read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_9DataArray_19read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_19read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -7756,11 +7823,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_19read_binary(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_18read_binary(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9DataArray_18read_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -7773,7 +7840,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_19read_binary(PyObject *__pyx_v_s * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_18read_binary(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9DataArray_18read_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7795,7 +7862,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_18read_binary(struct __pyx_obj_8_ * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":85 * f = fopen(filename, "r") @@ -7820,7 +7887,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_18read_binary(struct __pyx_obj_8_ * cdef unsigned i */ -static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_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; @@ -7844,7 +7911,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_ * self.sent_index.read_handle(f) * self.sent_id.read_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); + ((struct __pyx_vtabstruct_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":93 * cdef bytes py_word @@ -7853,7 +7920,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_ * self.sent_id.read_handle(f) * fread(&(num_words), sizeof(int), 1, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":94 * self.data.read_handle(f) @@ -7862,7 +7929,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_ * fread(&(num_words), sizeof(int), 1, f) * for i in range(num_words): */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->read_handle(__pyx_v_self->sent_id, __pyx_v_f); + ((struct __pyx_vtabstruct_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":95 * self.sent_index.read_handle(f) @@ -8001,7 +8068,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_cdec_sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_word); __Pyx_RefNannyFinishContext(); @@ -8015,7 +8082,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_read_handle(struct __pyx_obj_8_cdec_sa_ * cdef int num_words */ -static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { +static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { int __pyx_v_word_len; int __pyx_v_num_words; char *__pyx_v_c_word; @@ -8038,7 +8105,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); + ((struct __pyx_vtabstruct_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":114 * cdef char* c_word @@ -8047,7 +8114,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa * self.sent_id.write_handle(f) * num_words = len(self.id2word) - 2 */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":115 * self.data.write_handle(f) @@ -8056,7 +8123,7 @@ static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa * num_words = len(self.id2word) - 2 * fwrite(&(num_words), sizeof(int), 1, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->write_handle(__pyx_v_self->sent_id, __pyx_v_f); + ((struct __pyx_vtabstruct_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":116 * self.sent_index.write_handle(f) @@ -8101,10 +8168,18 @@ static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa 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++; + #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 = 118; __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++; + #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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) { @@ -8163,15 +8238,15 @@ static void __pyx_f_8_cdec_sa_9DataArray_write_handle(struct __pyx_obj_8_cdec_sa __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_cdec_sa.DataArray.write_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_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_8_cdec_sa_9DataArray_21write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_21write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_9DataArray_21write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_21write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -8181,11 +8256,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_21write_binary(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_20write_binary(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9DataArray_20write_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8198,7 +8273,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_21write_binary(PyObject *__pyx_v_ * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_20write_binary(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9DataArray_20write_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8220,7 +8295,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_20write_binary(struct __pyx_obj_8 * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_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":128 * f = fopen(filename, "w") @@ -8238,12 +8313,12 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_20write_binary(struct __pyx_obj_8 } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_23write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_23write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pw_3_sa_9DataArray_23write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_23write_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_8_cdec_sa_9DataArray_22write_enhanced_handle(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __pyx_r = __pyx_pf_3_sa_9DataArray_22write_enhanced_handle(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8256,7 +8331,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_23write_enhanced_handle(PyObject * f.write("%d " %i) */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pf_3_sa_9DataArray_22write_enhanced_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_word = NULL; PyObject *__pyx_r = NULL; @@ -8290,10 +8365,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ 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++; + #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 = 131; __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++; + #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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -8365,10 +8448,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ 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++; + #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 = 134; __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++; + #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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_3(__pyx_t_5); if (unlikely(!__pyx_t_1)) { @@ -8440,10 +8531,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ 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++; + #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 = 137; __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++; + #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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_6); if (unlikely(!__pyx_t_5)) { @@ -8515,10 +8614,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ 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++; + #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 = 140; __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++; + #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 = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_6 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_6)) { @@ -8590,7 +8697,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec_sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -8601,8 +8708,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_22write_enhanced_handle(struct __ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_25write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9DataArray_25write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_9DataArray_25write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_25write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -8612,11 +8719,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_25write_enhanced(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9DataArray_24write_enhanced(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8629,7 +8736,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9DataArray_25write_enhanced(PyObject *__pyx_ * self.write_enhanced_handle(self, f) */ -static PyObject *__pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9DataArray_24write_enhanced(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8725,7 +8832,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(struct __pyx_obj * self.write_enhanced_handle(self, f) */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 145; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); @@ -8804,7 +8911,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(struct __pyx_obj __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -8821,7 +8928,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9DataArray_24write_enhanced(struct __pyx_obj * return i*65536 + j */ -static int __pyx_f_8_cdec_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link", 0); @@ -8843,13 +8950,13 @@ static int __pyx_f_8_cdec_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ -static char __pyx_doc_8_cdec_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_unlink(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); + __pyx_r = __pyx_pf_3_sa_9Alignment_unlink(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8862,7 +8969,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_1unlink(PyObject *__pyx_v_self, P * return (link/65536, link%65536) */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { +static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -8903,7 +9010,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8919,7 +9026,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx * e[0] = link%65536 */ -static PyObject *__pyx_f_8_cdec_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, int __pyx_v_link, int *__pyx_v_f, int *__pyx_v_e) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlink", 0); @@ -8949,8 +9056,8 @@ static PyObject *__pyx_f_8_cdec_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { +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) { int __pyx_v_sent_id; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -8960,11 +9067,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_3get_sent_links(PyObject *__pyx_v } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -8977,8 +9084,8 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_3get_sent_links(PyObject *__pyx_v * cdef int* arr */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_sent_links = 0; +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; int *__pyx_v_arr; int __pyx_v_arr_len; PyObject *__pyx_r = NULL; @@ -8996,9 +9103,9 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_ * 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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sent_links = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_sent_links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":29 @@ -9008,7 +9115,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_ * sent_links._extend_arr(arr, arr_len*2) * free(arr) */ - __pyx_v_arr = ((struct __pyx_vtabstruct_8_cdec_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_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":30 * sent_links = IntList() @@ -9017,7 +9124,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_ * free(arr) * return sent_links */ - ((struct __pyx_vtabstruct_8_cdec_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_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":31 * arr = self._get_sent_links(sent_id, &arr_len) @@ -9044,7 +9151,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sent_links); @@ -9061,7 +9168,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_2get_sent_links(struct __pyx_obj_ * cdef int i, start, end */ -static int *__pyx_f_8_cdec_sa_9Alignment__get_sent_links(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id, int *__pyx_v_num_links) { +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) { int *__pyx_v_sent_links; int __pyx_v_i; int __pyx_v_start; @@ -9128,7 +9235,7 @@ static int *__pyx_f_8_cdec_sa_9Alignment__get_sent_links(struct __pyx_obj_8_cdec * return sent_links * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -9147,7 +9254,7 @@ static int *__pyx_f_8_cdec_sa_9Alignment__get_sent_links(struct __pyx_obj_8_cdec goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_cdec_sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9155,15 +9262,15 @@ static int *__pyx_f_8_cdec_sa_9Alignment__get_sent_links(struct __pyx_obj_8_cdec } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,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}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":45 @@ -9215,16 +9322,16 @@ static int __pyx_pw_8_cdec_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyOb __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); + __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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9243,12 +9350,12 @@ static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_A * self.sent_index = IntList(1000,1000) * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":47 @@ -9258,12 +9365,12 @@ static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_A * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":48 @@ -9337,7 +9444,7 @@ static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_A __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9345,8 +9452,8 @@ static int __pyx_pf_8_cdec_sa_9Alignment_4__cinit__(struct __pyx_obj_8_cdec_sa_A } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -9356,11 +9463,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_7read_text(PyObject *__pyx_v_self } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_6read_text(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9Alignment_6read_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -9373,7 +9480,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_7read_text(PyObject *__pyx_v_self * for line in f: */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_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; @@ -9465,10 +9572,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde 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++; + #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 = 55; __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++; + #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 = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_2 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_2)) { @@ -9536,10 +9651,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde 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++; + #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 = 58; __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++; + #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 = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_3 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_3)) { @@ -9580,27 +9703,33 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else { + } 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 = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_14); @@ -9611,12 +9740,13 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde 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 = 59; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_L21_unpacking_done:; } @@ -9636,7 +9766,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde */ __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 = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_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 = 60; __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 = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_13); @@ -9685,7 +9815,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde * self.sent_index.append(len(self.links)) */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); @@ -9766,7 +9896,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("_cdec_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -9781,8 +9911,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_6read_text(struct __pyx_obj_8_cde } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -9792,11 +9922,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_9read_binary(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_8read_binary(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9Alignment_8read_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -9809,7 +9939,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_9read_binary(PyObject *__pyx_v_se * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_8read_binary(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -9831,7 +9961,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_8read_binary(struct __pyx_obj_8_c * self.sent_index.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); + ((struct __pyx_vtabstruct_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":67 * f = fopen(filename, "r") @@ -9840,7 +9970,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_8read_binary(struct __pyx_obj_8_c * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":68 * self.links.read_handle(f) @@ -9858,8 +9988,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_8read_binary(struct __pyx_obj_8_c } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -9869,11 +9999,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_11write_text(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_10write_text(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9Alignment_10write_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -9886,7 +10016,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_11write_text(PyObject *__pyx_v_se * sent_num = 0 */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_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; @@ -9983,10 +10113,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_c 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++; + #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 = 73; __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++; + #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 = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_2 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_2)) { @@ -10126,7 +10264,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_c * for i, link in enumerate(self.links): */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); @@ -10207,7 +10345,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_c __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_cdec_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -10220,8 +10358,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_10write_text(struct __pyx_obj_8_c } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -10231,11 +10369,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_13write_binary(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_12write_binary(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9Alignment_12write_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -10248,7 +10386,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_13write_binary(PyObject *__pyx_v_ * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_12write_binary(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10270,7 +10408,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_12write_binary(struct __pyx_obj_8 * self.sent_index.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); + ((struct __pyx_vtabstruct_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":84 * f = fopen(filename, "w") @@ -10279,7 +10417,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_12write_binary(struct __pyx_obj_8 * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":85 * self.links.write_handle(f) @@ -10297,8 +10435,8 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_12write_binary(struct __pyx_obj_8 } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -10308,11 +10446,11 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_15write_enhanced(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -10325,7 +10463,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_15write_enhanced(PyObject *__pyx_ * sent_num = 1 */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_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; @@ -10417,10 +10555,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj 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++; + #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 = 90; __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++; + #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 = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) { @@ -10492,10 +10638,18 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj 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++; + #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 = 93; __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++; + #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 = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_4 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -10567,7 +10721,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj * for link in self.links: */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_2); @@ -10646,7 +10800,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_cdec_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -10658,13 +10812,13 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_14write_enhanced(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static char __pyx_doc_8_cdec_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; -static PyObject *__pyx_pw_8_cdec_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("alignment (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9Alignment_16alignment(((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_9Alignment_16alignment(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -10677,7 +10831,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9Alignment_17alignment(PyObject *__pyx_v_sel * cdef int j, start, end */ -static PyObject *__pyx_pf_8_cdec_sa_9Alignment_16alignment(struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_j; int __pyx_v_start; int __pyx_v_end; @@ -10779,7 +10933,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_16alignment(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -10796,9 +10950,9 @@ static PyObject *__pyx_pf_8_cdec_sa_9Alignment_16alignment(struct __pyx_obj_8_cd * n = <_node*> malloc(sizeof(_node)) */ -static struct __pyx_t_8_cdec_sa__node *__pyx_f_8_cdec_sa_new_node(int __pyx_v_key) { - struct __pyx_t_8_cdec_sa__node *__pyx_v_n; - struct __pyx_t_8_cdec_sa__node *__pyx_r; +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; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_node", 0); @@ -10809,7 +10963,7 @@ static struct __pyx_t_8_cdec_sa__node *__pyx_f_8_cdec_sa_new_node(int __pyx_v_ke * n.smaller = NULL * n.bigger = NULL */ - __pyx_v_n = ((struct __pyx_t_8_cdec_sa__node *)malloc((sizeof(struct __pyx_t_8_cdec_sa__node)))); + __pyx_v_n = ((struct __pyx_t_3_sa__node *)malloc((sizeof(struct __pyx_t_3_sa__node)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":18 * cdef _node* n @@ -10871,7 +11025,7 @@ static struct __pyx_t_8_cdec_sa__node *__pyx_f_8_cdec_sa_new_node(int __pyx_v_ke * del_node(n.smaller) */ -static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *__pyx_v_n) { +static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -10898,7 +11052,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *__py * if n.bigger != NULL: * del_node(n.bigger) */ - __pyx_t_2 = __pyx_f_8_cdec_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_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; @@ -10922,7 +11076,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *__py * free(n) * */ - __pyx_t_2 = __pyx_f_8_cdec_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_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; @@ -10942,7 +11096,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10958,7 +11112,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_node(struct __pyx_t_8_cdec_sa__node *__py * return &n.val */ -static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, int __pyx_v_key) { +static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx_v_key) { int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -11013,7 +11167,7 @@ static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, * return &(n.smaller.val) * return get_val(n.smaller, key) */ - __pyx_v_n->smaller = __pyx_f_8_cdec_sa_new_node(__pyx_v_key); + __pyx_v_n->smaller = __pyx_f_3_sa_new_node(__pyx_v_key); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":38 * if n.smaller == NULL: @@ -11035,7 +11189,7 @@ static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, * else: * if n.bigger == NULL: */ - __pyx_r = __pyx_f_8_cdec_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); + __pyx_r = __pyx_f_3_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); goto __pyx_L0; goto __pyx_L3; } @@ -11058,7 +11212,7 @@ static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, * return &(n.bigger.val) * return get_val(n.bigger, key) */ - __pyx_v_n->bigger = __pyx_f_8_cdec_sa_new_node(__pyx_v_key); + __pyx_v_n->bigger = __pyx_f_3_sa_new_node(__pyx_v_key); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":43 * if n.bigger == NULL: @@ -11080,7 +11234,7 @@ static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, * * */ - __pyx_r = __pyx_f_8_cdec_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); + __pyx_r = __pyx_f_3_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); goto __pyx_L0; } __pyx_L3:; @@ -11092,19 +11246,19 @@ static int *__pyx_f_8_cdec_sa_get_val(struct __pyx_t_8_cdec_sa__node *__pyx_v_n, } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { 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; - 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}; 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}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 @@ -11200,11 +11354,11 @@ static int __pyx_pw_8_cdec_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject __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.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex___cinit__(((struct __pyx_obj_8_cdec_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_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_RefNannyFinishContext(); return __pyx_r; } @@ -11217,7 +11371,7 @@ static int __pyx_pw_8_cdec_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject * self.id2eword = [] */ -static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_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_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) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11297,12 +11451,12 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * self.f_index = IntList() * self.col1 = FloatList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":61 @@ -11312,12 +11466,12 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * self.col1 = FloatList() * self.col2 = FloatList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":62 @@ -11327,12 +11481,12 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * self.col2 = FloatList() * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":63 @@ -11342,12 +11496,12 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":64 @@ -11399,16 +11553,16 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * else: * self.read_text(from_text) */ - if (!(likely(((__pyx_v_fsarray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fsarray, __pyx_ptype_8_cdec_sa_SuffixArray))))) {__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_3_sa_SuffixArray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __pyx_v_fsarray; __Pyx_INCREF(__pyx_t_4); - if (!(likely(((__pyx_v_earray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_earray, __pyx_ptype_8_cdec_sa_DataArray))))) {__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;} __pyx_t_3 = __pyx_v_earray; __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_v_alignment) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_alignment, __pyx_ptype_8_cdec_sa_Alignment))))) {__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_1 = __pyx_v_alignment; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = ((struct __pyx_vtabstruct_8_cdec_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_t_4), ((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_t_3), ((struct __pyx_obj_8_cdec_sa_Alignment *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_t_4), ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_3), ((struct __pyx_obj_3_sa_Alignment *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -11447,7 +11601,7 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11462,7 +11616,7 @@ static int __pyx_pf_8_cdec_sa_5BiLex___cinit__(struct __pyx_obj_8_cdec_sa_BiLex * cdef int *fsent, *esent, *alignment, *links, *ealigned, *faligned */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsa, struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_eda, struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_aa) { +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) { int __pyx_v_sent_id; int __pyx_v_num_links; int __pyx_v_l; @@ -11480,7 +11634,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c int *__pyx_v_links; int *__pyx_v_ealigned; int *__pyx_v_faligned; - struct __pyx_t_8_cdec_sa__node **__pyx_v_dict; + struct __pyx_t_3_sa__node **__pyx_v_dict; int *__pyx_v_fmargin; int *__pyx_v_emargin; int *__pyx_v_count; @@ -11535,10 +11689,18 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c 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++; + #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 = 81; __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++; + #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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -11597,10 +11759,18 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c 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++; + #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 = 84; __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++; + #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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_5)) { @@ -11655,10 +11825,18 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c 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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_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++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -11717,10 +11895,18 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c 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++; + #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 = 90; __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++; + #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 = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_5)) { @@ -11835,7 +12021,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * memset(dict, 0, V_F*sizeof(_node*)) * */ - __pyx_v_dict = ((struct __pyx_t_8_cdec_sa__node **)malloc((__pyx_v_V_F * (sizeof(struct __pyx_t_8_cdec_sa__node *))))); + __pyx_v_dict = ((struct __pyx_t_3_sa__node **)malloc((__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *))))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":103 * @@ -11844,7 +12030,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * * num_sents = len(fsa.darray.sent_index) */ - memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_8_cdec_sa__node *)))); + memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":105 * memset(dict, 0, V_F*sizeof(_node*)) @@ -11954,7 +12140,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * * for l from 0 <= l < num_links: */ - __pyx_v_links = ((struct __pyx_vtabstruct_8_cdec_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_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":120 * links = aa._get_sent_links(sent_id, &num_links) @@ -12105,7 +12291,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * dict[f_i].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_8_cdec_sa_new_node(__pyx_v_e_j); + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":131 * if dict[f_i] == NULL: @@ -12135,7 +12321,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_8_cdec_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); + __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":135 * else: @@ -12253,7 +12439,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * dict[f_i].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_8_cdec_sa_new_node(__pyx_v_null_word); + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_null_word); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":148 * if dict[f_i] == NULL: @@ -12283,7 +12469,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_8_cdec_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); + __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":152 * else: @@ -12386,7 +12572,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * dict[null_word].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_8_cdec_sa_new_node(__pyx_v_e_j); + (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":162 * if dict[null_word] == NULL: @@ -12416,7 +12602,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_8_cdec_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); + __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":166 * else: @@ -12496,13 +12682,13 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c __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 = 172; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 172; __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_8_cdec_sa_IntList *)__pyx_t_13); + __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_13); __pyx_t_13 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":173 @@ -12518,13 +12704,13 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c __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 = 173; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 173; __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_8_cdec_sa_IntList *)__pyx_t_12); + __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":174 @@ -12540,13 +12726,13 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c __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 = 174; __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_8_cdec_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 174; __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_8_cdec_sa_FloatList *)__pyx_t_13); + __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_13); __pyx_t_13 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":175 @@ -12562,13 +12748,13 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c __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 = 175; __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_8_cdec_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 175; __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_8_cdec_sa_FloatList *)__pyx_t_12); + __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":177 @@ -12597,7 +12783,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * if dict[i] != NULL: * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) */ - ((struct __pyx_vtabstruct_8_cdec_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_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":181 * #self.f_index[i] = num_pairs @@ -12616,7 +12802,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * del_node(dict[i]) * free(fmargin) */ - __pyx_t_12 = ((struct __pyx_vtabstruct_8_cdec_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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; @@ -12627,7 +12813,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * free(fmargin) * free(emargin) */ - __pyx_t_12 = __pyx_f_8_cdec_sa_del_node((__pyx_v_dict[__pyx_v_i])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L30; @@ -12682,7 +12868,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_cdec_sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word); @@ -12701,7 +12887,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_compute_from_data(struct __pyx_obj_8_c * if n.smaller != NULL: */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, struct __pyx_t_8_cdec_sa__node *__pyx_v_n, int *__pyx_v_num_pairs, float __pyx_v_fmargin, int *__pyx_v_emargin) { +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) { int __pyx_v_loc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -12729,7 +12915,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B * loc = num_pairs[0] * self.e_index.set(loc, n.key) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; @@ -12752,7 +12938,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B * self.col1.set(loc, float(n.val)/fmargin) * self.col2.set(loc, float(n.val)/float(emargin[n.key])) */ - ((struct __pyx_vtabstruct_8_cdec_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_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":196 * loc = num_pairs[0] @@ -12765,7 +12951,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - ((struct __pyx_vtabstruct_8_cdec_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_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":197 * self.e_index.set(loc, n.key) @@ -12778,7 +12964,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - ((struct __pyx_vtabstruct_8_cdec_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_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":198 * self.col1.set(loc, float(n.val)/fmargin) @@ -12806,7 +12992,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B * * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L4; @@ -12817,7 +13003,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12826,8 +13012,8 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex__add_node(struct __pyx_obj_8_cdec_sa_B } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -12837,11 +13023,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_2write_binary(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_5BiLex_2write_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -12854,7 +13040,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -12881,7 +13067,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec * self.e_index.write_handle(f) * self.col1.write_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->write_handle(__pyx_v_self->f_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":207 * f = fopen(filename, "w") @@ -12890,7 +13076,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec * self.col1.write_handle(f) * self.col2.write_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->write_handle(__pyx_v_self->e_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":208 * self.f_index.write_handle(f) @@ -12899,7 +13085,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_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":209 * self.e_index.write_handle(f) @@ -12908,7 +13094,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_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":210 * self.col1.write_handle(f) @@ -12919,7 +13105,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec */ __pyx_t_1 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 210; __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; @@ -12933,7 +13119,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec */ __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 211; __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; @@ -12952,7 +13138,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12968,7 +13154,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_2write_binary(struct __pyx_obj_8_cdec * cdef int num_words */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_wordlist, FILE *__pyx_v_f) { +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) { int __pyx_v_word_len; int __pyx_v_num_words; char *__pyx_v_c_word; @@ -13022,10 +13208,18 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __ 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++; + #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 = 222; __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++; + #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 = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -13085,7 +13279,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word); @@ -13102,7 +13296,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __ * cdef int word_len */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_word2id, PyObject *__pyx_v_id2word, FILE *__pyx_v_f) { +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) { int __pyx_v_num_words; int __pyx_v_word_len; char *__pyx_v_c_word; @@ -13215,7 +13409,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_word); @@ -13225,8 +13419,8 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -13236,11 +13430,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_4read_binary(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_5BiLex_4read_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -13253,7 +13447,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13281,7 +13475,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ * self.e_index.read_handle(f) * self.col1.read_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->read_handle(__pyx_v_self->f_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":249 * f = fopen(filename, "r") @@ -13290,7 +13484,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ * self.col1.read_handle(f) * self.col2.read_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->read_handle(__pyx_v_self->e_index, __pyx_v_f); + ((struct __pyx_vtabstruct_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":250 * self.f_index.read_handle(f) @@ -13299,7 +13493,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_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":251 * self.e_index.read_handle(f) @@ -13308,7 +13502,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_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":252 * self.col1.read_handle(f) @@ -13321,7 +13515,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_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 = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 252; __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; @@ -13338,7 +13532,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 253; __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; @@ -13359,7 +13553,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13368,12 +13562,12 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_4read_binary(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_6get_e_id(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); + __pyx_r = __pyx_pf_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -13386,7 +13580,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyO * e_id = len(self.id2eword) */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_6get_e_id(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { +static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { PyObject *__pyx_v_e_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13465,7 +13659,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_6get_e_id(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e_id); @@ -13475,12 +13669,12 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_6get_e_id(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_8get_f_id(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); + __pyx_r = __pyx_pf_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -13493,7 +13687,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyO * f_id = len(self.id2fword) */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_8get_f_id(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { +static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { PyObject *__pyx_v_f_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13572,7 +13766,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_8get_f_id(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f_id); @@ -13582,8 +13776,8 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_8get_f_id(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -13593,11 +13787,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_11read_text(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_10read_text(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_5BiLex_10read_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -13610,14 +13804,14 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_11read_text(PyObject *__pyx_v_self, P * cdef IntList fcount */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_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_8_cdec_sa_IntList *__pyx_v_fcount = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_fcount = 0; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_fword = NULL; @@ -13664,9 +13858,9 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s * with gzip_or_text(filename) as f: * # first loop merely establishes size of array objects */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_fcount = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_fcount = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":278 @@ -13727,10 +13921,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s 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++; + #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 = 280; __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++; + #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 = 280; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_2 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_2)) { @@ -13760,22 +13962,23 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); __pyx_t_11 = PyList_GET_ITEM(sequence, 2); @@ -13785,28 +13988,36 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + } 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 = 281; __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; - index = 0; __pyx_t_2 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 2; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_11); - index = 3; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); + 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 = 281; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_L19_unpacking_done:; } @@ -13946,13 +14157,13 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 291; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __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 = 291; __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_8_cdec_sa_IntList *)__pyx_t_12); + __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":292 @@ -14044,13 +14255,13 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __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 = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __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 = 297; __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_8_cdec_sa_IntList *)__pyx_t_12); + __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":298 @@ -14063,13 +14274,13 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __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 = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __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 = 298; __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_8_cdec_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":299 @@ -14082,13 +14293,13 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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 = 299; __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_8_cdec_sa_FloatList *)__pyx_t_12); + __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":302 @@ -14123,10 +14334,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s 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++; + #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 = 303; __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++; + #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 = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_12 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_12)) { @@ -14156,22 +14375,23 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __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 { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_11 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); @@ -14181,28 +14401,36 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + } 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 = 304; __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; - index = 0; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L26_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); - index = 1; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L26_unpacking_failed; - __Pyx_GOTREF(__pyx_t_11); - index = 2; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L26_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 3; __pyx_t_2 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L26_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); + 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 = 304; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_L27_unpacking_done:; } @@ -14358,7 +14586,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s * for line in f: */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 278; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); @@ -14488,7 +14716,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __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 = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyObject *)__pyx_kp_s_42); __Pyx_INCREF(__pyx_t_3); - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -14518,7 +14746,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_cdec_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -14549,7 +14777,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_10read_text(struct __pyx_obj_8_cdec_s * cdef float ftmp */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex_swap(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { +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) { int __pyx_v_itmp; float __pyx_v_ftmp; PyObject *__pyx_r = NULL; @@ -14677,7 +14905,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_swap(struct __pyx_obj_8_cdec_sa_BiLex * */ -static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_pad) { +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) { int __pyx_v_pval; int __pyx_v_p; long __pyx_v_k; @@ -14791,7 +15019,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex * p = i * for k from i+1 <= k < j: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -14831,7 +15059,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex * self.swap(p, p+1) * p = p + 1 */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -14842,7 +15070,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex * p = p + 1 * self.qsort(i,p, pad+" ") */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -14868,7 +15096,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex */ __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); 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); - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 359; __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; @@ -14882,7 +15110,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex */ __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 360; __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; @@ -14892,7 +15120,7 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -14901,8 +15129,8 @@ static PyObject *__pyx_f_8_cdec_sa_5BiLex_qsort(struct __pyx_obj_8_cdec_sa_BiLex } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -14912,11 +15140,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -14929,7 +15157,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_se * for i in self.f_index: */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_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; @@ -15016,10 +15244,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c 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++; + #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 = 365; __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++; + #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 = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) { @@ -15106,10 +15342,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c 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++; + #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 = 368; __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++; + #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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_4 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -15123,21 +15367,22 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c } 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __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 { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } __pyx_t_10 = PyList_GET_ITEM(sequence, 0); __pyx_t_1 = PyList_GET_ITEM(sequence, 1); __pyx_t_11 = PyList_GET_ITEM(sequence, 2); @@ -15145,8 +15390,14 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c __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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { + } 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); @@ -15159,12 +15410,13 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c 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 = 368; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_L21_unpacking_done:; } @@ -15248,10 +15500,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c 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++; + #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 = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; + #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 = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_11 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_11)) { @@ -15343,10 +15603,18 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c 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++; + #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 = 374; __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++; + #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 = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else { __pyx_t_10 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_10)) { @@ -15438,7 +15706,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c * f.write("%d " % i) */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 364; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); @@ -15519,7 +15787,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_cdec_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -15533,16 +15801,16 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_12write_enhanced(struct __pyx_obj_8_c } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_fword = 0; PyObject *__pyx_v_eword = 0; PyObject *__pyx_v_col = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fword,&__pyx_n_s__eword,&__pyx_n_s__col,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; @@ -15557,18 +15825,15 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_15get_score(PyObject *__pyx_v_self, P kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fword); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fword)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eword); - if (likely(values[1])) kw_args--; + 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 = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__col); - if (likely(values[2])) kw_args--; + 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 = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -15591,11 +15856,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_15get_score(PyObject *__pyx_v_self, P __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_14get_score(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -15608,7 +15873,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_15get_score(PyObject *__pyx_v_self, P * */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_14get_score(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { +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) { PyObject *__pyx_v_e_id = 0; PyObject *__pyx_v_f_id = 0; PyObject *__pyx_v_low = 0; @@ -15928,7 +16193,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_14get_score(struct __pyx_obj_8_cdec_s __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e_id); @@ -15943,9 +16208,9 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_14get_score(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static char __pyx_doc_8_cdec_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; -static PyObject *__pyx_pw_8_cdec_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -15955,11 +16220,11 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_17write_text(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_5BiLex_16write_text(((struct __pyx_obj_8_cdec_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_5BiLex_16write_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -15972,7 +16237,7 @@ static PyObject *__pyx_pw_8_cdec_sa_5BiLex_17write_text(PyObject *__pyx_v_self, * cdef i, N, e_id, f_id */ -static PyObject *__pyx_pf_8_cdec_sa_5BiLex_16write_text(struct __pyx_obj_8_cdec_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_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; @@ -16230,7 +16495,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_16write_text(struct __pyx_obj_8_cdec_ * f_id = 0 */ /*except:*/ { - __Pyx_AddTraceback("_cdec_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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 = 409; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_12); @@ -16309,7 +16574,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_16write_text(struct __pyx_obj_8_cdec_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_cdec_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -16332,7 +16597,7 @@ static PyObject *__pyx_pf_8_cdec_sa_5BiLex_16write_text(struct __pyx_obj_8_cdec_ * cdef int mask = 0 */ -static void __pyx_f_8_cdec_sa__init_lower_mask(void) { +static void __pyx_f_3_sa__init_lower_mask(void) { unsigned int __pyx_v_i; int __pyx_v_mask; __Pyx_RefNannyDeclarations @@ -16356,7 +16621,7 @@ static void __pyx_f_8_cdec_sa__init_lower_mask(void) { * mask = (mask << 1) + 1 * LOWER_MASK[i] = mask */ - __pyx_t_1 = __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE; + __pyx_t_1 = __pyx_v_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; @@ -16376,7 +16641,7 @@ static void __pyx_f_8_cdec_sa__init_lower_mask(void) { * * _init_lower_mask() */ - (__pyx_v_8_cdec_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; + (__pyx_v_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; } __Pyx_RefNannyFinishContext(); @@ -16390,9 +16655,9 @@ static void __pyx_f_8_cdec_sa__init_lower_mask(void) { * */ -static struct __pyx_t_8_cdec_sa__BitSet *__pyx_f_8_cdec_sa_new_BitSet(void) { - struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_b; - struct __pyx_t_8_cdec_sa__BitSet *__pyx_r; +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; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_BitSet", 0); @@ -16403,7 +16668,7 @@ static struct __pyx_t_8_cdec_sa__BitSet *__pyx_f_8_cdec_sa_new_BitSet(void) { * b.bitset = 0 * b.min_val = -1 */ - __pyx_v_b = ((struct __pyx_t_8_cdec_sa__BitSet *)malloc((sizeof(struct __pyx_t_8_cdec_sa__BitSet)))); + __pyx_v_b = ((struct __pyx_t_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_3_sa__BitSet)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":41 * @@ -16465,7 +16730,7 @@ static struct __pyx_t_8_cdec_sa__BitSet *__pyx_f_8_cdec_sa_new_BitSet(void) { * cdef int low, high, mid */ -static int __pyx_f_8_cdec_sa_bitset_findsucc(struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_bitset; int __pyx_v_mask; int __pyx_v_low; @@ -16537,7 +16802,7 @@ static int __pyx_f_8_cdec_sa_bitset_findsucc(struct __pyx_t_8_cdec_sa__BitSet *_ * low = i+1 * high = b.max_val+1 */ - __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_8_cdec_sa_LOWER_MASK[__pyx_v_i]))); + __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_3_sa_LOWER_MASK[__pyx_v_i]))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":58 * @@ -16584,7 +16849,7 @@ static int __pyx_f_8_cdec_sa_bitset_findsucc(struct __pyx_t_8_cdec_sa__BitSet *_ * if bitset & mask == 0: * low = mid */ - __pyx_v_mask = (~((__pyx_v_8_cdec_sa_LOWER_MASK[(__pyx_v_high - 1)]) ^ (__pyx_v_8_cdec_sa_LOWER_MASK[(__pyx_v_mid - 1)]))); + __pyx_v_mask = (~((__pyx_v_3_sa_LOWER_MASK[(__pyx_v_high - 1)]) ^ (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_mid - 1)]))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":63 * mid = (high + low)/2 @@ -16653,7 +16918,7 @@ static int __pyx_f_8_cdec_sa_bitset_findsucc(struct __pyx_t_8_cdec_sa__BitSet *_ * */ -static int __pyx_f_8_cdec_sa_bitset_insert(struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_val; int __pyx_r; __Pyx_RefNannyDeclarations @@ -16811,7 +17076,7 @@ static int __pyx_f_8_cdec_sa_bitset_insert(struct __pyx_t_8_cdec_sa__BitSet *__p * */ -static int __pyx_f_8_cdec_sa_bitset_contains(struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_val; int __pyx_r; __Pyx_RefNannyDeclarations @@ -16869,12 +17134,12 @@ static int __pyx_f_8_cdec_sa_bitset_contains(struct __pyx_t_8_cdec_sa__BitSet *_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_14BitSetIterator___next__(((struct __pyx_obj_8_cdec_sa_BitSetIterator *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_14BitSetIterator___next__(((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -16887,7 +17152,7 @@ static PyObject *__pyx_pw_8_cdec_sa_14BitSetIterator_1__next__(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_8_cdec_sa_14BitSetIterator___next__(struct __pyx_obj_8_cdec_sa_BitSetIterator *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16940,7 +17205,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14BitSetIterator___next__(struct __pyx_obj_8 * return ret_val * */ - __pyx_v_self->next_val = __pyx_f_8_cdec_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":111 * ret_val = self.next_val @@ -16960,7 +17225,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14BitSetIterator___next__(struct __pyx_obj_8 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16969,15 +17234,15 @@ static PyObject *__pyx_pf_8_cdec_sa_14BitSetIterator___next__(struct __pyx_obj_8 } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { 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_8_cdec_sa_6BitSet___cinit__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet___cinit__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -16990,7 +17255,7 @@ static int __pyx_pw_8_cdec_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObjec * */ -static int __pyx_pf_8_cdec_sa_6BitSet___cinit__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); @@ -17002,7 +17267,7 @@ static int __pyx_pf_8_cdec_sa_6BitSet___cinit__(struct __pyx_obj_8_cdec_sa_BitSe * * def __dealloc__(self): */ - __pyx_v_self->b = __pyx_f_8_cdec_sa_new_BitSet(); + __pyx_v_self->b = __pyx_f_3_sa_new_BitSet(); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -17010,11 +17275,11 @@ static int __pyx_pf_8_cdec_sa_6BitSet___cinit__(struct __pyx_obj_8_cdec_sa_BitSe } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_6BitSet_2__dealloc__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_pf_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -17026,7 +17291,7 @@ static void __pyx_pw_8_cdec_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_6BitSet_2__dealloc__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -17043,12 +17308,12 @@ static void __pyx_pf_8_cdec_sa_6BitSet_2__dealloc__(struct __pyx_obj_8_cdec_sa_B } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_4__iter__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet_4__iter__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17061,8 +17326,8 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { * it = BitSetIterator() */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_4__iter__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { - struct __pyx_obj_8_cdec_sa_BitSetIterator *__pyx_v_it = 0; +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17078,9 +17343,9 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_4__iter__(struct __pyx_obj_8_cdec_sa * it.b = self.b * it.next_val = self.b.min_val */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_BitSetIterator *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":131 @@ -17117,7 +17382,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_4__iter__(struct __pyx_obj_8_cdec_sa goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); @@ -17127,12 +17392,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_4__iter__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_6insert(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6BitSet_6insert(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17145,7 +17410,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyOb * */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_6insert(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17164,7 +17429,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_6insert(struct __pyx_obj_8_cdec_sa_B */ __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_8_cdec_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_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; @@ -17174,7 +17439,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_6insert(struct __pyx_obj_8_cdec_sa_B goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17183,12 +17448,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_6insert(struct __pyx_obj_8_cdec_sa_B } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_8findsucc(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6BitSet_8findsucc(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17201,7 +17466,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, Py * */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_8findsucc(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17220,7 +17485,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_8findsucc(struct __pyx_obj_8_cdec_sa */ __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_8_cdec_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_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; @@ -17230,7 +17495,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_8findsucc(struct __pyx_obj_8_cdec_sa goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17239,12 +17504,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_8findsucc(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_10__str__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet_10__str__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17257,7 +17522,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_10__str__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17276,7 +17541,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_10__str__(struct __pyx_obj_8_cdec_sa * def min(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_8_cdec_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_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_55)); 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)); @@ -17342,7 +17607,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_10__str__(struct __pyx_obj_8_cdec_sa __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17351,12 +17616,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_10__str__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("min (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_12min(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet_12min(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17369,7 +17634,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON * */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_12min(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17396,7 +17661,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_12min(struct __pyx_obj_8_cdec_sa_Bit goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17405,12 +17670,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_12min(struct __pyx_obj_8_cdec_sa_Bit } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("max (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_14max(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet_14max(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17423,7 +17688,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON * */ -static PyObject *__pyx_pf_8_cdec_sa_6BitSet_14max(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17450,7 +17715,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_14max(struct __pyx_obj_8_cdec_sa_Bit goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17459,12 +17724,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6BitSet_14max(struct __pyx_obj_8_cdec_sa_Bit } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_16__len__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6BitSet_16__len__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17477,7 +17742,7 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_6BitSet_16__len__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); @@ -17499,12 +17764,12 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_6BitSet_16__len__(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_8_cdec_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6BitSet_18__contains__(((struct __pyx_obj_8_cdec_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6BitSet_18__contains__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -17517,7 +17782,7 @@ static int __pyx_pw_8_cdec_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyO * */ -static int __pyx_pf_8_cdec_sa_6BitSet_18__contains__(struct __pyx_obj_8_cdec_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17536,7 +17801,7 @@ static int __pyx_pf_8_cdec_sa_6BitSet_18__contains__(struct __pyx_obj_8_cdec_sa_ * */ __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_8_cdec_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_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; @@ -17547,7 +17812,7 @@ static int __pyx_pf_8_cdec_sa_6BitSet_18__contains__(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -17562,7 +17827,7 @@ static int __pyx_pf_8_cdec_sa_6BitSet_18__contains__(struct __pyx_obj_8_cdec_sa_ * cdef unsigned d */ -static PyObject *__pyx_f_8_cdec_sa_dec2bin(long __pyx_v_i) { +static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { PyObject *__pyx_v_result = 0; CYTHON_UNUSED unsigned int __pyx_v_d; PyObject *__pyx_r = NULL; @@ -17593,7 +17858,7 @@ static PyObject *__pyx_f_8_cdec_sa_dec2bin(long __pyx_v_i) { * if i & LOWER_MASK[0] == 0: * result = "0"+result */ - __pyx_t_1 = __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE; + __pyx_t_1 = __pyx_v_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; @@ -17604,7 +17869,7 @@ static PyObject *__pyx_f_8_cdec_sa_dec2bin(long __pyx_v_i) { * result = "0"+result * else: */ - __pyx_t_3 = ((__pyx_v_i & (__pyx_v_8_cdec_sa_LOWER_MASK[0])) == 0); + __pyx_t_3 = ((__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[0])) == 0); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":162 @@ -17664,7 +17929,7 @@ static PyObject *__pyx_f_8_cdec_sa_dec2bin(long __pyx_v_i) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -17681,10 +17946,10 @@ static PyObject *__pyx_f_8_cdec_sa_dec2bin(long __pyx_v_i) { * cdef int num_bits, num_top_bits, i */ -static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { - struct __pyx_t_8_cdec_sa__VEB *__pyx_v_veb; +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; int __pyx_v_num_bits; - struct __pyx_t_8_cdec_sa__VEB *__pyx_r; + struct __pyx_t_3_sa__VEB *__pyx_r; __Pyx_RefNannyDeclarations double __pyx_t_1; double __pyx_t_2; @@ -17701,7 +17966,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * * num_bits = int(ceil(log(n) / log(2))) */ - __pyx_v_veb = ((struct __pyx_t_8_cdec_sa__VEB *)malloc((sizeof(struct __pyx_t_8_cdec_sa__VEB)))); + __pyx_v_veb = ((struct __pyx_t_3_sa__VEB *)malloc((sizeof(struct __pyx_t_3_sa__VEB)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":183 * veb = <_VEB*> malloc(sizeof(_VEB)) @@ -17734,7 +17999,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * 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_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_3 = (__pyx_v_veb->num_bottom_bits < __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":186 @@ -17744,7 +18009,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 * */ - __pyx_v_veb->num_bottom_bits = __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS; + __pyx_v_veb->num_bottom_bits = __pyx_v_3_sa_MIN_BOTTOM_BITS; goto __pyx_L3; } __pyx_L3:; @@ -17783,7 +18048,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * veb.top = new_VEB(veb.top_universe_size) * else: */ - __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":193 @@ -17793,7 +18058,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * else: * veb.top = new_BitSet() */ - __pyx_v_veb->top = __pyx_f_8_cdec_sa_new_VEB(__pyx_v_veb->top_universe_size); + __pyx_v_veb->top = __pyx_f_3_sa_new_VEB(__pyx_v_veb->top_universe_size); goto __pyx_L4; } /*else*/ { @@ -17805,7 +18070,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * * veb.max_val = -1 */ - __pyx_v_veb->top = __pyx_f_8_cdec_sa_new_BitSet(); + __pyx_v_veb->top = __pyx_f_3_sa_new_BitSet(); } __pyx_L4:; @@ -17849,7 +18114,7 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_cdec_sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -17864,9 +18129,9 @@ static struct __pyx_t_8_cdec_sa__VEB *__pyx_f_8_cdec_sa_new_VEB(int __pyx_v_n) { * cdef _BitSet* subb */ -static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_8_cdec_sa__VEB *__pyx_v_subv; - struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_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; int __pyx_v_a; int __pyx_v_b; int __pyx_v_tmp; @@ -17992,7 +18257,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * if veb.bottom[a] == NULL: * if veb.top_universe_size > MIN_BOTTOM_SIZE: */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_8_cdec_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":220 * a = i >> veb.num_bottom_bits @@ -18011,7 +18276,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * subv = <_VEB*> veb.top * VEB_insert(subv, a) */ - __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":222 @@ -18021,7 +18286,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * VEB_insert(subv, a) * else: */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)__pyx_v_veb->top); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":223 * if veb.top_universe_size > MIN_BOTTOM_SIZE: @@ -18030,7 +18295,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * else: * subb = <_BitSet*> veb.top */ - __pyx_f_8_cdec_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); + __pyx_f_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); goto __pyx_L6; } /*else*/ { @@ -18042,7 +18307,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * bitset_insert(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)__pyx_v_veb->top); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":226 * else: @@ -18051,7 +18316,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) */ - __pyx_f_8_cdec_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); + __pyx_f_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); } __pyx_L6:; @@ -18062,7 +18327,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) * else: */ - __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":228 @@ -18072,7 +18337,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * else: * veb.bottom[a] = new_BitSet() */ - (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_8_cdec_sa_new_VEB((1 << __pyx_v_veb->num_bottom_bits)); + (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_3_sa_new_VEB((1 << __pyx_v_veb->num_bottom_bits)); goto __pyx_L7; } /*else*/ { @@ -18084,7 +18349,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] */ - (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_8_cdec_sa_new_BitSet(); + (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_3_sa_new_BitSet(); } __pyx_L7:; goto __pyx_L5; @@ -18098,7 +18363,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * subv = <_VEB*> veb.bottom[a] * if VEB_insert(subv, b) == 0: */ - __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":232 @@ -18108,7 +18373,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * if VEB_insert(subv, b) == 0: * return 0 */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":233 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: @@ -18117,7 +18382,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * return 0 * else: */ - __pyx_t_3 = (__pyx_f_8_cdec_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0); + __pyx_t_3 = (__pyx_f_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":234 @@ -18143,7 +18408,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * if bitset_insert(subb, b) == 0: * return 0 */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":237 * else: @@ -18152,7 +18417,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * return 0 * */ - __pyx_t_3 = (__pyx_f_8_cdec_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0); + __pyx_t_3 = (__pyx_f_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":238 @@ -18227,7 +18492,7 @@ static int __pyx_f_8_cdec_sa_VEB_insert(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_v * */ -static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_veb) { +static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18245,7 +18510,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * i = (<_VEB*> veb.top).min_val * else: */ - __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":250 @@ -18255,7 +18520,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * else: * i = (<_BitSet*> veb.top).min_val */ - __pyx_v_i = ((struct __pyx_t_8_cdec_sa__VEB *)__pyx_v_veb->top)->min_val; + __pyx_v_i = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top)->min_val; goto __pyx_L3; } /*else*/ { @@ -18267,7 +18532,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * * while i != -1: */ - __pyx_v_i = ((struct __pyx_t_8_cdec_sa__BitSet *)__pyx_v_veb->top)->min_val; + __pyx_v_i = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top)->min_val; } __pyx_L3:; @@ -18289,7 +18554,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * del_VEB(<_VEB*> veb.bottom[i]) * else: */ - __pyx_t_1 = (__pyx_v_veb->num_bottom_bits > __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_1 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":256 @@ -18299,7 +18564,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * else: * free(<_BitSet*> veb.bottom[i]) */ - __pyx_t_2 = __pyx_f_8_cdec_sa_del_VEB(((struct __pyx_t_8_cdec_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_3_sa_del_VEB(((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L6; @@ -18313,7 +18578,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * * if veb.top_universe_size > MIN_BOTTOM_SIZE: */ - free(((struct __pyx_t_8_cdec_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); + free(((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); } __pyx_L6:; @@ -18324,7 +18589,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * i = VEB_findsucc(<_VEB*> veb.top, i) * else: */ - __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":261 @@ -18334,7 +18599,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * else: * i = bitset_findsucc(<_BitSet*> veb.top, i) */ - __pyx_v_i = __pyx_f_8_cdec_sa_VEB_findsucc(((struct __pyx_t_8_cdec_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); + __pyx_v_i = __pyx_f_3_sa_VEB_findsucc(((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); goto __pyx_L7; } /*else*/ { @@ -18346,7 +18611,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * * if veb.top_universe_size > MIN_BOTTOM_SIZE: */ - __pyx_v_i = __pyx_f_8_cdec_sa_bitset_findsucc(((struct __pyx_t_8_cdec_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); + __pyx_v_i = __pyx_f_3_sa_bitset_findsucc(((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); } __pyx_L7:; } @@ -18358,7 +18623,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * del_VEB(<_VEB*> veb.top) * else: */ - __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":266 @@ -18368,7 +18633,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * else: * free(<_BitSet*> veb.top) */ - __pyx_t_2 = __pyx_f_8_cdec_sa_del_VEB(((struct __pyx_t_8_cdec_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_3_sa_del_VEB(((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L8; @@ -18382,7 +18647,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * free(veb.bottom) * free(veb) */ - free(((struct __pyx_t_8_cdec_sa__BitSet *)__pyx_v_veb->top)); + free(((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top)); } __pyx_L8:; @@ -18408,7 +18673,7 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18424,9 +18689,9 @@ static PyObject *__pyx_f_8_cdec_sa_del_VEB(struct __pyx_t_8_cdec_sa__VEB *__pyx_ * cdef _BitSet* subb */ -static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_8_cdec_sa__VEB *__pyx_v_subv; - struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_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; int __pyx_v_a; int __pyx_v_b; int __pyx_v_j; @@ -18507,7 +18772,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * found = 0 * if veb.bottom[a] != NULL: */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_8_cdec_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":285 * a = i >> veb.num_bottom_bits @@ -18535,7 +18800,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * subv = <_VEB*> veb.bottom[a] * if subv.max_val > b: */ - __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":288 @@ -18545,7 +18810,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * if subv.max_val > b: * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":289 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: @@ -18564,7 +18829,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * found = 1 * else: */ - __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_8_cdec_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_b)); + __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_b)); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":291 * if subv.max_val > b: @@ -18588,7 +18853,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * if subb.max_val > b: * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":294 * else: @@ -18607,7 +18872,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * found = 1 * if found==0: */ - __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_8_cdec_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_b)); + __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_b)); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":296 * if subb.max_val > b: @@ -18643,7 +18908,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * subv = <_VEB*> veb.top * c = VEB_findsucc(subv, a) */ - __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE); + __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":299 @@ -18653,7 +18918,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * c = VEB_findsucc(subv, a) * else: */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)__pyx_v_veb->top); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":300 * if veb.top_universe_size > MIN_BOTTOM_SIZE: @@ -18662,7 +18927,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * else: * subb = <_BitSet*> veb.top */ - __pyx_v_c = __pyx_f_8_cdec_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); + __pyx_v_c = __pyx_f_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); goto __pyx_L10; } /*else*/ { @@ -18674,7 +18939,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * c = bitset_findsucc(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)__pyx_v_veb->top); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":303 * else: @@ -18683,7 +18948,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[c] */ - __pyx_v_c = __pyx_f_8_cdec_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); + __pyx_v_c = __pyx_f_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); } __pyx_L10:; @@ -18694,7 +18959,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * 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_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":305 @@ -18704,7 +18969,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * j = (c << veb.num_bottom_bits) + subv.min_val * else: */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":306 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: @@ -18725,7 +18990,7 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * j = (c << veb.num_bottom_bits) + subb.min_val * return j */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":309 * else: @@ -18765,9 +19030,9 @@ static int __pyx_f_8_cdec_sa_VEB_findsucc(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * cdef _BitSet* subb */ -static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_8_cdec_sa__VEB *__pyx_v_subv; - struct __pyx_t_8_cdec_sa__BitSet *__pyx_v_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; int __pyx_v_a; int __pyx_v_b; int __pyx_r; @@ -18877,7 +19142,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * if veb.bottom[a] == NULL: * return 0 */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_8_cdec_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":329 * a = i >> veb.num_bottom_bits @@ -18909,7 +19174,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * subv = <_VEB*> veb.bottom[a] * return VEB_contains(subv, b) */ - __pyx_t_2 = (__pyx_v_veb->num_bottom_bits > __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS); + __pyx_t_2 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_2) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":333 @@ -18919,7 +19184,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * return VEB_contains(subv, b) * else: */ - __pyx_v_subv = ((struct __pyx_t_8_cdec_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":334 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: @@ -18928,7 +19193,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * else: * subb = <_BitSet*> veb.bottom[a] */ - __pyx_r = __pyx_f_8_cdec_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); + __pyx_r = __pyx_f_3_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); goto __pyx_L0; goto __pyx_L7; } @@ -18941,7 +19206,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * return bitset_contains(subb, b) * */ - __pyx_v_subb = ((struct __pyx_t_8_cdec_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":337 * else: @@ -18950,7 +19215,7 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v * * */ - __pyx_r = __pyx_f_8_cdec_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); + __pyx_r = __pyx_f_3_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); goto __pyx_L0; } __pyx_L7:; @@ -18964,12 +19229,12 @@ static int __pyx_f_8_cdec_sa_VEB_contains(struct __pyx_t_8_cdec_sa__VEB *__pyx_v } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_11VEBIterator___next__(((struct __pyx_obj_8_cdec_sa_VEBIterator *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_11VEBIterator___next__(((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18982,7 +19247,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11VEBIterator_1__next__(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_8_cdec_sa_11VEBIterator___next__(struct __pyx_obj_8_cdec_sa_VEBIterator *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19035,7 +19300,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11VEBIterator___next__(struct __pyx_obj_8_cd * return ret_val * */ - __pyx_v_self->next_val = __pyx_f_8_cdec_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":351 * ret_val = self.next_val @@ -19055,7 +19320,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11VEBIterator___next__(struct __pyx_obj_8_cd goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19064,14 +19329,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11VEBIterator___next__(struct __pyx_obj_8_cd } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { int __pyx_v_size; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,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; @@ -19084,8 +19349,7 @@ static int __pyx_pw_8_cdec_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject * kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); - if (likely(values[0])) kw_args--; + 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)) { @@ -19102,11 +19366,11 @@ static int __pyx_pw_8_cdec_sa_3VEB_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[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_3VEB___cinit__(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self), __pyx_v_size); + __pyx_r = __pyx_pf_3_sa_3VEB___cinit__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), __pyx_v_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19119,7 +19383,7 @@ static int __pyx_pw_8_cdec_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject * * */ -static int __pyx_pf_8_cdec_sa_3VEB___cinit__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, int __pyx_v_size) { +static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); @@ -19131,7 +19395,7 @@ static int __pyx_pf_8_cdec_sa_3VEB___cinit__(struct __pyx_obj_8_cdec_sa_VEB *__p * * def __dealloc__(self): */ - __pyx_v_self->veb = __pyx_f_8_cdec_sa_new_VEB(__pyx_v_size); + __pyx_v_self->veb = __pyx_f_3_sa_new_VEB(__pyx_v_size); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -19139,11 +19403,11 @@ static int __pyx_pf_8_cdec_sa_3VEB___cinit__(struct __pyx_obj_8_cdec_sa_VEB *__p } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_3VEB_2__dealloc__(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self)); + __pyx_pf_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -19155,7 +19419,7 @@ static void __pyx_pw_8_cdec_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_3VEB_2__dealloc__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self) { +static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; @@ -19170,25 +19434,25 @@ static void __pyx_pf_8_cdec_sa_3VEB_2__dealloc__(struct __pyx_obj_8_cdec_sa_VEB * * def __iter__(self): */ - __pyx_t_1 = __pyx_f_8_cdec_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_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.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_3VEB_4__iter__(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_3VEB_4__iter__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19201,8 +19465,8 @@ static PyObject *__pyx_pw_8_cdec_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { * it = VEBIterator() */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_4__iter__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self) { - struct __pyx_obj_8_cdec_sa_VEBIterator *__pyx_v_it = 0; +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -19218,9 +19482,9 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_4__iter__(struct __pyx_obj_8_cdec_sa_VE * it.v = self.veb * it.next_val = self.veb.min_val */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_VEBIterator *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_3_sa_VEBIterator *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":369 @@ -19257,7 +19521,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_4__iter__(struct __pyx_obj_8_cdec_sa_VE goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); @@ -19267,12 +19531,12 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_4__iter__(struct __pyx_obj_8_cdec_sa_VE } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_3VEB_6insert(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_3VEB_6insert(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19285,7 +19549,7 @@ static PyObject *__pyx_pw_8_cdec_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_6insert(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19304,7 +19568,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_6insert(struct __pyx_obj_8_cdec_sa_VEB */ __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_8_cdec_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_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; @@ -19314,7 +19578,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_6insert(struct __pyx_obj_8_cdec_sa_VEB goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19330,7 +19594,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_6insert(struct __pyx_obj_8_cdec_sa_VEB * */ -static int __pyx_f_8_cdec_sa_3VEB__insert(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, int __pyx_v_i) { +static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_insert", 0); @@ -19342,7 +19606,7 @@ static int __pyx_f_8_cdec_sa_3VEB__insert(struct __pyx_obj_8_cdec_sa_VEB *__pyx_ * * def findsucc(self, i): */ - __pyx_r = __pyx_f_8_cdec_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); + __pyx_r = __pyx_f_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); goto __pyx_L0; __pyx_r = 0; @@ -19352,12 +19616,12 @@ static int __pyx_f_8_cdec_sa_3VEB__insert(struct __pyx_obj_8_cdec_sa_VEB *__pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_3VEB_8findsucc(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_3VEB_8findsucc(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19370,7 +19634,7 @@ static PyObject *__pyx_pw_8_cdec_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_8_cdec_sa_3VEB_8findsucc(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19389,7 +19653,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_8findsucc(struct __pyx_obj_8_cdec_sa_VE */ __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_8_cdec_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_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; @@ -19399,7 +19663,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_8findsucc(struct __pyx_obj_8_cdec_sa_VE goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19415,7 +19679,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3VEB_8findsucc(struct __pyx_obj_8_cdec_sa_VE * */ -static int __pyx_f_8_cdec_sa_3VEB__first(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self) { +static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_first", 0); @@ -19444,7 +19708,7 @@ static int __pyx_f_8_cdec_sa_3VEB__first(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v * */ -static int __pyx_f_8_cdec_sa_3VEB__findsucc(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, int __pyx_v_i) { +static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_findsucc", 0); @@ -19456,7 +19720,7 @@ static int __pyx_f_8_cdec_sa_3VEB__findsucc(struct __pyx_obj_8_cdec_sa_VEB *__py * * def __len__(self): */ - __pyx_r = __pyx_f_8_cdec_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); + __pyx_r = __pyx_f_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); goto __pyx_L0; __pyx_r = 0; @@ -19466,12 +19730,12 @@ static int __pyx_f_8_cdec_sa_3VEB__findsucc(struct __pyx_obj_8_cdec_sa_VEB *__py } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_3VEB_11__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_3VEB_10__len__(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_3VEB_10__len__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19484,7 +19748,7 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_3VEB_11__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_3VEB_10__len__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); @@ -19506,12 +19770,12 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_3VEB_10__len__(struct __pyx_obj_8_cdec_sa_V } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_8_cdec_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_3VEB_12__contains__(((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_3VEB_12__contains__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19523,7 +19787,7 @@ static int __pyx_pw_8_cdec_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObje * return VEB_contains(self.veb, i) */ -static int __pyx_pf_8_cdec_sa_3VEB_12__contains__(struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19538,13 +19802,13 @@ static int __pyx_pf_8_cdec_sa_3VEB_12__contains__(struct __pyx_obj_8_cdec_sa_VEB * 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_8_cdec_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); + __pyx_r = __pyx_f_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.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -19552,14 +19816,14 @@ static int __pyx_pf_8_cdec_sa_3VEB_12__contains__(struct __pyx_obj_8_cdec_sa_VEB } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sa = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa,0}; +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; 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; @@ -19572,8 +19836,7 @@ static int __pyx_pw_8_cdec_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject * kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa); - if (likely(values[0])) kw_args--; + 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)) { @@ -19584,18 +19847,18 @@ static int __pyx_pw_8_cdec_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject * } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_sa = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)values[0]); + __pyx_v_sa = ((struct __pyx_obj_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.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_3LCP___cinit__(((struct __pyx_obj_8_cdec_sa_LCP *)__pyx_v_self), __pyx_v_sa); + 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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -19612,13 +19875,13 @@ static int __pyx_pw_8_cdec_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject * * cdef IntList rank */ -static int __pyx_pf_8_cdec_sa_3LCP___cinit__(struct __pyx_obj_8_cdec_sa_LCP *__pyx_v_self, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sa) { +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) { int __pyx_v_i; int __pyx_v_k; int __pyx_v_j; int __pyx_v_h; int __pyx_v_n; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_rank = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_rank = 0; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -19685,13 +19948,13 @@ static int __pyx_pf_8_cdec_sa_3LCP___cinit__(struct __pyx_obj_8_cdec_sa_LCP *__p __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_8_cdec_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_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_8_cdec_sa_IntList *)__pyx_t_2); + __pyx_v_self->lcp = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":18 @@ -19707,10 +19970,10 @@ static int __pyx_pf_8_cdec_sa_3LCP___cinit__(struct __pyx_obj_8_cdec_sa_LCP *__p __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_8_cdec_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_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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":19 @@ -19881,19 +20144,19 @@ static int __pyx_pf_8_cdec_sa_3LCP___cinit__(struct __pyx_obj_8_cdec_sa_LCP *__p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ -static char __pyx_doc_8_cdec_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_8_cdec_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { +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) { int __pyx_v_max_n; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -19903,11 +20166,11 @@ static PyObject *__pyx_pw_8_cdec_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_3LCP_2compute_stats(((struct __pyx_obj_8_cdec_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); + __pyx_r = __pyx_pf_3_sa_3LCP_2compute_stats(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19920,15 +20183,15 @@ static PyObject *__pyx_pw_8_cdec_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, * particular, the frequency associated with each word is */ -static PyObject *__pyx_pf_8_cdec_sa_3LCP_2compute_stats(struct __pyx_obj_8_cdec_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *__pyx_cur_scope; +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__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_8_cdec_sa___pyx_scope_struct__compute_stats *)__pyx_ptype_8_cdec_sa___pyx_scope_struct__compute_stats->tp_new(__pyx_ptype_8_cdec_sa___pyx_scope_struct__compute_stats, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *)__pyx_ptype_3_sa___pyx_scope_struct__compute_stats->tp_new(__pyx_ptype_3_sa___pyx_scope_struct__compute_stats, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -19939,7 +20202,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3LCP_2compute_stats(struct __pyx_obj_8_cdec_ __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_8_cdec_sa_3LCP_4generator, (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_3_sa_3LCP_4generator, (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; @@ -19948,7 +20211,7 @@ static PyObject *__pyx_pf_8_cdec_sa_3LCP_2compute_stats(struct __pyx_obj_8_cdec_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -19957,9 +20220,9 @@ static PyObject *__pyx_pf_8_cdec_sa_3LCP_2compute_stats(struct __pyx_obj_8_cdec_ return __pyx_r; } -static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *__pyx_cur_scope = ((struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *)__pyx_generator->closure); + struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; @@ -20028,7 +20291,7 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx __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[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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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_1)); __pyx_t_1 = 0; __pyx_t_4 = 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;} @@ -20048,11 +20311,11 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx __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[9]; __pyx_lineno = 54; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __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[9]; __pyx_lineno = 54; __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_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":55 @@ -20069,11 +20332,11 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx 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_8_cdec_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __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_cur_scope->__pyx_v_veb = ((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_t_1); + __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":57 @@ -20171,7 +20434,7 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx * ngram_start = ngram_starts[n] * while ngram_start.arr[freq] > 0: */ - ((struct __pyx_vtabstruct_8_cdec_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_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 * if freq > 1000: # arbitrary, but see note below @@ -20182,11 +20445,11 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx */ __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __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_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_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_1); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":68 @@ -20251,7 +20514,7 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] */ - __pyx_cur_scope->__pyx_v_ii = ((struct __pyx_vtabstruct_8_cdec_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_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 * while i != -1: @@ -20272,11 +20535,11 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx */ __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __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_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_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_1); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":76 @@ -20394,7 +20657,7 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx __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(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (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(__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -20479,20 +20742,21 @@ static PyObject *__pyx_gb_8_cdec_sa_3LCP_4generator(__pyx_GeneratorObject *__pyx __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_8_cdec_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { 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_8_cdec_sa_8Alphabet___cinit__(((struct __pyx_obj_8_cdec_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8Alphabet___cinit__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -20505,7 +20769,7 @@ static int __pyx_pw_8_cdec_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObj * self.nonterminals = StringMap() */ -static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self) { +static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -20521,12 +20785,12 @@ static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alp * self.nonterminals = StringMap() * self.id2sym = {} */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_StringMap *)__pyx_t_1); + __pyx_v_self->terminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":14 @@ -20536,12 +20800,12 @@ static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alp * self.id2sym = {} * self.first_nonterminal = -1 */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_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_8_cdec_sa_StringMap *)__pyx_t_1); + __pyx_v_self->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":15 @@ -20572,7 +20836,7 @@ static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alp goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -20580,11 +20844,11 @@ static int __pyx_pf_8_cdec_sa_8Alphabet___cinit__(struct __pyx_obj_8_cdec_sa_Alp } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_8_cdec_sa_Alphabet *)__pyx_v_self)); + __pyx_pf_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -20596,7 +20860,7 @@ static void __pyx_pw_8_cdec_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_8_cdec_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self) { +static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -20611,7 +20875,7 @@ static void __pyx_pf_8_cdec_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx * */ -static int __pyx_f_8_cdec_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isvar", 0); @@ -20640,7 +20904,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_8_cd * */ -static int __pyx_f_8_cdec_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isword", 0); @@ -20669,7 +20933,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_8_c * */ -static int __pyx_f_8_cdec_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getindex", 0); @@ -20681,7 +20945,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_8 * * cdef int setindex(self, int sym, int ind): */ - __pyx_r = ((-__pyx_v_sym) & __pyx_v_8_cdec_sa_INDEX_MASK); + __pyx_r = ((-__pyx_v_sym) & __pyx_v_3_sa_INDEX_MASK); goto __pyx_L0; __pyx_r = 0; @@ -20698,7 +20962,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_8 * */ -static int __pyx_f_8_cdec_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym, int __pyx_v_ind) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("setindex", 0); @@ -20710,7 +20974,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_8 * * cdef int clearindex(self, int sym): */ - __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_8_cdec_sa_INDEX_MASK)) | __pyx_v_ind)); + __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_3_sa_INDEX_MASK)) | __pyx_v_ind)); goto __pyx_L0; __pyx_r = 0; @@ -20727,7 +20991,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_8 * */ -static int __pyx_f_8_cdec_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clearindex", 0); @@ -20739,7 +21003,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj * * cdef int match(self, int sym1, int sym2): */ - __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_8_cdec_sa_INDEX_MASK))); + __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_3_sa_INDEX_MASK))); goto __pyx_L0; __pyx_r = 0; @@ -20756,7 +21020,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj * */ -static int __pyx_f_8_cdec_sa_8Alphabet_match(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym1, int __pyx_v_sym2) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("match", 0); @@ -20768,7 +21032,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_match(struct __pyx_obj_8_cdec_sa_Alphabet * * cdef char* tocat(self, int sym): */ - __pyx_r = (((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym1) == ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym2)); + __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)); goto __pyx_L0; __pyx_r = 0; @@ -20785,7 +21049,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_match(struct __pyx_obj_8_cdec_sa_Alphabet * */ -static char *__pyx_f_8_cdec_sa_8Alphabet_tocat(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tocat", 0); @@ -20797,7 +21061,7 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tocat(struct __pyx_obj_8_cdec_sa_Alphab * * cdef int fromcat(self, char *s): */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->word(__pyx_v_self->nonterminals, (((-__pyx_v_sym) >> __pyx_v_8_cdec_sa_INDEX_SHIFT) - 1)); + __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)); goto __pyx_L0; __pyx_r = 0; @@ -20814,7 +21078,7 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tocat(struct __pyx_obj_8_cdec_sa_Alphab * i = self.nonterminals.index(s) */ -static int __pyx_f_8_cdec_sa_8Alphabet_fromcat(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, char *__pyx_v_s) { +static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, char *__pyx_v_s) { int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations @@ -20828,7 +21092,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromcat(struct __pyx_obj_8_cdec_sa_Alphab * if self.first_nonterminal == -1: * self.first_nonterminal = i */ - __pyx_v_i = ((struct __pyx_vtabstruct_8_cdec_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->index(__pyx_v_self->nonterminals, __pyx_v_s); + __pyx_v_i = ((struct __pyx_vtabstruct_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 * cdef int i @@ -20881,7 +21145,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromcat(struct __pyx_obj_8_cdec_sa_Alphab * * cdef char* tostring(self, int sym): */ - __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_8_cdec_sa_INDEX_SHIFT)); + __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_3_sa_INDEX_SHIFT)); goto __pyx_L0; __pyx_r = 0; @@ -20898,7 +21162,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromcat(struct __pyx_obj_8_cdec_sa_Alphab * if self.isvar(sym): */ -static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_v_ind; char *__pyx_r; __Pyx_RefNannyDeclarations @@ -20920,7 +21184,7 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp * if sym in self.id2sym: * return self.id2sym[sym] */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->isvar(__pyx_v_self, __pyx_v_sym); + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->isvar(__pyx_v_self, __pyx_v_sym); if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":54 @@ -20928,12 +21192,13 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp * 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;} + 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_3 = ((PyDict_Contains(((PyObject *)__pyx_v_self->id2sym), __pyx_t_2))); if (unlikely(__pyx_t_3 < 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; @@ -20943,9 +21208,13 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp * 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); 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 = PyBytes_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;} @@ -20956,17 +21225,17 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); + __pyx_v_ind = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":58 - * + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":57 + * return self.id2sym[sym] * ind = self.getindex(sym) * if ind > 0: # <<<<<<<<<<<<<< * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) @@ -20975,18 +21244,18 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp __pyx_t_3 = (__pyx_v_ind > 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = 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_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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)); @@ -20994,42 +21263,54 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp __Pyx_GIVEREF(__pyx_t_5); __pyx_t_2 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((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 (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_5), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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) {__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*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = 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_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((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 (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_6), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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) {__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:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":61 * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) * return self.id2sym[sym] # <<<<<<<<<<<<<< - * * else: + * return self.terminals.word(sym) */ - __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); 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 = PyBytes_AsString(__pyx_t_6); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyBytes_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; @@ -21037,14 +21318,14 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":65 - * + /* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); goto __pyx_L0; } __pyx_L3:; @@ -21055,14 +21336,14 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_cdec_sa.Alphabet.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_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":67 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":65 * return self.terminals.word(sym) * * cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<< @@ -21070,7 +21351,7 @@ static char *__pyx_f_8_cdec_sa_8Alphabet_tostring(struct __pyx_obj_8_cdec_sa_Alp * cdef char *comma */ -static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self, char *__pyx_v_s, int __pyx_v_terminal) { +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) { char *__pyx_v_comma; int __pyx_v_n; char *__pyx_v_sep; @@ -21090,7 +21371,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fromstring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":69 * cdef char *comma * cdef int n * n = strlen(s) # <<<<<<<<<<<<<< @@ -21099,7 +21380,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ __pyx_v_n = strlen(__pyx_v_s); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":71 * n = strlen(s) * cdef char *sep * sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<< @@ -21108,7 +21389,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ __pyx_v_sep = strstr(__pyx_v_s, __pyx_k___SEP_); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/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: # <<<<<<<<<<<<<< @@ -21136,7 +21417,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/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: # <<<<<<<<<<<<<< @@ -21145,36 +21426,36 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ if (__pyx_v_terminal) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = 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_63), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_kp_s_63), ((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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":75 * if terminal: * s1 = "\\"+s * return self.terminals.index(s1) # <<<<<<<<<<<<<< * s[n-1] = c'\0' * s = s + 1 */ - __pyx_t_8 = PyBytes_AsString(__pyx_v_s1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_t_8); + __pyx_t_8 = PyBytes_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); goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":76 * s1 = "\\"+s * return self.terminals.index(s1) * s[n-1] = c'\0' # <<<<<<<<<<<<<< @@ -21183,7 +21464,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ (__pyx_v_s[(__pyx_v_n - 1)]) = '\x00'; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":77 * return self.terminals.index(s1) * s[n-1] = c'\0' * s = s + 1 # <<<<<<<<<<<<<< @@ -21192,7 +21473,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ __pyx_v_s = (__pyx_v_s + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":78 * s[n-1] = c'\0' * s = s + 1 * comma = strrchr(s, c',') # <<<<<<<<<<<<<< @@ -21201,7 +21482,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ __pyx_v_comma = strrchr(__pyx_v_s, ','); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":79 * s = s + 1 * comma = strrchr(s, c',') * if comma != NULL: # <<<<<<<<<<<<<< @@ -21211,7 +21492,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp __pyx_t_2 = (__pyx_v_comma != NULL); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":80 * comma = strrchr(s, c',') * if comma != NULL: * comma[0] = c'\0' # <<<<<<<<<<<<<< @@ -21220,27 +21501,27 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp */ (__pyx_v_comma[0]) = '\x00'; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->setindex(__pyx_v_self, ((struct __pyx_vtabstruct_8_cdec_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_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)); goto __pyx_L0; goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); goto __pyx_L0; } __pyx_L5:; @@ -21248,14 +21529,14 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":85 * return self.fromcat(s) * else: * return self.terminals.index(s) # <<<<<<<<<<<<<< * * cdef Alphabet ALPHABET = Alphabet() */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); goto __pyx_L0; } __pyx_L3:; @@ -21265,7 +21546,7 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("_cdec_sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_s1); @@ -21274,12 +21555,12 @@ static int __pyx_f_8_cdec_sa_8Alphabet_fromstring(struct __pyx_obj_8_cdec_sa_Alp } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_8_cdec_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -21292,7 +21573,7 @@ static PyObject *__pyx_pw_8_cdec_sa_8Alphabet_9terminals_1__get__(PyObject *__py * cdef dict id2sym */ -static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_9terminals___get__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -21309,17 +21590,17 @@ static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_9terminals___get__(struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_8_cdec_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_8_cdec_sa_Alphabet *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -21335,84 +21616,162 @@ static PyObject *__pyx_pf_8_cdec_sa_8Alphabet_12nonterminals___get__(struct __py return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_3sym_tostring(PyObject *__pyx_self, PyObject *__pyx_arg_sym); /*proto*/ -static PyMethodDef __pyx_mdef_8_cdec_sa_3sym_tostring = {__Pyx_NAMESTR("sym_tostring"), (PyCFunction)__pyx_pw_8_cdec_sa_3sym_tostring, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_8_cdec_sa_3sym_tostring(PyObject *__pyx_self, PyObject *__pyx_arg_sym) { - int __pyx_v_sym; - PyObject *__pyx_r = 0; +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":89 + * cdef Alphabet ALPHABET = Alphabet() + * + * cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.tostring(sym) + * + */ + +static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { + char *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_tostring (wrapper)", 0); - __pyx_self = __pyx_self; - assert(__pyx_arg_sym); { - __pyx_v_sym = __Pyx_PyInt_AsInt(__pyx_arg_sym); if (unlikely((__pyx_v_sym == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.sym_tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannySetupContext("sym_tostring", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/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); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_2sym_tostring(__pyx_self, ((int)__pyx_v_sym)); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":92 + * return ALPHABET.tostring(sym) + * + * cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.tocat(sym) + * + */ + +static char *__pyx_f_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 + * + * 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); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":91 - * cdef Alphabet ALPHABET = Alphabet() +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":95 + * return ALPHABET.tocat(sym) * - * def sym_tostring(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.tostring(sym) + * cdef int sym_isvar(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.isvar(sym) * */ -static PyObject *__pyx_pf_8_cdec_sa_2sym_tostring(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sym) { - PyObject *__pyx_r = NULL; +static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { + 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("sym_tostring", 0); + __Pyx_RefNannySetupContext("sym_isvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":96 * - * def sym_tostring(int sym): - * return ALPHABET.tostring(sym) # <<<<<<<<<<<<<< + * cdef int sym_isvar(int sym): + * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< * - * def sym_fromstring(bytes string, bint terminal): + * cdef int sym_getindex(int sym): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_sym)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_3_sa_ALPHABET, __pyx_v_sym); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":98 + * return ALPHABET.isvar(sym) + * + * cdef int sym_getindex(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.getindex(sym) + * + */ + +static int __pyx_f_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 + * + * 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); goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.sym_tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/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_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 + * + * cdef int sym_setindex(int sym, int id): + * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< + * + * def sym_fromstring(bytes 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); + goto __pyx_L0; + + __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_5sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8_cdec_sa_5sym_fromstring = {__Pyx_NAMESTR("sym_fromstring"), (PyCFunction)__pyx_pw_8_cdec_sa_5sym_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_8_cdec_sa_5sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_3sym_fromstring = {__Pyx_NAMESTR("sym_fromstring"), (PyCFunction)__pyx_pw_3_sa_3sym_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_string = 0; int __pyx_v_terminal; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__string,&__pyx_n_s__terminal,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_fromstring (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__string,&__pyx_n_s__terminal,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -21426,18 +21785,16 @@ static PyObject *__pyx_pw_8_cdec_sa_5sym_fromstring(PyObject *__pyx_self, PyObje kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__terminal); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__terminal)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, 1); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, 1); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sym_fromstring") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sym_fromstring") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -21446,18 +21803,18 @@ static PyObject *__pyx_pw_8_cdec_sa_5sym_fromstring(PyObject *__pyx_self, PyObje values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_string = ((PyObject*)values[0]); - __pyx_v_terminal = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_terminal = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyBytes_Type), 1, "string", 1))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_4sym_fromstring(__pyx_self, __pyx_v_string, __pyx_v_terminal); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyBytes_Type), 1, "string", 1))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_2sym_fromstring(__pyx_self, __pyx_v_string, __pyx_v_terminal); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -21466,15 +21823,14 @@ static PyObject *__pyx_pw_8_cdec_sa_5sym_fromstring(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":94 - * return ALPHABET.tostring(sym) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104 + * return ALPHABET.setindex(sym, id) * * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<< * return ALPHABET.fromstring(string, terminal) - * */ -static PyObject *__pyx_pf_8_cdec_sa_4sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal) { +static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; @@ -21484,16 +21840,14 @@ static PyObject *__pyx_pf_8_cdec_sa_4sym_fromstring(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sym_fromstring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":105 * * def sym_fromstring(bytes string, bint terminal): * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< - * - * def sym_isvar(int sym): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_string)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_8_cdec_sa_ALPHABET, __pyx_t_1, __pyx_v_terminal)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_string)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_t_1, __pyx_v_terminal)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -21503,73 +21857,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4sym_fromstring(CYTHON_UNUSED PyObject *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.sym_fromstring", __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_8_cdec_sa_7sym_isvar(PyObject *__pyx_self, PyObject *__pyx_arg_sym); /*proto*/ -static PyMethodDef __pyx_mdef_8_cdec_sa_7sym_isvar = {__Pyx_NAMESTR("sym_isvar"), (PyCFunction)__pyx_pw_8_cdec_sa_7sym_isvar, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_8_cdec_sa_7sym_isvar(PyObject *__pyx_self, PyObject *__pyx_arg_sym) { - int __pyx_v_sym; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_isvar (wrapper)", 0); - __pyx_self = __pyx_self; - assert(__pyx_arg_sym); { - __pyx_v_sym = __Pyx_PyInt_AsInt(__pyx_arg_sym); if (unlikely((__pyx_v_sym == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.sym_isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_6sym_isvar(__pyx_self, ((int)__pyx_v_sym)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":97 - * return ALPHABET.fromstring(string, terminal) - * - * def sym_isvar(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.isvar(sym) - * - */ - -static PyObject *__pyx_pf_8_cdec_sa_6sym_isvar(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sym) { - 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("sym_isvar", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":98 - * - * def sym_isvar(int sym): - * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< - * - * cdef int sym_setindex(int sym, int id): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_sym)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 98; __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.sym_isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21577,41 +21865,15 @@ static PyObject *__pyx_pf_8_cdec_sa_6sym_isvar(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":100 - * return ALPHABET.isvar(sym) - * - * cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<< - * return ALPHABET.setindex(sym, id) - */ - -static int __pyx_f_8_cdec_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":101 - * - * cdef int sym_setindex(int sym, int id): - * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< - */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_sym, __pyx_v_id); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_words = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__words,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; @@ -21624,12 +21886,11 @@ static int __pyx_pw_8_cdec_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObjec kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__words); - if (likely(values[0])) kw_args--; + 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 = 8; __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 = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -21640,26 +21901,26 @@ static int __pyx_pw_8_cdec_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObjec } 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 = 8; __pyx_clineno = __LINE__; goto __pyx_L3_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.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase___cinit__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), __pyx_v_words); + __pyx_r = __pyx_pf_3_sa_6Phrase___cinit__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":8 - * cdef int n, *varpos, n_vars +/* "/Users/vchahun/Sandbox/cdec/python/src/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_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { +static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_n; @@ -21675,7 +21936,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":10 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":8 * def __cinit__(self, words): * cdef int i, j, n, n_vars * n_vars = 0 # <<<<<<<<<<<<<< @@ -21684,17 +21945,17 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras */ __pyx_v_n_vars = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":11 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":9 * cdef int i, j, n, n_vars * n_vars = 0 * n = len(words) # <<<<<<<<<<<<<< * self.syms = <int *>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 = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":12 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":10 * n_vars = 0 * n = len(words) * self.syms = <int *>malloc(n*sizeof(int)) # <<<<<<<<<<<<<< @@ -21703,42 +21964,42 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras */ __pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":11 * n = len(words) * self.syms = <int *>malloc(n*sizeof(int)) * for i from 0 <= i < n: # <<<<<<<<<<<<<< * self.syms[i] = words[i] - * if ALPHABET.isvar(self.syms[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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":12 * self.syms = <int *>malloc(n*sizeof(int)) * for i from 0 <= i < n: * self.syms[i] = words[i] # <<<<<<<<<<<<<< - * if ALPHABET.isvar(self.syms[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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_words, __pyx_v_i, sizeof(int), PyInt_FromLong); 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 = 14; __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 = 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":13 * for i from 0 <= i < n: * self.syms[i] = words[i] - * if ALPHABET.isvar(self.syms[i]): # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * n_vars += 1 * self.n = n */ - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, (__pyx_v_self->syms[__pyx_v_i])); + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":14 * self.syms[i] = words[i] - * if ALPHABET.isvar(self.syms[i]): + * if sym_isvar(self.syms[i]): * n_vars += 1 # <<<<<<<<<<<<<< * self.n = n * self.n_vars = n_vars @@ -21749,8 +22010,8 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":17 - * if ALPHABET.isvar(self.syms[i]): + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":15 + * if sym_isvar(self.syms[i]): * n_vars += 1 * self.n = n # <<<<<<<<<<<<<< * self.n_vars = n_vars @@ -21758,7 +22019,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras */ __pyx_v_self->n = __pyx_v_n; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":16 * n_vars += 1 * self.n = n * self.n_vars = n_vars # <<<<<<<<<<<<<< @@ -21767,7 +22028,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras */ __pyx_v_self->n_vars = __pyx_v_n_vars; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":17 * self.n = n * self.n_vars = n_vars * self.varpos = <int *>malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<< @@ -21776,46 +22037,46 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras */ __pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":18 * self.n_vars = n_vars * self.varpos = <int *>malloc(n_vars*sizeof(int)) * j = 0 # <<<<<<<<<<<<<< * for i from 0 <= i < n: - * if ALPHABET.isvar(self.syms[i]): + * if sym_isvar(self.syms[i]): */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":19 * self.varpos = <int *>malloc(n_vars*sizeof(int)) * j = 0 * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * if ALPHABET.isvar(self.syms[i]): + * 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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":20 * j = 0 * for i from 0 <= i < n: - * if ALPHABET.isvar(self.syms[i]): # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * self.varpos[j] = i * j = j + 1 */ - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, (__pyx_v_self->syms[__pyx_v_i])); + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":21 * for i from 0 <= i < n: - * if ALPHABET.isvar(self.syms[i]): + * if sym_isvar(self.syms[i]): * self.varpos[j] = i # <<<<<<<<<<<<<< * j = j + 1 * */ (__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":24 - * if ALPHABET.isvar(self.syms[i]): + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":22 + * if sym_isvar(self.syms[i]): * self.varpos[j] = i * j = j + 1 # <<<<<<<<<<<<<< * @@ -21831,7 +22092,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -21839,15 +22100,15 @@ static int __pyx_pf_8_cdec_sa_6Phrase___cinit__(struct __pyx_obj_8_cdec_sa_Phras } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_6Phrase_2__dealloc__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_pf_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":26 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":24 * j = j + 1 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21855,11 +22116,11 @@ static void __pyx_pw_8_cdec_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { * free(self.varpos) */ -static void __pyx_pf_8_cdec_sa_6Phrase_2__dealloc__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":25 * * def __dealloc__(self): * free(self.syms) # <<<<<<<<<<<<<< @@ -21868,7 +22129,7 @@ static void __pyx_pf_8_cdec_sa_6Phrase_2__dealloc__(struct __pyx_obj_8_cdec_sa_P */ free(__pyx_v_self->syms); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":26 * def __dealloc__(self): * free(self.syms) * free(self.varpos) # <<<<<<<<<<<<<< @@ -21881,17 +22142,17 @@ static void __pyx_pf_8_cdec_sa_6Phrase_2__dealloc__(struct __pyx_obj_8_cdec_sa_P } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_4__str__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_4__str__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":30 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":28 * free(self.varpos) * * def __str__(self): # <<<<<<<<<<<<<< @@ -21899,7 +22160,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { * cdef int i, s */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_4__str__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_strs = NULL; int __pyx_v_i; int __pyx_v_s; @@ -21915,66 +22176,66 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_4__str__(struct __pyx_obj_8_cdec_sa_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = 31; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_strs = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":31 * strs = [] * cdef int i, s * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< * s = self.syms[i] - * strs.append(ALPHABET.tostring(s)) + * 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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":32 * cdef int i, s * for i from 0 <= i < self.n: * s = self.syms[i] # <<<<<<<<<<<<<< - * strs.append(ALPHABET.tostring(s)) + * strs.append(sym_tostring(s)) * return " ".join(strs) */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":35 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":33 * for i from 0 <= i < self.n: * s = self.syms[i] - * strs.append(ALPHABET.tostring(s)) # <<<<<<<<<<<<<< + * strs.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return " ".join(strs) * */ - __pyx_t_1 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = 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_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyList_Append(__pyx_v_strs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = 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":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":34 * s = self.syms[i] - * strs.append(ALPHABET.tostring(s)) + * strs.append(sym_tostring(s)) * return " ".join(strs) # <<<<<<<<<<<<<< * * def handle(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __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 = 36; __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 = 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 = 36; __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[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; @@ -21988,7 +22249,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_4__str__(struct __pyx_obj_8_cdec_sa_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_strs); @@ -21998,18 +22259,18 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_4__str__(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8_cdec_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("handle (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_6handle(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_6handle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":38 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":36 * return " ".join(strs) * * def handle(self): # <<<<<<<<<<<<<< @@ -22017,7 +22278,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTH * of the nonterminal indices""" */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_norm = NULL; int __pyx_v_i; int __pyx_v_j; @@ -22033,19 +22294,19 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = 41; __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_norm = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":41 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -22054,7 +22315,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":42 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -22063,47 +22324,47 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":43 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< * s = self.syms[j] - * if ALPHABET.isvar(s): + * 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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":44 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) + * if sym_isvar(s): + * s = sym_setindex(s,i) */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":45 * for j from 0 <= j < self.n: * s = self.syms[j] - * if ALPHABET.isvar(s): # <<<<<<<<<<<<<< - * s = ALPHABET.setindex(s,i) + * if sym_isvar(s): # <<<<<<<<<<<<<< + * s = sym_setindex(s,i) * i = i + 1 */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s); + __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_v_s); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":46 * s = self.syms[j] - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) # <<<<<<<<<<<<<< + * if sym_isvar(s): + * s = sym_setindex(s,i) # <<<<<<<<<<<<<< * i = i + 1 * norm.append(s) */ - __pyx_v_s = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s, __pyx_v_i); + __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":49 - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":47 + * if sym_isvar(s): + * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< * norm.append(s) * return tuple(norm) @@ -22113,20 +22374,20 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":50 - * s = ALPHABET.setindex(s,i) + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyList_Append(__pyx_v_norm, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = 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; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":49 * i = i + 1 * norm.append(s) * return tuple(norm) # <<<<<<<<<<<<<< @@ -22134,7 +22395,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P * 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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; @@ -22144,7 +22405,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_norm); @@ -22154,17 +22415,17 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_6handle(struct __pyx_obj_8_cdec_sa_P } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("strhandle (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_8strhandle(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_8strhandle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":53 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":51 * return tuple(norm) * * def strhandle(self): # <<<<<<<<<<<<<< @@ -22172,7 +22433,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, C * norm = [] */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { CYTHON_UNUSED PyObject *__pyx_v_strs = NULL; PyObject *__pyx_v_norm = NULL; int __pyx_v_i; @@ -22191,31 +22452,31 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("strhandle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/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 = 54; __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_strs = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":55 + /* "/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 = 55; __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_norm = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":55 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -22224,7 +22485,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":56 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -22233,49 +22494,49 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":57 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< * s = self.syms[j] - * if ALPHABET.isvar(s): + * 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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":58 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) + * if sym_isvar(s): + * s = sym_setindex(s,i) */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":59 * for j from 0 <= j < self.n: * s = self.syms[j] - * if ALPHABET.isvar(s): # <<<<<<<<<<<<<< - * s = ALPHABET.setindex(s,i) + * if sym_isvar(s): # <<<<<<<<<<<<<< + * s = sym_setindex(s,i) * i = i + 1 */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s); + __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_v_s); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":60 * s = self.syms[j] - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) # <<<<<<<<<<<<<< + * if sym_isvar(s): + * s = sym_setindex(s,i) # <<<<<<<<<<<<<< * i = i + 1 - * norm.append(ALPHABET.tostring(s)) + * norm.append(sym_tostring(s)) */ - __pyx_v_s = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s, __pyx_v_i); + __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":63 - * if ALPHABET.isvar(s): - * s = ALPHABET.setindex(s,i) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":61 + * if sym_isvar(s): + * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< - * norm.append(ALPHABET.tostring(s)) + * norm.append(sym_tostring(s)) * return " ".join(norm) */ __pyx_v_i = (__pyx_v_i + 1); @@ -22283,35 +22544,35 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":64 - * s = ALPHABET.setindex(s,i) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":62 + * s = sym_setindex(s,i) * i = i + 1 - * norm.append(ALPHABET.tostring(s)) # <<<<<<<<<<<<<< + * norm.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return " ".join(norm) * */ - __pyx_t_1 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = 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_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":63 * i = i + 1 - * norm.append(ALPHABET.tostring(s)) + * norm.append(sym_tostring(s)) * return " ".join(norm) # <<<<<<<<<<<<<< * * def arity(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __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_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __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 = 63; __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 = 65; __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 = 63; __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; @@ -22325,7 +22586,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec_sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_strs); @@ -22336,17 +22597,17 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_8strhandle(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_10arity(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_10arity(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":67 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":65 * return " ".join(norm) * * def arity(self): # <<<<<<<<<<<<<< @@ -22354,7 +22615,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTH * */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22363,7 +22624,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("arity", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":66 * * def arity(self): * return self.n_vars # <<<<<<<<<<<<<< @@ -22371,7 +22632,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_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 = 68; __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -22381,7 +22642,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22390,17 +22651,17 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_10arity(struct __pyx_obj_8_cdec_sa_P } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getvarpos (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_12getvarpos(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":70 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":68 * return self.n_vars * * def getvarpos(self, i): # <<<<<<<<<<<<<< @@ -22408,7 +22669,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, * return self.varpos[i] */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22420,28 +22681,28 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getvarpos", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":69 * * 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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); 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); 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 = 71; __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 = 69; __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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); 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_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 = 71; __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 = 69; __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":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":70 * def getvarpos(self, i): * if 0 <= i < self.n_vars: * return self.varpos[i] # <<<<<<<<<<<<<< @@ -22449,8 +22710,8 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ * 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 = 72; __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 = 72; __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 = 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_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -22459,7 +22720,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":72 * return self.varpos[i] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -22467,7 +22728,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ * def getvar(self, i): */ __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -22476,7 +22737,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22485,17 +22746,17 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_12getvarpos(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getvar (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_14getvar(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6Phrase_14getvar(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":76 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":74 * raise IndexError * * def getvar(self, i): # <<<<<<<<<<<<<< @@ -22503,7 +22764,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyO * return self.syms[self.varpos[i]] */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22515,28 +22776,28 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":75 * * 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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); 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); 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 = 77; __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 = 75; __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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); 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_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 = 77; __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 = 75; __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":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":76 * def getvar(self, i): * if 0 <= i < self.n_vars: * return self.syms[self.varpos[i]] # <<<<<<<<<<<<<< @@ -22544,8 +22805,8 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ * 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 = 78; __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 = 78; __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 = 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_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -22554,7 +22815,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":78 * return self.syms[self.varpos[i]] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -22562,7 +22823,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ * cdef int chunkpos(self, int k): */ __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -22571,7 +22832,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22579,7 +22840,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":82 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":80 * raise IndexError * * cdef int chunkpos(self, int k): # <<<<<<<<<<<<<< @@ -22587,13 +22848,13 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_14getvar(struct __pyx_obj_8_cdec_sa_ * return 0 */ -static int __pyx_f_8_cdec_sa_6Phrase_chunkpos(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, int __pyx_v_k) { +int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_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":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":81 * * cdef int chunkpos(self, int k): * if k == 0: # <<<<<<<<<<<<<< @@ -22603,7 +22864,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunkpos(struct __pyx_obj_8_cdec_sa_Phrase __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":82 * cdef int chunkpos(self, int k): * if k == 0: * return 0 # <<<<<<<<<<<<<< @@ -22616,7 +22877,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunkpos(struct __pyx_obj_8_cdec_sa_Phrase } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":84 * return 0 * else: * return self.varpos[k-1]+1 # <<<<<<<<<<<<<< @@ -22634,7 +22895,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunkpos(struct __pyx_obj_8_cdec_sa_Phrase return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":88 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":86 * return self.varpos[k-1]+1 * * cdef int chunklen(self, int k): # <<<<<<<<<<<<<< @@ -22642,13 +22903,13 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunkpos(struct __pyx_obj_8_cdec_sa_Phrase * return self.n */ -static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, int __pyx_v_k) { +int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_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":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":87 * * cdef int chunklen(self, int k): * if self.n_vars == 0: # <<<<<<<<<<<<<< @@ -22658,7 +22919,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase __pyx_t_1 = (__pyx_v_self->n_vars == 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":88 * cdef int chunklen(self, int k): * if self.n_vars == 0: * return self.n # <<<<<<<<<<<<<< @@ -22670,7 +22931,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":89 * if self.n_vars == 0: * return self.n * elif k == 0: # <<<<<<<<<<<<<< @@ -22680,7 +22941,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":90 * return self.n * elif k == 0: * return self.varpos[0] # <<<<<<<<<<<<<< @@ -22692,7 +22953,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":91 * elif k == 0: * return self.varpos[0] * elif k == self.n_vars: # <<<<<<<<<<<<<< @@ -22702,7 +22963,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase __pyx_t_1 = (__pyx_v_k == __pyx_v_self->n_vars); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":92 * return self.varpos[0] * elif k == self.n_vars: * return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -22715,7 +22976,7 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":94 * return self.n-self.varpos[k-1]-1 * else: * return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -22734,17 +22995,17 @@ static int __pyx_f_8_cdec_sa_6Phrase_chunklen(struct __pyx_obj_8_cdec_sa_Phrase } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clen (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_16clen(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); + __pyx_r = __pyx_pf_3_sa_6Phrase_16clen(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":98 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":96 * return self.varpos[k]-self.varpos[k-1]-1 * * def clen(self, k): # <<<<<<<<<<<<<< @@ -22752,7 +23013,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { +static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -22762,7 +23023,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Ph int __pyx_clineno = 0; __Pyx_RefNannySetupContext("clen", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":97 * * def clen(self, k): * return self.chunklen(k) # <<<<<<<<<<<<<< @@ -22770,8 +23031,8 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Ph * 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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_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 = 99; __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 = 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_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -22781,7 +23042,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Ph goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22790,17 +23051,17 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_16clen(struct __pyx_obj_8_cdec_sa_Ph } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getchunk (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_18getchunk(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); + __pyx_r = __pyx_pf_3_sa_6Phrase_18getchunk(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":101 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":99 * return self.chunklen(k) * * def getchunk(self, ci): # <<<<<<<<<<<<<< @@ -22808,7 +23069,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, P * start = self.chunkpos(ci) */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { +static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_chunk = NULL; @@ -22823,39 +23084,39 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getchunk", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":101 * 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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_start = ((struct __pyx_vtabstruct_8_cdec_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 = 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":102 * 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_stop = (__pyx_v_start + ((struct __pyx_vtabstruct_8_cdec_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 = 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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":103 * 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 = 105; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_chunk = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":104 * stop = start+self.chunklen(ci) * chunk = [] * for i from start <= i < stop: # <<<<<<<<<<<<<< @@ -22865,20 +23126,20 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_s __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":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":105 * 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 = 107; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":106 * for i from start <= i < stop: * chunk.append(self.syms[i]) * return chunk # <<<<<<<<<<<<<< @@ -22894,7 +23155,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_chunk); @@ -22905,18 +23166,18 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_18getchunk(struct __pyx_obj_8_cdec_s /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pw_8_cdec_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_8_cdec_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_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":110 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":108 * return chunk * * def __cmp__(self, other): # <<<<<<<<<<<<<< @@ -22925,8 +23186,8 @@ static int __pyx_pw_8_cdec_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_otherp = 0; +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; int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations @@ -22939,18 +23200,18 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":111 * 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_8_cdec_sa_Phrase))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_INCREF(__pyx_v_other); - __pyx_v_otherp = ((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_other); + __pyx_v_otherp = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_other); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":112 * cdef int i * otherp = other * for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<< @@ -22967,7 +23228,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __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":115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":113 * otherp = other * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<< @@ -22977,7 +23238,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_t_4 = ((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":114 * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: * return -1 # <<<<<<<<<<<<<< @@ -22989,7 +23250,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":115 * if self.syms[i] < otherp.syms[i]: * return -1 * elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<< @@ -22999,7 +23260,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_t_4 = ((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":116 * return -1 * elif self.syms[i] > otherp.syms[i]: * return 1 # <<<<<<<<<<<<<< @@ -23013,7 +23274,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":117 * elif self.syms[i] > otherp.syms[i]: * return 1 * if self.n < otherp.n: # <<<<<<<<<<<<<< @@ -23023,7 +23284,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_t_4 = (__pyx_v_self->n < __pyx_v_otherp->n); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":118 * return 1 * if self.n < otherp.n: * return -1 # <<<<<<<<<<<<<< @@ -23035,7 +23296,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras goto __pyx_L6; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":119 * if self.n < otherp.n: * return -1 * elif self.n > otherp.n: # <<<<<<<<<<<<<< @@ -23045,7 +23306,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_t_4 = (__pyx_v_self->n > __pyx_v_otherp->n); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":120 * return -1 * elif self.n > otherp.n: * return 1 # <<<<<<<<<<<<<< @@ -23058,7 +23319,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":124 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":122 * return 1 * else: * return 0 # <<<<<<<<<<<<<< @@ -23073,7 +23334,7 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_otherp); @@ -23083,17 +23344,17 @@ static int __pyx_pf_8_cdec_sa_6Phrase_20__cmp__(struct __pyx_obj_8_cdec_sa_Phras #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static Py_hash_t __pyx_pw_8_cdec_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_8_cdec_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { +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) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_22__hash__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_22__hash__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":126 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":124 * return 0 * * def __hash__(self): # <<<<<<<<<<<<<< @@ -23101,7 +23362,7 @@ static Py_hash_t __pyx_pw_8_cdec_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { * cdef unsigned h */ -static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { int __pyx_v_i; unsigned int __pyx_v_h; Py_hash_t __pyx_r; @@ -23110,7 +23371,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s int __pyx_t_2; __Pyx_RefNannySetupContext("__hash__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":127 * cdef int i * cdef unsigned h * h = 0 # <<<<<<<<<<<<<< @@ -23119,7 +23380,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s */ __pyx_v_h = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":128 * cdef unsigned h * h = 0 * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< @@ -23129,7 +23390,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s __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":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":129 * h = 0 * for i from 0 <= i < self.n: * if self.syms[i] > 0: # <<<<<<<<<<<<<< @@ -23139,7 +23400,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s __pyx_t_2 = ((__pyx_v_self->syms[__pyx_v_i]) > 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":130 * for i from 0 <= i < self.n: * if self.syms[i] > 0: * h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<< @@ -23151,7 +23412,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":132 * h = (h << 1) + self.syms[i] * else: * h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<< @@ -23163,7 +23424,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":133 * else: * h = (h << 1) + -self.syms[i] * return h # <<<<<<<<<<<<<< @@ -23181,17 +23442,17 @@ static Py_hash_t __pyx_pf_8_cdec_sa_6Phrase_22__hash__(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static Py_ssize_t __pyx_pw_8_cdec_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_8_cdec_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_24__len__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_24__len__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":137 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":135 * return h * * def __len__(self): # <<<<<<<<<<<<<< @@ -23199,12 +23460,12 @@ static Py_ssize_t __pyx_pw_8_cdec_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_8_cdec_sa_6Phrase_24__len__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_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":138 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":136 * * def __len__(self): * return self.n # <<<<<<<<<<<<<< @@ -23221,17 +23482,17 @@ static Py_ssize_t __pyx_pf_8_cdec_sa_6Phrase_24__len__(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_26__getitem__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":140 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":138 * return self.n * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -23239,7 +23500,7 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_26__getitem__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -23249,7 +23510,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_26__getitem__(struct __pyx_obj_8_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":139 * * def __getitem__(self, i): * return self.syms[i] # <<<<<<<<<<<<<< @@ -23257,8 +23518,8 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_26__getitem__(struct __pyx_obj_8_cde * 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 = 141; __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 = 141; __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 = 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_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -23268,118 +23529,142 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_26__getitem__(struct __pyx_obj_8_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Phrase.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_30generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_28__iter__(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_6Phrase_28__iter__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":143 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 * return self.syms[i] * * def __iter__(self): # <<<<<<<<<<<<<< * cdef int i - * l = [] + * for i from 0 <= i < self.n: */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_28__iter__(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self) { - int __pyx_v_i; - PyObject *__pyx_v_l = NULL; +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_1___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; 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_1___iter__ *)__pyx_ptype_3_sa___pyx_scope_struct_1___iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_1___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_3_sa_6Phrase_30generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":145 - * def __iter__(self): - * cdef int i - * l = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < self.n: - * l.append(self.syms[i]) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_l = __pyx_t_1; - __pyx_t_1 = 0; + __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_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_3_sa_6Phrase_30generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":143 + * def __iter__(self): * cdef int i - * l = [] * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * l.append(self.syms[i]) - * return iter(l) - */ - __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":147 - * l = [] - * for i from 0 <= i < self.n: - * l.append(self.syms[i]) # <<<<<<<<<<<<<< - * return iter(l) + * yield self.syms[i] * */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyList_Append(__pyx_v_l, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __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":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":144 + * cdef int i * for i from 0 <= i < self.n: - * l.append(self.syms[i]) - * return iter(l) # <<<<<<<<<<<<<< + * yield self.syms[i] # <<<<<<<<<<<<<< * * def subst(self, start, children): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_l)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __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); + __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_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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Phrase.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_l); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return __pyx_r; + return NULL; } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_31subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_6Phrase_31subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_children = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__children,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; @@ -23393,18 +23678,16 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_31subst(PyObject *__pyx_v_self, PyOb kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children); - if (likely(values[1])) kw_args--; + 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 = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __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 = 150; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -23417,26 +23700,26 @@ static PyObject *__pyx_pw_8_cdec_sa_6Phrase_31subst(PyObject *__pyx_v_self, PyOb } 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 = 150; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_6Phrase_30subst(((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); + __pyx_r = __pyx_pf_3_sa_6Phrase_31subst(((struct __pyx_obj_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":150 - * return iter(l) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":146 + * yield self.syms[i] * * def subst(self, start, children): # <<<<<<<<<<<<<< * cdef int i * for i from 0 <= i < self.n: */ -static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children) { +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) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -23451,37 +23734,37 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_P __Pyx_RefNannySetupContext("subst", 0); __Pyx_INCREF(__pyx_v_start); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":148 * def subst(self, start, children): * cdef int i * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * if ALPHABET.isvar(self.syms[i]): - * start = start + children[ALPHABET.getindex(self.syms[i])-1] + * 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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":149 * cdef int i * for i from 0 <= i < self.n: - * if ALPHABET.isvar(self.syms[i]): # <<<<<<<<<<<<<< - * start = start + children[ALPHABET.getindex(self.syms[i])-1] + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< + * start = start + children[sym_getindex(self.syms[i])-1] * else: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, (__pyx_v_self->syms[__pyx_v_i])); + __pyx_t_2 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":150 * for i from 0 <= i < self.n: - * if ALPHABET.isvar(self.syms[i]): - * start = start + children[ALPHABET.getindex(self.syms[i])-1] # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): + * start = start + children[sym_getindex(self.syms[i])-1] # <<<<<<<<<<<<<< * else: * start = start + (self.syms[i],) */ - __pyx_t_3 = (((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->getindex(__pyx_v_8_cdec_sa_ALPHABET, (__pyx_v_self->syms[__pyx_v_i])) - 1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __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 = 154; __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 = 150; __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); @@ -23491,21 +23774,21 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_P } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":156 - * start = start + children[ALPHABET.getindex(self.syms[i])-1] + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":152 + * 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 = 156; __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 = 152; __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 = 156; __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 = 152; __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 = 156; __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 = 152; __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); @@ -23515,12 +23798,12 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_P __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":153 * else: * start = start + (self.syms[i],) * return start # <<<<<<<<<<<<<< * - * cdef class Rule: + * property words: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_start); @@ -23532,7 +23815,7 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_P __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_start); @@ -23542,21 +23825,136 @@ static PyObject *__pyx_pf_8_cdec_sa_6Phrase_30subst(struct __pyx_obj_8_cdec_sa_P } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { + 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_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":156 + * + * property words: + * def __get__(self): # <<<<<<<<<<<<<< + * return [sym_tostring(w) for w in self if not sym_isvar(w)] + * + */ + +static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_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); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":157 + * 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 = 157; __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_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++; + #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;}; + #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++; + #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;}; + #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;} + } + 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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (!__pyx_f_3_sa_sym_isvar(__pyx_t_6)); + 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 = 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_GOTREF(((PyObject *)__pyx_t_5)); + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __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_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __Pyx_DECREF(((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("_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_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) { int __pyx_v_lhs; - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_f = 0; - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_e = 0; + struct __pyx_obj_3_sa_Phrase *__pyx_v_f = 0; + struct __pyx_obj_3_sa_Phrase *__pyx_v_e = 0; PyObject *__pyx_v_scores = 0; PyObject *__pyx_v_word_alignments = 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}; 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}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":162 * * def __cinit__(self, int lhs, Phrase f, Phrase e, * scores=None, word_alignments=None): # <<<<<<<<<<<<<< @@ -23580,20 +23978,17 @@ static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); - if (likely(values[1])) kw_args--; + 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 = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); - if (likely(values[2])) kw_args--; + 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 = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { @@ -23607,7 +24002,7 @@ static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject } } 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 = 166; __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -23620,23 +24015,23 @@ static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject 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 = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_f = ((struct __pyx_obj_8_cdec_sa_Phrase *)values[1]); - __pyx_v_e = ((struct __pyx_obj_8_cdec_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 = 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_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 = 166; __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_8_cdec_sa_Phrase, 1, "e", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_4Rule___cinit__(((struct __pyx_obj_8_cdec_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_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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -23645,15 +24040,15 @@ static int __pyx_pw_8_cdec_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":166 - * cdef public word_alignments +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":161 + * cdef class Rule: * * def __cinit__(self, int lhs, Phrase f, Phrase e, # <<<<<<<<<<<<<< * scores=None, word_alignments=None): * cdef int i, n */ -static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_f, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments) { +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) { int __pyx_v_i; int __pyx_v_n; int __pyx_r; @@ -23669,44 +24064,44 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":166 * cdef char *rest * - * if not ALPHABET.isvar(lhs): # <<<<<<<<<<<<<< + * if not sym_isvar(lhs): # <<<<<<<<<<<<<< * raise Exception('Invalid LHS symbol: %d' % lhs) * */ - __pyx_t_1 = (!((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_lhs)); + __pyx_t_1 = (!__pyx_f_3_sa_sym_isvar(__pyx_v_lhs)); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":167 * - * if not ALPHABET.isvar(lhs): + * if not sym_isvar(lhs): * raise Exception('Invalid LHS symbol: %d' % lhs) # <<<<<<<<<<<<<< * * self.lhs = lhs */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __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 = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_65), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_65), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 167; __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 = 172; __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 = 167; __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 = 172; __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 = 167; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":174 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":169 * raise Exception('Invalid LHS symbol: %d' % lhs) * * self.lhs = lhs # <<<<<<<<<<<<<< @@ -23715,7 +24110,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ */ __pyx_v_self->lhs = __pyx_v_lhs; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":175 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":170 * * self.lhs = lhs * self.f = f # <<<<<<<<<<<<<< @@ -23728,7 +24123,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); __pyx_v_self->f = __pyx_v_f; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":176 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":171 * self.lhs = lhs * self.f = f * self.e = e # <<<<<<<<<<<<<< @@ -23741,7 +24136,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __Pyx_DECREF(((PyObject *)__pyx_v_self->e)); __pyx_v_self->e = __pyx_v_e; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":173 * self.e = e * * self.word_alignments = word_alignments # <<<<<<<<<<<<<< @@ -23754,7 +24149,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __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":179 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":174 * * self.word_alignments = word_alignments * if scores is None: # <<<<<<<<<<<<<< @@ -23764,7 +24159,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __pyx_t_1 = (__pyx_v_scores == Py_None); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":175 * self.word_alignments = word_alignments * if scores is None: * self.cscores = NULL # <<<<<<<<<<<<<< @@ -23773,7 +24168,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ */ __pyx_v_self->cscores = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":176 * if scores is None: * self.cscores = NULL * self.n_scores = 0 # <<<<<<<<<<<<<< @@ -23785,17 +24180,17 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":178 * self.n_scores = 0 * else: * n = len(scores) # <<<<<<<<<<<<<< * self.cscores = <float *>malloc(n*sizeof(float)) * self.n_scores = n */ - __pyx_t_4 = PyObject_Length(__pyx_v_scores); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(__pyx_v_scores); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":179 * else: * n = len(scores) * self.cscores = <float *>malloc(n*sizeof(float)) # <<<<<<<<<<<<<< @@ -23804,7 +24199,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ */ __pyx_v_self->cscores = ((float *)malloc((__pyx_v_n * (sizeof(float))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":180 * n = len(scores) * self.cscores = <float *>malloc(n*sizeof(float)) * self.n_scores = n # <<<<<<<<<<<<<< @@ -23813,7 +24208,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ */ __pyx_v_self->n_scores = __pyx_v_n; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":181 * self.cscores = <float *>malloc(n*sizeof(float)) * self.n_scores = n * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -23823,16 +24218,16 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __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/rule.pxi":187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":182 * self.n_scores = n * for i from 0 <= i < n: * self.cscores[i] = scores[i] # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_scores, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_scores, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_self->cscores[__pyx_v_i]) = __pyx_t_6; } @@ -23844,7 +24239,7 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -23852,15 +24247,15 @@ static int __pyx_pf_8_cdec_sa_4Rule___cinit__(struct __pyx_obj_8_cdec_sa_Rule *_ } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_4Rule_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_4Rule_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_3_sa_4Rule_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_4Rule_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_4Rule_2__dealloc__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_pf_3_sa_4Rule_2__dealloc__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":189 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":184 * self.cscores[i] = scores[i] * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -23868,12 +24263,12 @@ static void __pyx_pw_8_cdec_sa_4Rule_3__dealloc__(PyObject *__pyx_v_self) { * free(self.cscores) */ -static void __pyx_pf_8_cdec_sa_4Rule_2__dealloc__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static void __pyx_pf_3_sa_4Rule_2__dealloc__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":190 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":185 * * def __dealloc__(self): * if self.cscores != NULL: # <<<<<<<<<<<<<< @@ -23883,7 +24278,7 @@ static void __pyx_pf_8_cdec_sa_4Rule_2__dealloc__(struct __pyx_obj_8_cdec_sa_Rul __pyx_t_1 = (__pyx_v_self->cscores != NULL); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":191 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":186 * def __dealloc__(self): * if self.cscores != NULL: * free(self.cscores) # <<<<<<<<<<<<<< @@ -23899,17 +24294,17 @@ static void __pyx_pf_8_cdec_sa_4Rule_2__dealloc__(struct __pyx_obj_8_cdec_sa_Rul } /* Python wrapper */ -static Py_hash_t __pyx_pw_8_cdec_sa_4Rule_5__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_8_cdec_sa_4Rule_5__hash__(PyObject *__pyx_v_self) { +static Py_hash_t __pyx_pw_3_sa_4Rule_5__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_3_sa_4Rule_5__hash__(PyObject *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_4__hash__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_4__hash__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":193 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":188 * free(self.cscores) * * def __hash__(self): # <<<<<<<<<<<<<< @@ -23917,7 +24312,7 @@ static Py_hash_t __pyx_pw_8_cdec_sa_4Rule_5__hash__(PyObject *__pyx_v_self) { * */ -static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static Py_hash_t __pyx_pf_3_sa_4Rule_4__hash__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23928,16 +24323,16 @@ static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_R int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__hash__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":194 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":189 * * 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 = 194; __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 = 189; __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 = 194; __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 = 189; __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); @@ -23948,7 +24343,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_R 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 = 194; __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 = 189; __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; @@ -23958,7 +24353,7 @@ static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_R __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; @@ -23968,13 +24363,13 @@ static Py_hash_t __pyx_pf_8_cdec_sa_4Rule_4__hash__(struct __pyx_obj_8_cdec_sa_R /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pw_8_cdec_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static int __pyx_pw_3_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_3_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_8_cdec_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_6__cmp__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_other)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule_6__cmp__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -23984,7 +24379,7 @@ static int __pyx_pw_8_cdec_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *_ } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":196 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":191 * return hash((self.lhs, self.f, self.e)) * * def __cmp__(self, Rule other): # <<<<<<<<<<<<<< @@ -23993,7 +24388,7 @@ static int __pyx_pw_8_cdec_sa_4Rule_7__cmp__(PyObject *__pyx_v_self, PyObject *_ */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_other) { +static int __pyx_pf_3_sa_4Rule_6__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24005,16 +24400,16 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":192 * * def __cmp__(self, Rule other): * return cmp((self.lhs, self.f, self.e, self.word_alignments), (other.lhs, other.f, other.e, self.word_alignments)) # <<<<<<<<<<<<<< * * def __iadd__(self, Rule other): */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 197; __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 = 192; __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 = 197; __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 = 192; __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); @@ -24028,9 +24423,9 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->word_alignments); __Pyx_GIVEREF(__pyx_v_self->word_alignments); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_other->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 197; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -24044,7 +24439,7 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ 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 = 197; __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 = 192; __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)); @@ -24052,10 +24447,10 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ __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 = 197; __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 = 192; __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 = 197; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0; @@ -24066,7 +24461,7 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -24075,13 +24470,13 @@ static int __pyx_pf_8_cdec_sa_4Rule_6__cmp__(struct __pyx_obj_8_cdec_sa_Rule *__ #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_3_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_8_cdec_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_8__iadd__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_other)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule_8__iadd__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -24090,7 +24485,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":199 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":194 * return cmp((self.lhs, self.f, self.e, self.word_alignments), (other.lhs, other.f, other.e, self.word_alignments)) * * def __iadd__(self, Rule other): # <<<<<<<<<<<<<< @@ -24098,7 +24493,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_9__iadd__(PyObject *__pyx_v_self, PyOb * raise ValueError */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_other) { +static PyObject *__pyx_pf_3_sa_4Rule_8__iadd__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other) { long __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -24109,7 +24504,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":200 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":195 * * def __iadd__(self, Rule other): * if self.n_scores != other.n_scores: # <<<<<<<<<<<<<< @@ -24119,7 +24514,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R __pyx_t_1 = (__pyx_v_self->n_scores != __pyx_v_other->n_scores); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":201 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":196 * def __iadd__(self, Rule other): * if self.n_scores != other.n_scores: * raise ValueError # <<<<<<<<<<<<<< @@ -24127,12 +24522,12 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R * self.cscores[i] = self.cscores[i] + other.cscores[i] */ __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":202 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":197 * if self.n_scores != other.n_scores: * raise ValueError * for i from 0 <= i < self.n_scores: # <<<<<<<<<<<<<< @@ -24142,7 +24537,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R __pyx_t_2 = __pyx_v_self->n_scores; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":203 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":198 * raise ValueError * for i from 0 <= i < self.n_scores: * self.cscores[i] = self.cscores[i] + other.cscores[i] # <<<<<<<<<<<<<< @@ -24152,7 +24547,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R (__pyx_v_self->cscores[__pyx_v_i]) = ((__pyx_v_self->cscores[__pyx_v_i]) + (__pyx_v_other->cscores[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":204 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":199 * for i from 0 <= i < self.n_scores: * self.cscores[i] = self.cscores[i] + other.cscores[i] * return self # <<<<<<<<<<<<<< @@ -24167,7 +24562,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.Rule.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -24176,13 +24571,13 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_8__iadd__(struct __pyx_obj_8_cdec_sa_R } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pw_3_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fmerge (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8_cdec_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_10fmerge(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_v_f)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule_10fmerge(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_f)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -24191,7 +24586,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":206 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":201 * return self * * def fmerge(self, Phrase f): # <<<<<<<<<<<<<< @@ -24199,7 +24594,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_11fmerge(PyObject *__pyx_v_self, PyObj * self.f = f */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_10fmerge(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_f) { +static PyObject *__pyx_pf_3_sa_4Rule_10fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_f) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24209,20 +24604,20 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_10fmerge(struct __pyx_obj_8_cdec_sa_Ru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fmerge", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":207 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":202 * * 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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->f), ((PyObject *)__pyx_v_f), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 202; __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[7]; __pyx_lineno = 207; __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 = 202; __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":208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":203 * def fmerge(self, Phrase f): * if self.f == f: * self.f = f # <<<<<<<<<<<<<< @@ -24242,7 +24637,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_10fmerge(struct __pyx_obj_8_cdec_sa_Ru goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -24251,17 +24646,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_10fmerge(struct __pyx_obj_8_cdec_sa_Ru } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_13arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_13arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3_sa_4Rule_13arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_13arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_12arity(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_12arity(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":210 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":205 * self.f = f * * def arity(self): # <<<<<<<<<<<<<< @@ -24269,7 +24664,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_13arity(PyObject *__pyx_v_self, CYTHON * */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_12arity(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24279,7 +24674,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rul int __pyx_clineno = 0; __Pyx_RefNannySetupContext("arity", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":206 * * def arity(self): * return self.f.arity() # <<<<<<<<<<<<<< @@ -24287,9 +24682,9 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rul * def __str__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->f), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->f), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 206; __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 = 211; __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 = 206; __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; @@ -24301,7 +24696,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rul __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -24310,17 +24705,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_12arity(struct __pyx_obj_8_cdec_sa_Rul } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_15__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_15__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_3_sa_4Rule_15__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_15__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_14__str__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_14__str__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":213 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":208 * return self.f.arity() * * def __str__(self): # <<<<<<<<<<<<<< @@ -24328,7 +24723,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_15__str__(PyObject *__pyx_v_self) { * for i from 0 <= i < self.n_scores: */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_14__str__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_v_scorestrs = NULL; long __pyx_v_i; PyObject *__pyx_v_fields = NULL; @@ -24350,86 +24745,86 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":214 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":209 * * def __str__(self): * scorestrs = [] # <<<<<<<<<<<<<< * for i from 0 <= i < self.n_scores: * scorestrs.append(str(self.cscores[i])) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 214; __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 = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_scorestrs = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":215 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":210 * def __str__(self): * scorestrs = [] * for i from 0 <= i < self.n_scores: # <<<<<<<<<<<<<< * scorestrs.append(str(self.cscores[i])) - * fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] */ __pyx_t_2 = __pyx_v_self->n_scores; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":216 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":211 * scorestrs = [] * for i from 0 <= i < self.n_scores: * scorestrs.append(str(self.cscores[i])) # <<<<<<<<<<<<<< - * fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] * if self.word_alignments is not None: */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __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[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __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[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = PyList_Append(__pyx_v_scorestrs, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_Append(__pyx_v_scorestrs, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":217 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":212 * for i from 0 <= i < self.n_scores: * scorestrs.append(str(self.cscores[i])) - * fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] # <<<<<<<<<<<<<< + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] # <<<<<<<<<<<<<< * if self.word_alignments is not None: * alignstr = [] */ - __pyx_t_1 = PyBytes_FromString(((struct __pyx_vtabstruct_8_cdec_sa_Alphabet *)__pyx_v_8_cdec_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_8_cdec_sa_ALPHABET, __pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->f)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->e)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e)); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_scorestrs)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_scorestrs)); __Pyx_GIVEREF(((PyObject *)__pyx_v_scorestrs)); - __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyList_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -24446,9 +24841,9 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R __pyx_v_fields = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":218 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":213 * scorestrs.append(str(self.cscores[i])) - * fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] * if self.word_alignments is not None: # <<<<<<<<<<<<<< * alignstr = [] * for i from 0 <= i < len(self.word_alignments): @@ -24456,19 +24851,19 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R __pyx_t_9 = (__pyx_v_self->word_alignments != Py_None); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":219 - * fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":214 + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] * if self.word_alignments is not None: * alignstr = [] # <<<<<<<<<<<<<< * for i from 0 <= i < len(self.word_alignments): * alignstr.append("%d-%d" % (self.word_alignments[i]/65536, self.word_alignments[i]%65536)) */ - __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_v_alignstr = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":220 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":215 * if self.word_alignments is not None: * alignstr = [] * for i from 0 <= i < len(self.word_alignments): # <<<<<<<<<<<<<< @@ -24477,28 +24872,28 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R */ __pyx_t_7 = __pyx_v_self->word_alignments; __Pyx_INCREF(__pyx_t_7); - __pyx_t_10 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_10; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":216 * alignstr = [] * for i from 0 <= i < len(self.word_alignments): * alignstr.append("%d-%d" % (self.word_alignments[i]/65536, self.word_alignments[i]%65536)) # <<<<<<<<<<<<<< * #for s,t in self.word_alignments: * #alignstr.append("%d-%d" % (s,t)) */ - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_self->word_alignments, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_self->word_alignments, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_int_65536); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_int_65536); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_self->word_alignments, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_self->word_alignments, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Remainder(__pyx_t_7, __pyx_int_65536); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(__pyx_t_7, __pyx_int_65536); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __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); @@ -24506,38 +24901,38 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R __Pyx_GIVEREF(__pyx_t_6); __pyx_t_8 = 0; __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_4 = PyList_Append(__pyx_v_alignstr, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_Append(__pyx_v_alignstr, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":224 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":219 * #for s,t in self.word_alignments: * #alignstr.append("%d-%d" % (s,t)) * fields.append(" ".join(alignstr)) # <<<<<<<<<<<<<< * * return " ||| ".join(fields) */ - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_64), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_alignstr)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_alignstr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_alignstr)); - __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 219; __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_7)); __pyx_t_7 = 0; - __pyx_t_4 = PyList_Append(__pyx_v_fields, __pyx_t_8); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_Append(__pyx_v_fields, __pyx_t_8); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L5; } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":226 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":221 * fields.append(" ".join(alignstr)) * * return " ||| ".join(fields) # <<<<<<<<<<<<<< @@ -24545,14 +24940,14 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R * property scores: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __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[7]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_fields)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_fields)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); - __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; @@ -24569,7 +24964,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec_sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_scorestrs); @@ -24581,17 +24976,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_14__str__(struct __pyx_obj_8_cdec_sa_R } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_6scores_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_3_sa_4Rule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_6scores_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_6scores___get__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_6scores___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":229 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":224 * * property scores: * def __get__(self): # <<<<<<<<<<<<<< @@ -24599,7 +24994,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_6scores_1__get__(PyObject *__pyx_v_sel * for i from 0 <= i < self.n_scores: */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_6scores___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_v_s = NULL; long __pyx_v_i; PyObject *__pyx_r = NULL; @@ -24611,14 +25006,14 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":230 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":225 * property scores: * def __get__(self): * s = [None]*self.n_scores # <<<<<<<<<<<<<< * for i from 0 <= i < self.n_scores: * s[i] = self.cscores[i] */ - __pyx_t_1 = PyList_New(1 * ((__pyx_v_self->n_scores<0) ? 0:__pyx_v_self->n_scores)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1 * ((__pyx_v_self->n_scores<0) ? 0:__pyx_v_self->n_scores)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_self->n_scores; __pyx_temp++) { @@ -24630,7 +25025,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cde __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":231 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":226 * def __get__(self): * s = [None]*self.n_scores * for i from 0 <= i < self.n_scores: # <<<<<<<<<<<<<< @@ -24640,20 +25035,20 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cde __pyx_t_2 = __pyx_v_self->n_scores; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":227 * s = [None]*self.n_scores * for i from 0 <= i < self.n_scores: * s[i] = self.cscores[i] # <<<<<<<<<<<<<< * return s * */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_s), __pyx_v_i, __pyx_t_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_s), __pyx_v_i, __pyx_t_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":233 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":228 * for i from 0 <= i < self.n_scores: * s[i] = self.cscores[i] * return s # <<<<<<<<<<<<<< @@ -24669,7 +25064,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Rule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_s); @@ -24679,17 +25074,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_6scores___get__(struct __pyx_obj_8_cde } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_4Rule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_s) { +static int __pyx_pw_3_sa_4Rule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/ +static int __pyx_pw_3_sa_4Rule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_s) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_s)); + __pyx_r = __pyx_pf_3_sa_4Rule_6scores_2__set__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_s)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":235 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":230 * return s * * def __set__(self, s): # <<<<<<<<<<<<<< @@ -24697,7 +25092,7 @@ static int __pyx_pw_8_cdec_sa_4Rule_6scores_3__set__(PyObject *__pyx_v_self, PyO * free(self.cscores) */ -static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_s) { +static int __pyx_pf_3_sa_4Rule_6scores_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_s) { long __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations @@ -24711,7 +25106,7 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":231 * * def __set__(self, s): * if self.cscores != NULL: # <<<<<<<<<<<<<< @@ -24721,7 +25116,7 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ __pyx_t_1 = (__pyx_v_self->cscores != NULL); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":232 * def __set__(self, s): * if self.cscores != NULL: * free(self.cscores) # <<<<<<<<<<<<<< @@ -24733,27 +25128,27 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":233 * if self.cscores != NULL: * free(self.cscores) * self.cscores = <float *>malloc(len(s)*sizeof(float)) # <<<<<<<<<<<<<< * self.n_scores = len(s) * for i from 0 <= i < self.n_scores: */ - __pyx_t_2 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->cscores = ((float *)malloc((__pyx_t_2 * (sizeof(float))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":239 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":234 * free(self.cscores) * self.cscores = <float *>malloc(len(s)*sizeof(float)) * self.n_scores = len(s) # <<<<<<<<<<<<<< * for i from 0 <= i < self.n_scores: * self.cscores[i] = s[i] */ - __pyx_t_2 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->n_scores = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":240 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":235 * self.cscores = <float *>malloc(len(s)*sizeof(float)) * self.n_scores = len(s) * for i from 0 <= i < self.n_scores: # <<<<<<<<<<<<<< @@ -24762,14 +25157,14 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ __pyx_t_3 = __pyx_v_self->n_scores; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":236 * self.n_scores = len(s) * for i from 0 <= i < self.n_scores: * self.cscores[i] = s[i] # <<<<<<<<<<<<<< */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; (__pyx_v_self->cscores[__pyx_v_i]) = __pyx_t_5; } @@ -24778,7 +25173,7 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.Rule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -24786,17 +25181,17 @@ static int __pyx_pf_8_cdec_sa_4Rule_6scores_2__set__(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_3lhs_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_3_sa_4Rule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_3lhs_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_3lhs___get__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_3lhs___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":160 +/* "_sa.pxd":8 * * cdef class Rule: * cdef public int lhs # <<<<<<<<<<<<<< @@ -24804,7 +25199,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_3lhs_1__get__(PyObject *__pyx_v_self) * cdef float *cscores */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_3lhs___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_3lhs___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24813,7 +25208,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_3lhs___get__(struct __pyx_obj_8_cdec_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __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[11]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -24823,7 +25218,7 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_3lhs___get__(struct __pyx_obj_8_cdec_s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Rule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -24832,17 +25227,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_3lhs___get__(struct __pyx_obj_8_cdec_s } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_4Rule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_3_sa_4Rule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_4Rule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_3lhs_2__set__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_4Rule_3lhs_2__set__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_4Rule_3lhs_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_4Rule_3lhs_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -24850,13 +25245,13 @@ static int __pyx_pf_8_cdec_sa_4Rule_3lhs_2__set__(struct __pyx_obj_8_cdec_sa_Rul 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[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->lhs = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.Rule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Rule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -24864,17 +25259,17 @@ static int __pyx_pf_8_cdec_sa_4Rule_3lhs_2__set__(struct __pyx_obj_8_cdec_sa_Rul } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_1f___get__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_1f___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":161 +/* "_sa.pxd":9 * cdef class Rule: * cdef public int lhs * cdef readonly Phrase f, e # <<<<<<<<<<<<<< @@ -24882,7 +25277,7 @@ static PyObject *__pyx_pw_8_cdec_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { * cdef int n_scores */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_1f___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -24899,17 +25294,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_1f___get__(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_1e___get__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_1e___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8_cdec_sa_4Rule_1e___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -24926,25 +25321,25 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_1e___get__(struct __pyx_obj_8_cdec_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_15word_alignments_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_4Rule_15word_alignments_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_3_sa_4Rule_15word_alignments_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_15word_alignments_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_15word_alignments___get__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_15word_alignments___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":164 +/* "_sa.pxd":12 * cdef float *cscores * cdef int n_scores * cdef public word_alignments # <<<<<<<<<<<<<< * - * def __cinit__(self, int lhs, Phrase f, Phrase e, + * cdef char* sym_tostring(int sym) */ -static PyObject *__pyx_pf_8_cdec_sa_4Rule_15word_alignments___get__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_15word_alignments___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -24961,17 +25356,17 @@ static PyObject *__pyx_pf_8_cdec_sa_4Rule_15word_alignments___get__(struct __pyx } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_4Rule_15word_alignments_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_15word_alignments_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_3_sa_4Rule_15word_alignments_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_4Rule_15word_alignments_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_15word_alignments_2__set__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_4Rule_15word_alignments_2__set__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_2__set__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_4Rule_15word_alignments_2__set__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -24987,17 +25382,17 @@ static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_2__set__(struct __pyx_obj_ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_4Rule_15word_alignments_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_4Rule_15word_alignments_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_3_sa_4Rule_15word_alignments_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_4Rule_15word_alignments_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_4Rule_15word_alignments_4__del__(((struct __pyx_obj_8_cdec_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_4Rule_15word_alignments_4__del__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_4__del__(struct __pyx_obj_8_cdec_sa_Rule *__pyx_v_self) { +static int __pyx_pf_3_sa_4Rule_15word_alignments_4__del__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -25020,9 +25415,9 @@ static int __pyx_pf_8_cdec_sa_4Rule_15word_alignments_4__del__(struct __pyx_obj_ * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) */ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_new_trie_node(void) { - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_r; +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; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_trie_node", 0); @@ -25033,7 +25428,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_new_trie_node(void * node.root = NULL * node.arr_len = 0 */ - __pyx_v_node = ((struct __pyx_t_8_cdec_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_8_cdec_sa__Trie_Node)))); + __pyx_v_node = ((struct __pyx_t_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Node)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":24 * cdef _Trie_Node* node @@ -25086,9 +25481,9 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_new_trie_node(void * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) */ -static struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_f_8_cdec_sa_new_trie_edge(int __pyx_v_val) { - struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_v_edge; - struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_r; +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; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_trie_edge", 0); @@ -25099,7 +25494,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_f_8_cdec_sa_new_trie_edge(int * edge.node = new_trie_node() * edge.bigger = NULL */ - __pyx_v_edge = ((struct __pyx_t_8_cdec_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_8_cdec_sa__Trie_Edge)))); + __pyx_v_edge = ((struct __pyx_t_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Edge)))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":32 * cdef _Trie_Edge* edge @@ -25108,7 +25503,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_f_8_cdec_sa_new_trie_edge(int * edge.bigger = NULL * edge.smaller = NULL */ - __pyx_v_edge->node = __pyx_f_8_cdec_sa_new_trie_node(); + __pyx_v_edge->node = __pyx_f_3_sa_new_trie_node(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":33 * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) @@ -25161,7 +25556,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_f_8_cdec_sa_new_trie_edge(int * free_trie_edge(node.root) */ -static PyObject *__pyx_f_8_cdec_sa_free_trie_node(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node) { +static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25188,7 +25583,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_node(struct __pyx_t_8_cdec_sa__Trie * free(node.arr) * */ - __pyx_t_2 = __pyx_f_8_cdec_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_3_sa_free_trie_edge(__pyx_v_node->root); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25208,7 +25603,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_node(struct __pyx_t_8_cdec_sa__Trie goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -25224,7 +25619,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_node(struct __pyx_t_8_cdec_sa__Trie * free_trie_node(edge.node) */ -static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_v_edge) { +static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__pyx_v_edge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25251,7 +25646,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie * free_trie_edge(edge.bigger) * free_trie_edge(edge.smaller) */ - __pyx_t_2 = __pyx_f_8_cdec_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_3_sa_free_trie_node(__pyx_v_edge->node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25262,7 +25657,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie * free_trie_edge(edge.smaller) * */ - __pyx_t_2 = __pyx_f_8_cdec_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_3_sa_free_trie_edge(__pyx_v_edge->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25273,7 +25668,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie * * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): */ - __pyx_t_2 = __pyx_f_8_cdec_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_3_sa_free_trie_edge(__pyx_v_edge->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __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; @@ -25284,7 +25679,7 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -25300,9 +25695,9 @@ static PyObject *__pyx_f_8_cdec_sa_free_trie_edge(struct __pyx_t_8_cdec_sa__Trie * cur = node.root */ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_find(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_v_cur; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_r; +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; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -25428,7 +25823,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_find(struct _ * new_len = node.arr_len + 1 */ -static PyObject *__pyx_f_8_cdec_sa_trie_node_data_append(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { +static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -25484,7 +25879,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_data_append(struct __pyx_t_8_cdec_s * new_len = node.arr_len + num_vals */ -static PyObject *__pyx_f_8_cdec_sa_trie_node_data_extend(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node, int *__pyx_v_vals, int __pyx_v_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) { int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -25540,9 +25935,9 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_data_extend(struct __pyx_t_8_cdec_s * cur = &node.root */ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_insert(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_8_cdec_sa__Trie_Edge **__pyx_v_cur; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_r; +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; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -25636,7 +26031,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_insert(struct * return cur[0].node * */ - (__pyx_v_cur[0]) = __pyx_f_8_cdec_sa_new_trie_edge(__pyx_v_val); + (__pyx_v_cur[0]) = __pyx_f_3_sa_new_trie_edge(__pyx_v_val); goto __pyx_L6; } __pyx_L6:; @@ -25665,8 +26060,8 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_trie_insert(struct * */ -static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_arr = 0; +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25699,9 +26094,9 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Tr * free(arr.arr) * arr.arr = <int*> malloc(node.arr_len * sizeof(int)) */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_v_arr = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_3); + __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":94 @@ -25756,7 +26151,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Tr * 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;} + if (PyObject_SetItem(__pyx_v_result, __pyx_v_prefix, ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; @@ -25768,7 +26163,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Tr * * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): */ - __pyx_t_3 = __pyx_f_8_cdec_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_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[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -25776,7 +26171,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Tr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -25793,7 +26188,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_node_to_map(struct __pyx_t_8_cdec_sa__Tr * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) */ -static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Trie_Edge *__pyx_v_edge, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25822,7 +26217,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) * prefix = prefix + (edge.val,) */ - __pyx_t_2 = __pyx_f_8_cdec_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_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[12]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25833,7 +26228,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr * prefix = prefix + (edge.val,) * trie_node_to_map(edge.node, result, prefix, include_zeros) */ - __pyx_t_2 = __pyx_f_8_cdec_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_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[12]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25844,14 +26239,14 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr * 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_t_2 = PyInt_FromLong(__pyx_v_edge->val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_t_2 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __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); @@ -25865,7 +26260,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr * * cdef class TrieMap: */ - __pyx_t_2 = __pyx_f_8_cdec_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_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[12]; __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; @@ -25877,7 +26272,7 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_prefix); @@ -25887,14 +26282,14 @@ static PyObject *__pyx_f_8_cdec_sa_trie_edge_to_map(struct __pyx_t_8_cdec_sa__Tr } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { int __pyx_v_alphabet_size; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alphabet_size,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; @@ -25907,29 +26302,28 @@ static int __pyx_pw_8_cdec_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObje kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alphabet_size); - if (likely(values[0])) kw_args--; + 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;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[12]; __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;} + __pyx_v_alphabet_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_alphabet_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_7TrieMap___cinit__(((struct __pyx_obj_8_cdec_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); + __pyx_r = __pyx_pf_3_sa_7TrieMap___cinit__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -25942,7 +26336,7 @@ static int __pyx_pw_8_cdec_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObje * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) */ -static int __pyx_pf_8_cdec_sa_7TrieMap___cinit__(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { +static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); @@ -25963,7 +26357,7 @@ static int __pyx_pf_8_cdec_sa_7TrieMap___cinit__(struct __pyx_obj_8_cdec_sa_Trie * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) * */ - __pyx_v_self->root = ((struct __pyx_t_8_cdec_sa__Trie_Node **)malloc((__pyx_v_self->V * (sizeof(struct __pyx_t_8_cdec_sa__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 *))))); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":117 * self.V = alphabet_size @@ -25972,7 +26366,7 @@ static int __pyx_pf_8_cdec_sa_7TrieMap___cinit__(struct __pyx_obj_8_cdec_sa_Trie * * */ - memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_8_cdec_sa__Trie_Node *)))); + memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *)))); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -25980,11 +26374,11 @@ static int __pyx_pf_8_cdec_sa_7TrieMap___cinit__(struct __pyx_obj_8_cdec_sa_Trie } /* Python wrapper */ -static void __pyx_pw_8_cdec_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_8_cdec_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_8_cdec_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_8_cdec_sa_TrieMap *)__pyx_v_self)); + __pyx_pf_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } @@ -25996,7 +26390,7 @@ static void __pyx_pw_8_cdec_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { * for i from 0 <= i < self.V: */ -static void __pyx_pf_8_cdec_sa_7TrieMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self) { +static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -26034,7 +26428,7 @@ static void __pyx_pf_8_cdec_sa_7TrieMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_ * free(self.root) * */ - __pyx_t_3 = __pyx_f_8_cdec_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_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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; @@ -26054,18 +26448,18 @@ static void __pyx_pf_8_cdec_sa_7TrieMap_2__dealloc__(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7TrieMap_4insert(((struct __pyx_obj_8_cdec_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_3_sa_7TrieMap_4insert(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -26078,7 +26472,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyO * cdef int i, l */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { int *__pyx_v_p; int __pyx_v_i; int __pyx_v_l; @@ -26100,7 +26494,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_ * p = <int*> 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_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __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 @@ -26129,9 +26523,9 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_ * self._insert(p,l) * free(p) */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[12]; __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_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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; } @@ -26143,7 +26537,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_ * free(p) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); + ((struct __pyx_vtabstruct_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 * p[i] = pattern[i] @@ -26158,7 +26552,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -26174,10 +26568,10 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_4insert(struct __pyx_obj_8_cdec_sa_ * cdef _Trie_Node* node */ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__insert(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len) { +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) { int __pyx_v_i; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_r; + struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -26200,7 +26594,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__insert(s * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: */ - (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_8_cdec_sa_new_trie_node(); + (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_3_sa_new_trie_node(); goto __pyx_L3; } __pyx_L3:; @@ -26231,7 +26625,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__insert(s * return node * */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); } /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":147 @@ -26251,12 +26645,12 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__insert(s } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("contains (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7TrieMap_6contains(((struct __pyx_obj_8_cdec_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_3_sa_7TrieMap_6contains(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -26269,11 +26663,11 @@ static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_7contains(PyObject *__pyx_v_self, P * cdef int i, l */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_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_8_cdec_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -26293,7 +26687,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * p = <int*> 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_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __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 @@ -26322,9 +26716,9 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * node = self._contains(p,l) * free(p) */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_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_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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; } @@ -26336,7 +26730,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * free(p) * if node == NULL: */ - __pyx_v_node = ((struct __pyx_vtabstruct_8_cdec_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_contains(__pyx_v_self, __pyx_v_p, __pyx_v_l); + __pyx_v_node = ((struct __pyx_vtabstruct_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 * p[i] = pattern[i] @@ -26365,7 +26759,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * 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_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -26382,7 +26776,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * 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_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -26394,7 +26788,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -26410,10 +26804,10 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_6contains(struct __pyx_obj_8_cdec_s * cdef _Trie_Node* node */ -static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__contains(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len) { +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) { int __pyx_v_i; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_r; + struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -26462,7 +26856,7 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__contains * i = i+1 * return node */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + __pyx_v_node = __pyx_f_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":171 * while node != NULL and i < pattern_len: @@ -26491,12 +26885,12 @@ static struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_f_8_cdec_sa_7TrieMap__contains } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("toMap (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_7TrieMap_8toMap(((struct __pyx_obj_8_cdec_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); + __pyx_r = __pyx_pf_3_sa_7TrieMap_8toMap(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -26509,7 +26903,7 @@ static PyObject *__pyx_pw_8_cdec_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyOb * */ -static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { +static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { int __pyx_v_i; int __pyx_v_include_zeros; PyObject *__pyx_v_result = NULL; @@ -26531,7 +26925,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_T * 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;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":178 @@ -26564,7 +26958,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_T * 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_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; @@ -26596,14 +26990,14 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_T * 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_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __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_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_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_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[12]; __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; @@ -26629,7 +27023,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_T __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -26639,8 +27033,8 @@ static PyObject *__pyx_pf_8_cdec_sa_7TrieMap_8toMap(struct __pyx_obj_8_cdec_sa_T } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_fsarray = 0; PyObject *__pyx_v_from_stats = 0; PyObject *__pyx_v_from_binary = 0; @@ -26650,11 +27044,11 @@ static int __pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self PyObject *__pyx_v_max_nonterminals = 0; PyObject *__pyx_v_train_max_initial_size = 0; PyObject *__pyx_v_train_min_gap_size = 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_68,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_69,&__pyx_n_s__train_min_gap_size,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_68,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_69,&__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 @@ -26738,7 +27132,7 @@ static int __pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self } } 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;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -26767,18 +27161,18 @@ static int __pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self } 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_RaiseArgtupleInvalid("__cinit__", 0, 0, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_14Precomputation___cinit__(((struct __pyx_obj_8_cdec_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_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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec_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_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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -26798,7 +27192,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_precompute_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26808,7 +27202,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_precompute_secondary_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26818,7 +27212,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_max_length); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26828,7 +27222,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_max_nonterminals); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26838,7 +27232,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_train_max_initial_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26848,7 +27242,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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_t_1 = __Pyx_PyInt_AsInt(__pyx_v_train_min_gap_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 @@ -26858,7 +27252,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":211 @@ -26868,14 +27262,14 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * elif from_stats: * self.precompute(from_stats, fsarray) */ - __pyx_t_3 = PyObject_GetAttr(((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_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __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_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __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; @@ -26890,7 +27284,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * 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;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_stats); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":213 @@ -26900,9 +27294,9 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec * * */ - __pyx_t_5 = PyObject_GetAttr(((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_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__precompute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __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); @@ -26910,7 +27304,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec __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_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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; @@ -26925,7 +27319,7 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -26933,22 +27327,22 @@ static int __pyx_pf_8_cdec_sa_14Precomputation___cinit__(struct __pyx_obj_8_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_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;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_14Precomputation_2read_binary(((struct __pyx_obj_8_cdec_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -26961,7 +27355,7 @@ static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_3read_binary(PyObject *__py * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -27041,7 +27435,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_o * self.precomputed_collocations = self.read_map(f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_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_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[12]; __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); @@ -27056,7 +27450,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_o * fclose(f) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_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_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[12]; __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); @@ -27077,7 +27471,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -27086,22 +27480,22 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_2read_binary(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +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) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_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;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_14Precomputation_4write_binary(((struct __pyx_obj_8_cdec_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -27114,7 +27508,7 @@ static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_5write_binary(PyObject *__p * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -27197,7 +27591,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_ */ __pyx_t_1 = __pyx_v_self->precomputed_index; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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_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[12]; __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; @@ -27211,7 +27605,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_ */ __pyx_t_2 = __pyx_v_self->precomputed_collocations; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_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_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[12]; __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; @@ -27230,7 +27624,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -27246,10 +27640,10 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_4write_binary(struct __pyx_ * cdef IntList arr */ -static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_m, FILE *__pyx_v_f) { +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) { int __pyx_v_i; int __pyx_v_N; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_arr = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_val = NULL; PyObject *__pyx_v_word_id = NULL; @@ -27257,15 +27651,13 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *(*__pyx_t_4)(PyObject *); + Py_ssize_t __pyx_t_3; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; + 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; @@ -27278,7 +27670,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * 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_t_1 = PyObject_Length(__pyx_v_m); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __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 @@ -27297,80 +27689,22 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_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[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + __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[12]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else { - __pyx_t_3 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __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 (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_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[11]; __pyx_lineno = 250; __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_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[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; - } + __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[12]; __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[12]; __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; @@ -27385,8 +27719,8 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: */ - __pyx_t_9 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_N = __pyx_t_9; + __pyx_t_8 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __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 * for pattern, val in m.iteritems(): @@ -27405,34 +27739,42 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * fwrite(&(i), sizeof(int), 1, f) */ if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) { - __pyx_t_3 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __pyx_t_6 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __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_10 && PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; - } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; + 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++; + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __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++; + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_6 = __pyx_t_10(__pyx_t_3); - if (unlikely(!__pyx_t_6)) { + __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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_word_id = __pyx_t_5; + __pyx_t_5 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":254 * fwrite(&(N), sizeof(int), 1, f) @@ -27441,8 +27783,8 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * fwrite(&(i), sizeof(int), 1, f) * arr = val */ - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_i = __pyx_t_11; + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __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 * for word_id in pattern: @@ -27453,7 +27795,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru */ fwrite((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); } - __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/precomputation.pxi":256 * i = word_id @@ -27462,10 +27804,10 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * arr.write_handle(f) * */ - if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8_cdec_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_3_sa_IntList))))) {__pyx_filename = __pyx_f[12]; __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_8_cdec_sa_IntList *)__pyx_v_val); + __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_val); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":257 * fwrite(&(i), sizeof(int), 1, f) @@ -27474,7 +27816,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_arr->__pyx_vtab)->write_handle(__pyx_v_arr, __pyx_v_f); + ((struct __pyx_vtabstruct_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; @@ -27482,11 +27824,9 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec_sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -27506,13 +27846,13 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_write_map(CYTHON_UNUSED stru * cdef IntList arr */ -static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, FILE *__pyx_v_f) { +static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __pyx_obj_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_8_cdec_sa_IntList *__pyx_v_arr = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; PyObject *__pyx_v_m = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_r = NULL; @@ -27533,7 +27873,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc * 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_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; @@ -27603,14 +27943,14 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc * 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_t_1 = PyInt_FromLong(__pyx_v_word_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __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_t_1 = PyNumber_Add(((PyObject *)__pyx_v_key), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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)); @@ -27625,10 +27965,10 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc * arr.read_handle(f) * m[key] = arr */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":273 @@ -27638,7 +27978,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc * m[key] = arr * return m */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); + ((struct __pyx_vtabstruct_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 * arr = IntList() @@ -27647,7 +27987,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc * 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;} + if (PyDict_SetItem(((PyObject *)__pyx_v_m), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":275 @@ -27667,7 +28007,7 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -27679,15 +28019,15 @@ static PyObject *__pyx_f_8_cdec_sa_14Precomputation_read_map(CYTHON_UNUSED struc } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_stats = 0; - struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sarray = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stats,&__pyx_n_s__sarray,0}; + struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray = 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; @@ -27701,18 +28041,16 @@ static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_7precompute(PyObject *__pyx kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stats); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stats)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sarray); - if (likely(values[1])) kw_args--; + 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;} + __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __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;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precompute") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -27721,18 +28059,18 @@ static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_7precompute(PyObject *__pyx values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_stats = values[0]; - __pyx_v_sarray = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)values[1]); + __pyx_v_sarray = ((struct __pyx_obj_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_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_14Precomputation_6precompute(((struct __pyx_obj_8_cdec_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[12]; __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -27749,7 +28087,7 @@ static PyObject *__pyx_pw_8_cdec_sa_14Precomputation_7precompute(PyObject *__pyx * cdef DataArray darray = sarray.darray */ -static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_sarray) { +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) { int __pyx_v_i; int __pyx_v_l; int __pyx_v_N; @@ -27766,15 +28104,15 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob int __pyx_v_is_super; int __pyx_v_sent_count; int __pyx_v_max_rank; - struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_darray = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_data = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_queue = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_cost_by_rank = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_count_by_rank = 0; - struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_frequent_patterns = 0; - struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_super_frequent_patterns = 0; - struct __pyx_obj_8_cdec_sa_TrieMap *__pyx_v_collocations = 0; - struct __pyx_t_8_cdec_sa__Trie_Node *__pyx_v_node; + 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; PyObject *__pyx_v_I_set = NULL; PyObject *__pyx_v_J_set = NULL; PyObject *__pyx_v_J2_set = NULL; @@ -27855,19 +28193,19 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob */ __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_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_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_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_sa_TrieMap *)__pyx_t_1); + __pyx_v_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":288 @@ -27879,19 +28217,19 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob */ __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_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_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_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_sa_TrieMap *)__pyx_t_1); + __pyx_v_super_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":289 @@ -27903,19 +28241,19 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob */ __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_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_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_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_8_cdec_sa_TrieMap *)__pyx_t_1); + __pyx_v_collocations = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":291 @@ -27925,7 +28263,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_I_set = __pyx_t_1; __pyx_t_1 = 0; @@ -27937,7 +28275,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_J_set = __pyx_t_1; __pyx_t_1 = 0; @@ -27949,7 +28287,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_J2_set = __pyx_t_1; __pyx_t_1 = 0; @@ -27961,7 +28299,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_IJ_set = __pyx_t_1; __pyx_t_1 = 0; @@ -27973,7 +28311,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * 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_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_pattern_rank = __pyx_t_1; __pyx_t_1 = 0; @@ -27985,12 +28323,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * cdef float start_time = monitor_cpu() * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __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_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__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_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_71), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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; @@ -28002,7 +28340,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * max_pattern_len = 0 */ - __pyx_v_start_time = __pyx_f_8_cdec_sa_monitor_cpu(); + __pyx_v_start_time = __pyx_f_3_sa_monitor_cpu(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":300 * cdef float start_time = monitor_cpu() @@ -28026,23 +28364,31 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __pyx_t_3 = __pyx_v_stats; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_stats); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_stats); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } 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_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __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_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -28050,21 +28396,22 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob } 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[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); __pyx_t_8 = PyList_GET_ITEM(sequence, 2); @@ -28072,10 +28419,16 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; @@ -28085,14 +28438,15 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_GOTREF(__pyx_t_7); index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } __Pyx_XDECREF(__pyx_v__); @@ -28107,7 +28461,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_rank); __pyx_v_rank = __pyx_t_1; - __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; @@ -28120,12 +28474,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * break * max_pattern_len = max(max_pattern_len, len(phrase)) */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->precompute_rank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->precompute_rank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_5, Py_GE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_5, Py_GE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_11) { @@ -28148,7 +28502,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * frequent_patterns.insert(phrase) * I_set.add(phrase) */ - __pyx_t_12 = PyObject_Length(__pyx_v_phrase); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Length(__pyx_v_phrase); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = __pyx_v_max_pattern_len; if ((__pyx_t_12 > __pyx_t_13)) { __pyx_t_14 = __pyx_t_12; @@ -28164,14 +28518,14 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * I_set.add(phrase) * pattern_rank[phrase] = rank */ - __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_phrase); __Pyx_GIVEREF(__pyx_v_phrase); - __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -28184,7 +28538,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: */ - __pyx_t_15 = PySet_Add(__pyx_v_I_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_I_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":307 * frequent_patterns.insert(phrase) @@ -28193,7 +28547,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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;} + if (PyDict_SetItem(((PyObject *)__pyx_v_pattern_rank), __pyx_v_phrase, __pyx_v_rank) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":308 * I_set.add(phrase) @@ -28202,12 +28556,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * super_frequent_patterns.insert(phrase) * J_set.add(phrase) */ - __pyx_t_7 = PyInt_FromLong(__pyx_v_self->precompute_secondary_rank); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_self->precompute_secondary_rank); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_7, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_7, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_11) { @@ -28218,14 +28572,14 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * J_set.add(phrase) * */ - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_super_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_super_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_phrase); __Pyx_GIVEREF(__pyx_v_phrase); - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __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_7)); __pyx_t_7 = 0; @@ -28238,7 +28592,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * queue = IntList(increment=1000) */ - __pyx_t_15 = PySet_Add(__pyx_v_J_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_J_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; @@ -28254,13 +28608,13 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * logger.info(" Computing inverted indexes...") */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((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_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__increment), __pyx_int_1000) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[12]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_queue = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_3); + __pyx_v_queue = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":314 @@ -28270,12 +28624,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * N = len(data) * for i from 0 <= i < N: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28287,7 +28641,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_2 = PyObject_Length(((PyObject *)__pyx_v_data)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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 @@ -28326,7 +28680,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * else: * for l from 1 <= l <= max_pattern_len: */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); goto __pyx_L11; } /*else*/ { @@ -28348,7 +28702,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if node == NULL: * break */ - __pyx_v_node = ((struct __pyx_vtabstruct_8_cdec_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_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 * for l from 1 <= l <= max_pattern_len: @@ -28379,7 +28733,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * queue._append(l) * trie_node_data_append(node, i) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); + ((struct __pyx_vtabstruct_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 * break @@ -28388,7 +28742,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); + ((struct __pyx_vtabstruct_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 * queue._append(i) @@ -28397,7 +28751,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * logger.info(" Computing collocations...") */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } @@ -28413,12 +28767,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * N = len(queue) * ptr1 = 0 */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28430,7 +28784,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_t_2 = PyObject_Length(((PyObject *)__pyx_v_queue)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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 @@ -28601,7 +28955,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: */ - __pyx_v_node = ((struct __pyx_vtabstruct_8_cdec_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_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 * l1+l2+1 <= self.max_length): @@ -28610,7 +28964,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":348 * node = collocations._insert(data.arr+i1, l1) @@ -28629,7 +28983,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":350 @@ -28639,7 +28993,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i2) * if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28650,7 +29004,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28661,7 +29015,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: * is_super = 1 */ - __pyx_t_11 = (((struct __pyx_vtabstruct_8_cdec_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); + __pyx_t_11 = (((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); if (__pyx_t_11) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":353 @@ -28671,7 +29025,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * is_super = 1 * else: */ - __pyx_t_11 = (((struct __pyx_vtabstruct_8_cdec_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); + __pyx_t_11 = (((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); if (__pyx_t_11) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":354 @@ -28809,7 +29163,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * node = trie_insert(node, -1) */ if (!__pyx_v_is_super) { - __pyx_t_11 = (((struct __pyx_vtabstruct_8_cdec_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_11 = (((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_19 = __pyx_t_11; } else { __pyx_t_19 = __pyx_v_is_super; @@ -28823,7 +29177,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: */ - __pyx_v_node = ((struct __pyx_vtabstruct_8_cdec_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_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 * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: @@ -28832,7 +29186,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":369 * node = collocations._insert(data.arr+i1, l1) @@ -28851,7 +29205,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * node = trie_insert(node, -1) * for i from i3 <= i < i3+l3: */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":371 @@ -28861,7 +29215,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for i from i3 <= i < i3+l3: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":372 * node = trie_insert(node, data.arr[i]) @@ -28880,7 +29234,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) */ - __pyx_v_node = __pyx_f_8_cdec_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":374 @@ -28890,7 +29244,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i2) * trie_node_data_append(node, i3) */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28901,7 +29255,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * trie_node_data_append(node, i3) * ptr3 = ptr3 + 2 */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -28912,7 +29266,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * ptr3 = ptr3 + 2 * ptr2 = ptr2 + 2 */ - __pyx_t_3 = __pyx_f_8_cdec_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L30; @@ -28988,14 +29342,14 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * ptr1 = ptr1 + 1 * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __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_t_3 = PyInt_FromLong(__pyx_v_sent_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_sent_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_76)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_76)); @@ -29003,7 +29357,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __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_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; @@ -29031,16 +29385,16 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * self.precomputed_index = frequent_patterns.toMap(True) * */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_collocations), __pyx_n_s__toMap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_collocations), __pyx_n_s__toMap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -29057,16 +29411,16 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * x = 0 */ - __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s__toMap); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s__toMap); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 387; __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 = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 387; __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_8, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -29093,7 +29447,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: */ - __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; for (;;) { @@ -29102,7 +29456,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_3)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29119,7 +29473,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 */ - __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; for (;;) { @@ -29128,7 +29482,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_8)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29145,8 +29499,8 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) < __pyx_v_self->max_length); if (__pyx_t_19) { @@ -29157,9 +29511,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * J2_set.add(combined_pattern) * */ - __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_77)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_77)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_v_combined_pattern); @@ -29173,7 +29527,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * for pattern1 in I_set: */ - __pyx_t_15 = PySet_Add(__pyx_v_J2_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_J2_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L40; } __pyx_L40:; @@ -29189,7 +29543,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for pattern2 in I_set: * x = x+1 */ - __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; for (;;) { @@ -29198,7 +29552,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_3)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29215,7 +29569,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: */ - __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; for (;;) { @@ -29224,7 +29578,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_7)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29241,7 +29595,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 */ - __pyx_t_7 = PyNumber_Add(__pyx_v_x, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_v_x, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_v_x); __pyx_v_x = __pyx_t_7; @@ -29254,8 +29608,8 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) */ - __pyx_t_14 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_14 == -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_14 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[12]; __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[12]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (((__pyx_t_14 + __pyx_t_2) + 1) <= __pyx_v_self->max_length); if (__pyx_t_19) { @@ -29266,9 +29620,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * IJ_set.add(combined_pattern) * */ - __pyx_t_7 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_78)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_78)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_v_combined_pattern); @@ -29282,7 +29636,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * for pattern1 in I_set: */ - __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45; } __pyx_L45:; @@ -29298,7 +29652,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for pattern2 in J2_set: * x = x+2 */ - __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; for (;;) { @@ -29307,7 +29661,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_3)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29324,7 +29678,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: */ - __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_J2_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_J2_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; for (;;) { @@ -29333,7 +29687,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob if (unlikely(!__pyx_t_8)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -29350,7 +29704,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 */ - __pyx_t_8 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_v_x); __pyx_v_x = __pyx_t_8; @@ -29363,8 +29717,8 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) <= __pyx_v_self->max_length); if (__pyx_t_19) { @@ -29375,9 +29729,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 */ - __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_79)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_79)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_v_combined_pattern); @@ -29391,7 +29745,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * combined_pattern = pattern2 + (-1,) + pattern1 * IJ_set.add(combined_pattern) */ - __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":409 * combined_pattern = pattern1 + (-1,) + pattern2 @@ -29400,9 +29754,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * IJ_set.add(combined_pattern) * */ - __pyx_t_7 = PyNumber_Add(__pyx_v_pattern2, ((PyObject *)__pyx_k_tuple_80)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_v_pattern2, ((PyObject *)__pyx_k_tuple_80)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_pattern1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_pattern1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_combined_pattern); @@ -29416,7 +29770,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * N = len(pattern_rank) */ - __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L50; } __pyx_L50:; @@ -29432,7 +29786,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * cost_by_rank = IntList(initial_len=N) * count_by_rank = IntList(initial_len=N) */ - __pyx_t_14 = PyDict_Size(((PyObject *)__pyx_v_pattern_rank)); + __pyx_t_14 = PyDict_Size(((PyObject *)__pyx_v_pattern_rank)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_N = __pyx_t_14; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":413 @@ -29442,16 +29796,16 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * count_by_rank = IntList(initial_len=N) * for pattern, arr in self.precomputed_collocations.iteritems(): */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 413; __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 = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 413; __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 = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 413; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[12]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_cost_by_rank = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_3); + __pyx_v_cost_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":414 @@ -29461,16 +29815,16 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for pattern, arr in self.precomputed_collocations.iteritems(): * if pattern not in IJ_set: */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 414; __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 414; __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 414; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __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[12]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_count_by_rank = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_count_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":415 @@ -29480,86 +29834,28 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if pattern not in IJ_set: * s = "" */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->precomputed_collocations, __pyx_n_s__iteritems); 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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_14 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_14 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); 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_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_14 = 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[12]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; - } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; - } else { - __pyx_t_3 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __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 (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_7 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L53_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L53_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L54_unpacking_done; - __pyx_L53_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L54_unpacking_done:; - } + __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_2), (&__pyx_t_13)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + while (1) { + __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_14, &__pyx_t_3, &__pyx_t_8, NULL, __pyx_t_13); + if (unlikely(__pyx_t_16 == 0)) break; + if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_pattern = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_arr = __pyx_t_8; + __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":416 * count_by_rank = IntList(initial_len=N) @@ -29568,7 +29864,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * s = "" * for word_id in pattern: */ - __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_IJ_set), __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_IJ_set), __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":417 @@ -29590,34 +29886,42 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * s = s + "X " */ if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) { - __pyx_t_3 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_20 = NULL; + __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_12 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_12 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext; } for (;;) { - if (!__pyx_t_20 && PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; - } else if (!__pyx_t_20 && PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_8)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_8)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_7 = __pyx_t_20(__pyx_t_3); - if (unlikely(!__pyx_t_7)) { + __pyx_t_3 = __pyx_t_4(__pyx_t_8); + if (unlikely(!__pyx_t_3)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_word_id = __pyx_t_3; + __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":419 * s = "" @@ -29626,10 +29930,10 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * s = s + "X " * else: */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_19) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":420 @@ -29639,12 +29943,12 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * else: * s = s + darray.id2word[word_id] + " " */ - __pyx_t_7 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_81)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_81)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L58; + __pyx_v_s = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L56; } /*else*/ { @@ -29655,21 +29959,21 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) * else: */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyNumber_Add(__pyx_v_s, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_v_s, __pyx_t_7); 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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 422; __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_t_8, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_s = __pyx_t_3; + __pyx_t_3 = 0; } - __pyx_L58:; + __pyx_L56:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":423 * else: @@ -29678,25 +29982,25 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * else: * chunk = () */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_82)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_82)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_82)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82)); __Pyx_INCREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_s); __Pyx_GIVEREF(__pyx_v_s); - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __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 = 423; __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; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L55; + goto __pyx_L53; } /*else*/ { @@ -29739,34 +30043,42 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_2 = 0; - __pyx_t_20 = NULL; + __pyx_t_7 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_2 = -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_20 = Py_TYPE(__pyx_t_8)->tp_iternext; + __pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = Py_TYPE(__pyx_t_7)->tp_iternext; } for (;;) { - if (!__pyx_t_20 && PyList_CheckExact(__pyx_t_8)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_8)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (!__pyx_t_20 && PyTuple_CheckExact(__pyx_t_8)) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_3 = __pyx_t_20(__pyx_t_8); - if (unlikely(!__pyx_t_3)) { + __pyx_t_8 = __pyx_t_4(__pyx_t_7); + if (unlikely(!__pyx_t_8)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_8); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_word_id = __pyx_t_8; + __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":429 * arity = 0 @@ -29775,10 +30087,10 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_19) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":430 @@ -29788,29 +30100,29 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * arity = arity + 1 * chunk = () */ - __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __pyx_v_max_rank; - __pyx_t_5 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_16 = __pyx_v_max_rank; + __pyx_t_5 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_19) { - __Pyx_INCREF(__pyx_t_3); - __pyx_t_7 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = __pyx_t_8; } else { - __pyx_t_6 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_t_6; + __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_max_rank = __pyx_t_13; + __pyx_v_max_rank = __pyx_t_16; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":431 * if word_id == -1: @@ -29819,11 +30131,11 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * chunk = () * else: */ - __pyx_t_7 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_arity = __pyx_t_3; + __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":432 * max_rank = max(max_rank, pattern_rank[chunk]) @@ -29835,7 +30147,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); __pyx_v_chunk = __pyx_empty_tuple; - goto __pyx_L61; + goto __pyx_L59; } /*else*/ { @@ -29846,21 +30158,21 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_word_id); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_word_id); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_word_id); __Pyx_GIVEREF(__pyx_v_word_id); - __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); - __pyx_v_chunk = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_chunk = __pyx_t_8; + __pyx_t_8 = 0; } - __pyx_L61:; + __pyx_L59:; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":435 * else: @@ -29869,29 +30181,29 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_13 = __pyx_v_max_rank; - __pyx_t_7 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __pyx_v_max_rank; + __pyx_t_3 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_19) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_6 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; + __pyx_t_8 = __pyx_t_6; __pyx_t_6 = 0; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_max_rank = __pyx_t_13; + __pyx_v_max_rank = __pyx_t_16; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":436 * chunk = chunk + (word_id,) @@ -29900,8 +30212,8 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) * */ - __pyx_t_2 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_2 == -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_2)); + __pyx_t_12 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[12]; __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_12)); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":437 * max_rank = max(max_rank, pattern_rank[chunk]) @@ -29910,26 +30222,26 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * cumul_cost = 0 */ - __pyx_t_3 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - (__pyx_v_count_by_rank->arr[__pyx_v_max_rank]) = __pyx_t_13; + (__pyx_v_count_by_rank->arr[__pyx_v_max_rank]) = __pyx_t_16; } - __pyx_L55:; + __pyx_L53:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -29970,9 +30282,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * cumul_count = cumul_count + count_by_rank.arr[i] * logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost) */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyNumber_Add(__pyx_v_cumul_cost, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_v_cumul_cost, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_cumul_cost); @@ -29986,9 +30298,9 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_6 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Add(__pyx_v_cumul_count, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_cumul_count, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_cumul_count); @@ -30002,42 +30314,42 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * num_found_patterns = len(self.precomputed_collocations) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_83)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_83)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_83)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_83)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_cumul_count); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_cumul_count); + PyTuple_SET_ITEM(__pyx_t_7, 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); + PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_v_cumul_cost); __Pyx_GIVEREF(__pyx_v_cumul_cost); __pyx_t_1 = 0; - __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __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_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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":446 @@ -30047,14 +30359,14 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * for pattern in IJ_set: * if pattern not in self.precomputed_collocations: */ - __pyx_t_3 = __pyx_v_self->precomputed_collocations; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_14 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_num_found_patterns = __pyx_t_3; - __pyx_t_3 = 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[12]; __pyx_lineno = 446; __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[12]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_v_num_found_patterns = __pyx_t_8; + __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":447 * @@ -30063,24 +30375,24 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * if pattern not in self.precomputed_collocations: * self.precomputed_collocations[pattern] = IntList() */ - __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_8 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext; for (;;) { { - __pyx_t_8 = __pyx_t_4(__pyx_t_3); - if (unlikely(!__pyx_t_8)) { + __pyx_t_7 = __pyx_t_4(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { 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;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_pattern = __pyx_t_7; + __pyx_t_7 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":448 * num_found_patterns = len(self.precomputed_collocations) @@ -30089,7 +30401,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * self.precomputed_collocations[pattern] = IntList() * */ - __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_self->precomputed_collocations, __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_self->precomputed_collocations, __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":449 @@ -30099,15 +30411,15 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * * cdef float stop_time = monitor_cpu() */ - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_L66; + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_pattern, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L64; } - __pyx_L66:; + __pyx_L64:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":451 * self.precomputed_collocations[pattern] = IntList() @@ -30116,7 +30428,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * 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_v_stop_time = __pyx_f_8_cdec_sa_monitor_cpu(); + __pyx_v_stop_time = __pyx_f_3_sa_monitor_cpu(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":452 * @@ -30125,18 +30437,18 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) * logger.info("Precomputation took %f seconds", (stop_time - start_time)) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __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_v_self->precomputed_collocations; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_14 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __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_collocations; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __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[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_kp_s_84)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_84)); @@ -30144,17 +30456,17 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_INCREF(__pyx_v_num_found_patterns); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_num_found_patterns); __Pyx_GIVEREF(__pyx_v_num_found_patterns); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __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[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __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_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":453 * cdef float stop_time = monitor_cpu() @@ -30162,56 +30474,56 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob * logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) # <<<<<<<<<<<<<< * logger.info("Precomputation took %f seconds", (stop_time - start_time)) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 453; __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_v_self->precomputed_index; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_14 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__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 = __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[12]; __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[12]; __pyx_lineno = 453; __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[12]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_85)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_85)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_85)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + 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_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 453; __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_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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":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_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __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[12]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_kp_s_86)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_86)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __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[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 454; __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_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -30223,7 +30535,7 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_darray); @@ -30261,15 +30573,15 @@ static PyObject *__pyx_pf_8_cdec_sa_14Precomputation_6precompute(struct __pyx_ob } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,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}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":11 @@ -30304,7 +30616,7 @@ static int __pyx_pw_8_cdec_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, P } } 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;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -30319,18 +30631,18 @@ static int __pyx_pw_8_cdec_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, P } 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[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 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.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); + __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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -30349,12 +30661,12 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * self.sa = IntList() * self.ha = IntList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->darray); __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); - __pyx_v_self->darray = ((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_t_1); + __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":13 @@ -30364,12 +30676,12 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * self.ha = IntList() * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sa); __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":14 @@ -30379,12 +30691,12 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_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_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":15 @@ -30394,7 +30706,7 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * 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;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[13]; __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 @@ -30404,14 +30716,14 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * elif from_text: * self.read_text(from_text) */ - __pyx_t_1 = PyObject_GetAttr(((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_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __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_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __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; @@ -30426,7 +30738,7 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * 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[12]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[13]; __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 @@ -30436,14 +30748,14 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa * * def __getitem__(self, i): */ - __pyx_t_4 = PyObject_GetAttr(((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_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __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[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __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_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_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __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; @@ -30458,7 +30770,7 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -30466,12 +30778,12 @@ static int __pyx_pf_8_cdec_sa_11SuffixArray___cinit__(struct __pyx_obj_8_cdec_sa } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -30484,7 +30796,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -30502,8 +30814,8 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(struct __pyx_obj_ * def getSentId(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[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_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __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[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -30513,7 +30825,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30522,12 +30834,12 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_2__getitem__(struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_5getSentId(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSentId (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_4getSentId(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -30540,7 +30852,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_5getSentId(PyObject *__pyx_v_s * */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_4getSentId(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -30559,14 +30871,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(struct __pyx_obj_8_ * def getSent(self, i): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSentId); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSentId); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 24; __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[12]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 24; __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[13]; __pyx_lineno = 24; __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; @@ -30580,7 +30892,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(struct __pyx_obj_8_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.getSentId", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.getSentId", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30589,12 +30901,12 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_4getSentId(struct __pyx_obj_8_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_7getSent(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSent (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_6getSent(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_6getSent(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -30607,7 +30919,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_7getSent(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_6getSent(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_6getSent(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -30626,14 +30938,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_6getSent(struct __pyx_obj_8_cd * def getSentPos(self, loc): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSent); 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_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); 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_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 27; __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[13]; __pyx_lineno = 27; __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; @@ -30647,7 +30959,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_6getSent(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.getSent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.getSent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30656,12 +30968,12 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_6getSent(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_9getSentPos(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getSentPos (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_8getSentPos(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -30674,7 +30986,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_9getSentPos(PyObject *__pyx_v_ * */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_8getSentPos(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -30693,14 +31005,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(struct __pyx_obj_8 * def read_text(self, char* filename): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSentPos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__getSentPos); 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_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_loc); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_loc); __Pyx_GIVEREF(__pyx_v_loc); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __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[13]; __pyx_lineno = 30; __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; @@ -30714,7 +31026,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(struct __pyx_obj_8 __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.getSentPos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.getSentPos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30723,23 +31035,23 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_8getSentPos(struct __pyx_obj_8 } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static char __pyx_doc_8_cdec_sa_11SuffixArray_10read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static char __pyx_doc_3_sa_11SuffixArray_10read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; +static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_text (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_10read_text(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_10read_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -30752,7 +31064,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_11read_text(PyObject *__pyx_v_ * of Larsson & Sadahkane (1999)''' */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { int __pyx_v_V; int __pyx_v_N; int __pyx_v_i; @@ -30762,8 +31074,8 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 int __pyx_v_n; int __pyx_v_current_run; int __pyx_v_skip; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_isa = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_word_count = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_word_count = 0; float __pyx_v_sort_start_time; float __pyx_v_start_time; PyObject *__pyx_r = NULL; @@ -30791,23 +31103,23 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * 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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__from_text), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__from_text), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 38; __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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__use_sent_id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 38; __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_8_cdec_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 38; __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_8_cdec_sa_DataArray *)__pyx_t_2); + __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":39 @@ -30819,7 +31131,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 */ __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_N = __pyx_t_3; @@ -30832,7 +31144,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 */ __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 = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_V = __pyx_t_3; @@ -30843,19 +31155,19 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * self.ha = IntList(initial_len=V+1) * */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 42; __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 42; __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 42; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 42; __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[13]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sa); __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":43 @@ -30865,19 +31177,19 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * * isa = IntList(initial_len=N) */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 43; __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 43; __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 43; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 43; __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[13]; __pyx_lineno = 43; __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_8_cdec_sa_IntList *)__pyx_t_2); + __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":45 @@ -30887,16 +31199,16 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * word_count = IntList(initial_len=V+1) * */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 45; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 45; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 45; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __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[13]; __pyx_lineno = 45; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_isa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":46 @@ -30906,16 +31218,16 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * * '''Step 1: bucket sort data''' */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 46; __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 = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 46; __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 = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 46; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __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[13]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_word_count = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_2); + __pyx_v_word_count = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":49 @@ -30925,7 +31237,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * cdef float start_time = sort_start_time * for i from 0 <= i < N: */ - __pyx_v_sort_start_time = __pyx_f_8_cdec_sa_monitor_cpu(); + __pyx_v_sort_start_time = __pyx_f_3_sa_monitor_cpu(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":50 * '''Step 1: bucket sort data''' @@ -31147,14 +31459,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * * '''Step 2: prefix-doubling sort''' */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble((__pyx_f_8_cdec_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)__pyx_kp_s_87)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_87)); @@ -31162,7 +31474,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __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_9)); __pyx_t_9 = 0; @@ -31195,7 +31507,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * logger.debug(" Refining, sort depth = %d", h) * i = 0 */ - __pyx_v_sort_start_time = __pyx_f_8_cdec_sa_monitor_cpu(); + __pyx_v_sort_start_time = __pyx_f_3_sa_monitor_cpu(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":83 * while self.sa.arr[0] != -N: @@ -31204,14 +31516,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * i = 0 * skip = 0 */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_kp_s_88)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_88)); @@ -31219,7 +31531,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -31332,15 +31644,15 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * i = j+1 * if skip < 0: */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -31354,7 +31666,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; @@ -31410,14 +31722,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * * '''Step 3: read off suffix array from inverse suffix array''' */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyFloat_FromDouble((__pyx_f_8_cdec_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_89)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_89)); @@ -31425,7 +31737,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -31439,12 +31751,12 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * for i from 0 <= i < N: * j = isa.arr[i] */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; @@ -31485,14 +31797,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 * * def q3sort(self, int i, int j, int h, IntList isa, pad=""): */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyFloat_FromDouble((__pyx_f_8_cdec_sa_monitor_cpu() - __pyx_v_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_kp_s_92)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_92)); @@ -31500,7 +31812,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; @@ -31514,7 +31826,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_isa); @@ -31525,19 +31837,19 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_10read_text(struct __pyx_obj_8 } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8_cdec_sa_11SuffixArray_12q3sort[] = "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_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3_sa_11SuffixArray_12q3sort[] = "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_13q3sort(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_8_cdec_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; PyObject *__pyx_v_pad = 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 *__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_42); if (unlikely(__pyx_kwds)) { @@ -31555,26 +31867,22 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_sel kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j); - if (likely(values[1])) kw_args--; + 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h); - if (likely(values[2])) kw_args--; + 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 2); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isa); - if (likely(values[3])) kw_args--; + 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 3); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (kw_args > 0) { @@ -31583,7 +31891,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_sel } } 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "q3sort") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -31596,22 +31904,22 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_sel 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 = 109; __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 = 109; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_isa = ((struct __pyx_obj_8_cdec_sa_IntList *)values[3]); + __pyx_v_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __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[13]; __pyx_lineno = 109; __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[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_isa = ((struct __pyx_obj_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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(((struct __pyx_obj_8_cdec_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_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_11SuffixArray_12q3sort(((struct __pyx_obj_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; @@ -31628,7 +31936,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_sel * three partitions: items less than the pivot, items equal */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_12q3sort(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) { int __pyx_v_k; int __pyx_v_midpoint; int __pyx_v_pval; @@ -31667,11 +31975,11 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd * 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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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); @@ -31679,20 +31987,20 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_93), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_93), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[13]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; @@ -32030,17 +32338,17 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd * * # update suffixes with pivot value */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_phead - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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); @@ -32057,7 +32365,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 165; __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; @@ -32112,17 +32420,17 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd * * */ - __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong((__pyx_v_ptail + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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); @@ -32139,7 +32447,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 175; __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; @@ -32154,7 +32462,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -32163,22 +32471,22 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_12q3sort(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_text (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_14write_text(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_14write_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -32191,7 +32499,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_15write_text(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_14write_text(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -32209,16 +32517,16 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_14write_text(struct __pyx_obj_ * * def read_binary(self, char* filename): */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__write_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__write_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 179; __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 = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 179; __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 = 179; __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[13]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -32230,7 +32538,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_14write_text(struct __pyx_obj_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -32239,22 +32547,22 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_14write_text(struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_16read_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -32267,7 +32575,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_17read_binary(PyObject *__pyx_ * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_16read_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -32289,7 +32597,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj * self.sa.read_handle(f) * self.ha.read_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_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":185 * f = fopen(filename, "r") @@ -32298,7 +32606,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj * self.ha.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_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":186 * self.darray.read_handle(f) @@ -32307,7 +32615,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_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":187 * self.sa.read_handle(f) @@ -32325,22 +32633,22 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_16read_binary(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_18write_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -32353,7 +32661,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_19write_binary(PyObject *__pyx * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_18write_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -32375,7 +32683,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_ob * self.sa.write_handle(f) * self.ha.write_handle(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_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":193 * f = fopen(filename, "w") @@ -32384,7 +32692,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_ob * self.ha.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_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":194 * self.darray.write_handle(f) @@ -32393,7 +32701,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_ob * fclose(f) * */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_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":195 * self.sa.write_handle(f) @@ -32411,22 +32719,22 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_18write_binary(struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0); assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_20write_enhanced(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -32439,7 +32747,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_21write_enhanced(PyObject *__p * self.darray.write_enhanced_handle(f) */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_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; @@ -32471,9 +32779,9 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * for a_i in self.sa: */ /*with:*/ { - __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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)); @@ -32481,14 +32789,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ 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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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; @@ -32510,14 +32818,14 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * for a_i in self.sa: * f.write("%d " % a_i) */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_24); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_24); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 199; __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 = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 199; __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 = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 199; __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; @@ -32534,23 +32842,31 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->sa)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 200; __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++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 200; __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++; + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 200; __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -32567,16 +32883,16 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * f.write("\n") * for w_i in self.ha: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_a_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_a_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 201; __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 = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 201; __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 = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 201; __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; @@ -32591,9 +32907,9 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * for w_i in self.ha: * f.write("%d " % w_i) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 202; __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; @@ -32609,23 +32925,31 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ __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 = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->ha)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 203; __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++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;}; + #endif } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 203; __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 = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -32642,16 +32966,16 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * f.write("\n") * */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_w_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_w_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 204; __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 = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 204; __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 = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 204; __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; @@ -32666,9 +32990,9 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * * cdef int __search_high(self, int word_id, int offset, int low, int high): */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 205; __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; @@ -32691,12 +33015,12 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * for a_i in self.sa: */ /*except:*/ { - __Pyx_AddTraceback("_cdec_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 = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_AddTraceback("_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[13]; __pyx_lineno = 198; __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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); @@ -32709,11 +33033,11 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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 (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_13 = (!__pyx_t_11); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_10); @@ -32721,7 +33045,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} goto __pyx_L22; } __pyx_L22:; @@ -32749,11 +33073,11 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ if (__pyx_t_3) { __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_96, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __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 (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L23; @@ -32770,7 +33094,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -32789,7 +33113,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_20write_enhanced(struct __pyx_ * */ -static int __pyx_f_8_cdec_sa_11SuffixArray___search_high(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_midpoint; int __pyx_r; __Pyx_RefNannyDeclarations @@ -32845,7 +33169,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_high(struct __pyx_obj_8_cdec * else: * return self.__search_high(word_id, offset, low, midpoint) */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_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_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; } @@ -32858,7 +33182,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_high(struct __pyx_obj_8_cdec * * cdef int __search_low(self, int word_id, int offset, int low, int high): */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_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_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:; @@ -32877,7 +33201,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_high(struct __pyx_obj_8_cdec * */ -static int __pyx_f_8_cdec_sa_11SuffixArray___search_low(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_midpoint; int __pyx_r; __Pyx_RefNannyDeclarations @@ -32933,7 +33257,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_low(struct __pyx_obj_8_cdec_ * else: * return self.__search_low(word_id, offset, midpoint+1, high) */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_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_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; } @@ -32946,7 +33270,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_low(struct __pyx_obj_8_cdec_ * * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_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_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:; @@ -32965,7 +33289,7 @@ static int __pyx_f_8_cdec_sa_11SuffixArray___search_low(struct __pyx_obj_8_cdec_ * self.__search_high(word_id, offset, midpoint, high)) */ -static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___get_range(struct __pyx_obj_8_cdec_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_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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -32984,7 +33308,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___get_range(struct __pyx_obj_8_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":231 @@ -32994,9 +33318,9 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___get_range(struct __pyx_obj_8_ * * cdef __lookup_helper(self, int word_id, int offset, int low, int high): */ - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_8_cdec_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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 231; __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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 230; __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); @@ -33014,7 +33338,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___get_range(struct __pyx_obj_8_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -33030,7 +33354,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___get_range(struct __pyx_obj_8_ * */ -static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_midpoint; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -33061,11 +33385,11 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob * 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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->ha->arr[__pyx_v_word_id])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 237; __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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->ha->arr[(__pyx_v_word_id + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 237; __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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 237; __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); @@ -33132,7 +33456,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob * return self.__lookup_helper(word_id, offset, low, midpoint) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_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 = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -33159,7 +33483,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob * return self.__lookup_helper(word_id, offset, midpoint+1, high) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_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 = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -33176,7 +33500,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob * def lookup(self, word, int offset, int low, int high): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_8_cdec_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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[13]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -33190,7 +33514,7 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -33199,17 +33523,17 @@ static PyObject *__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper(struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_23lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_23lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3_sa_11SuffixArray_23lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_23lookup(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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__offset,&__pyx_n_s__low,&__pyx_n_s__high,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; @@ -33225,30 +33549,26 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_23lookup(PyObject *__pyx_v_sel kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); - if (likely(values[1])) kw_args--; + 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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low); - if (likely(values[2])) kw_args--; + 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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high); - if (likely(values[3])) kw_args--; + 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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -33259,19 +33579,19 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_23lookup(PyObject *__pyx_v_sel 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 = 249; __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 = 249; __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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_offset = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __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[13]; __pyx_lineno = 249; __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[13]; __pyx_lineno = 249; __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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_11SuffixArray_22lookup(((struct __pyx_obj_8_cdec_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_22lookup(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33284,7 +33604,7 @@ static PyObject *__pyx_pw_8_cdec_sa_11SuffixArray_23lookup(PyObject *__pyx_v_sel * if low == -1: */ -static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cdec_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_3_sa_11SuffixArray_22lookup(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) { PyObject *__pyx_v_word_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -33338,7 +33658,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd */ __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 = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 254; __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; @@ -33352,7 +33672,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd * word_id = self.darray.word2id[word] * return self.__lookup_helper(word_id, offset, low, high) */ - __pyx_t_1 = ((PySequence_Contains(__pyx_v_self->darray->word2id, __pyx_v_word))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PySequence_Contains(__pyx_v_self->darray->word2id, __pyx_v_word))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":256 @@ -33362,7 +33682,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd * 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 = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->darray->word2id, __pyx_v_word); if (!__pyx_t_2) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_word_id = __pyx_t_2; __pyx_t_2 = 0; @@ -33375,8 +33695,8 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd * return None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_4, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 257; __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_4, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -33401,7 +33721,7 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word_id); @@ -33411,15 +33731,15 @@ static PyObject *__pyx_pf_8_cdec_sa_11SuffixArray_22lookup(struct __pyx_obj_8_cd } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { 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_8_cdec_sa_8TrieNode___cinit__(((struct __pyx_obj_8_cdec_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8TrieNode___cinit__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33432,7 +33752,7 @@ static int __pyx_pw_8_cdec_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObj * */ -static int __pyx_pf_8_cdec_sa_8TrieNode___cinit__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self) { +static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -33460,7 +33780,7 @@ static int __pyx_pf_8_cdec_sa_8TrieNode___cinit__(struct __pyx_obj_8_cdec_sa_Tri goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -33468,12 +33788,12 @@ static int __pyx_pf_8_cdec_sa_8TrieNode___cinit__(struct __pyx_obj_8_cdec_sa_Tri } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_8TrieNode_8children___get__(((struct __pyx_obj_8_cdec_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33486,7 +33806,7 @@ static PyObject *__pyx_pw_8_cdec_sa_8TrieNode_8children_1__get__(PyObject *__pyx * def __cinit__(self): */ -static PyObject *__pyx_pf_8_cdec_sa_8TrieNode_8children___get__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -33503,17 +33823,17 @@ static PyObject *__pyx_pf_8_cdec_sa_8TrieNode_8children___get__(struct __pyx_obj } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_8_cdec_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_8TrieNode_8children_2__set__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -33529,17 +33849,17 @@ static int __pyx_pf_8_cdec_sa_8TrieNode_8children_2__set__(struct __pyx_obj_8_cd } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_8_cdec_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_8TrieNode_8children_4__del__(struct __pyx_obj_8_cdec_sa_TrieNode *__pyx_v_self) { +static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -33555,16 +33875,16 @@ static int __pyx_pf_8_cdec_sa_8TrieNode_8children_4__del__(struct __pyx_obj_8_cd } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,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}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":29 @@ -33625,16 +33945,16 @@ static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_se __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); + __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); @@ -33684,12 +34004,12 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_8_cd } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33702,7 +34022,7 @@ static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject * cdef public suffix_link */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -33719,17 +34039,17 @@ static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase___get__(struct __ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -33745,17 +34065,17 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_o } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -33771,12 +34091,12 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33789,7 +34109,7 @@ static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_1__get_ * */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -33806,17 +34126,17 @@ static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location___get__ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -33832,17 +34152,17 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_2__set__(stru } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -33858,12 +34178,12 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_15phrase_location_4__del__(stru } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -33876,7 +34196,7 @@ static PyObject *__pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_1__get__(Py * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): */ -static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -33893,17 +34213,17 @@ static PyObject *__pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link___get__(str } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -33919,17 +34239,17 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct _ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -33945,14 +34265,14 @@ static int __pyx_pf_8_cdec_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct _ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,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_97; if (unlikely(__pyx_kwds)) { @@ -33987,11 +34307,11 @@ static int __pyx_pw_8_cdec_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyOb __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable___cinit__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); + __pyx_r = __pyx_pf_3_sa_9TrieTable___cinit__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -34004,7 +34324,7 @@ static int __pyx_pw_8_cdec_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyOb * self.extended = extended */ -static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { +static int __pyx_pf_3_sa_9TrieTable___cinit__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -34051,7 +34371,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_Tr * else: * self.root = TrieNode() */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->root); @@ -34069,7 +34389,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_Tr * * # linked list structure for storing matches in BaselineRuleFactory */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->root); @@ -34083,7 +34403,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_Tr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34091,12 +34411,12 @@ static int __pyx_pf_8_cdec_sa_9TrieTable___cinit__(struct __pyx_obj_8_cdec_sa_Tr } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { +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; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_8extended___get__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -34109,7 +34429,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_8extended_1__get__(PyObject *__py * cdef public root */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_8extended___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -34128,7 +34448,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_8extended___get__(struct __pyx_ob goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -34137,17 +34457,17 @@ static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_8extended___get__(struct __pyx_ob } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -34161,7 +34481,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_8_c __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34169,12 +34489,12 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_8_c } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_5count___get__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -34187,7 +34507,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v * def __cinit__(self, extended=False): */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_5count___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -34206,7 +34526,7 @@ static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_5count___get__(struct __pyx_obj_8 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -34215,17 +34535,17 @@ static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_5count___get__(struct __pyx_obj_8 } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9TrieTable_5count_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -34239,7 +34559,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_5count_2__set__(struct __pyx_obj_8_cdec __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34247,12 +34567,12 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_5count_2__set__(struct __pyx_obj_8_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_4root___get__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -34265,7 +34585,7 @@ static PyObject *__pyx_pw_8_cdec_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_ * self.count = 0 */ -static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_4root___get__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -34282,17 +34602,17 @@ static PyObject *__pyx_pf_8_cdec_sa_9TrieTable_4root___get__(struct __pyx_obj_8_ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_8_cdec_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9TrieTable_4root_2__set__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -34308,17 +34628,17 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_4root_2__set__(struct __pyx_obj_8_cdec_ } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_8_cdec_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_8_cdec_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_8_cdec_sa_9TrieTable_4root_4__del__(struct __pyx_obj_8_cdec_sa_TrieTable *__pyx_v_self) { +static int __pyx_pf_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -34341,7 +34661,7 @@ static int __pyx_pf_8_cdec_sa_9TrieTable_4root_4__del__(struct __pyx_obj_8_cdec_ * */ -static int __pyx_f_8_cdec_sa_14PhraseLocation_contains(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_self, CYTHON_UNUSED int __pyx_v_sent_id) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("contains", 0); @@ -34363,19 +34683,19 @@ static int __pyx_f_8_cdec_sa_14PhraseLocation_contains(CYTHON_UNUSED struct __py } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; - 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}; 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}; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":69 @@ -34435,26 +34755,6 @@ static int __pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self 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 = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[0]) { - } else { - __pyx_v_sa_low = ((int)-1); - } - if (values[1]) { - } else { - __pyx_v_sa_high = ((int)-1); - } - if (values[2]) { - } else { - __pyx_v_arr_low = ((int)-1); - } - if (values[3]) { - } else { - __pyx_v_arr_high = ((int)-1); - } - if (values[5]) { - } else { - __pyx_v_num_subpatterns = ((int)1); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -34498,11 +34798,11 @@ static int __pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(((struct __pyx_obj_8_cdec_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_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_RefNannyFinishContext(); return __pyx_r; } @@ -34515,7 +34815,7 @@ static int __pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self * self.sa_low = sa_low */ -static int __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(struct __pyx_obj_8_cdec_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_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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -34566,12 +34866,12 @@ static int __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(struct __pyx_obj_8_cdec * self.num_subpatterns = num_subpatterns * */ - if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 74; __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_8_cdec_sa_IntList *)__pyx_v_arr); + __pyx_v_self->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_arr); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":75 * self.arr_high = arr_high @@ -34585,7 +34885,7 @@ static int __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(struct __pyx_obj_8_cdec __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34593,15 +34893,15 @@ static int __pyx_pf_8_cdec_sa_14PhraseLocation___cinit__(struct __pyx_obj_8_cdec } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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_8_cdec_sa_SuffixArray *__pyx_v_fsarray = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; + struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray = 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; @@ -34615,12 +34915,10 @@ static int __pyx_pw_8_cdec_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObje kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_size); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_size)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); - if (likely(values[1])) kw_args--; + 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 = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -34635,18 +34933,18 @@ static int __pyx_pw_8_cdec_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObje 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 = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_fsarray = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)values[1]); + __pyx_v_fsarray = ((struct __pyx_obj_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 = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_7Sampler___cinit__(((struct __pyx_obj_8_cdec_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __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; @@ -34663,7 +34961,7 @@ static int __pyx_pw_8_cdec_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObje * self.sa = fsarray.sa */ -static int __pyx_pf_8_cdec_sa_7Sampler___cinit__(struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsarray) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -34763,7 +35061,7 @@ static int __pyx_pf_8_cdec_sa_7Sampler___cinit__(struct __pyx_obj_8_cdec_sa_Samp __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34771,14 +35069,14 @@ static int __pyx_pf_8_cdec_sa_7Sampler___cinit__(struct __pyx_obj_8_cdec_sa_Samp } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ -static char __pyx_doc_8_cdec_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_8_cdec_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sample (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_8_cdec_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_7Sampler_2sample(((struct __pyx_obj_8_cdec_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_v_phrase_location)); + 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 = 94; __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; @@ -34795,8 +35093,8 @@ static PyObject *__pyx_pw_8_cdec_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyO * the phrase. If there are less than self.sample_size */ -static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_self, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_phrase_location) { - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_sample = 0; +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; @@ -34821,9 +35119,9 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ * 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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sample = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":108 @@ -34868,7 +35166,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ * else: * stepsize = float(num_locations)/float(self.sample_size) */ - ((struct __pyx_vtabstruct_8_cdec_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); + ((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*/ { @@ -34952,7 +35250,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ * i = i + stepsize * else: */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_append(__pyx_v_sample, (__pyx_v_self->sa->arr[__pyx_v_val])); + ((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":123 * val = int(floor(i)) @@ -35105,7 +35403,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ * i = i + stepsize * return sample */ - ((struct __pyx_vtabstruct_8_cdec_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); + ((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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":140 * j = phrase_location.arr_low + (val*phrase_location.num_subpatterns) @@ -35137,7 +35435,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec_sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sample); @@ -35154,7 +35452,7 @@ static PyObject *__pyx_pf_8_cdec_sa_7Sampler_2sample(struct __pyx_obj_8_cdec_sa_ * m.start = start */ -static void __pyx_f_8_cdec_sa_assign_matching(struct __pyx_t_8_cdec_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("assign_matching", 0); @@ -35214,7 +35512,7 @@ static void __pyx_f_8_cdec_sa_assign_matching(struct __pyx_t_8_cdec_sa_Matching * cdef int i, new_len */ -static int *__pyx_f_8_cdec_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_8_cdec_sa_Matching *__pyx_v_loc1, struct __pyx_t_8_cdec_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_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; @@ -35316,7 +35614,7 @@ static int *__pyx_f_8_cdec_sa_append_combined_matching(int *__pyx_v_arr, struct * */ -static int *__pyx_f_8_cdec_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_appendix, int __pyx_v_appendix_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; __Pyx_RefNannyDeclarations @@ -35382,7 +35680,7 @@ static int *__pyx_f_8_cdec_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, * */ -static int __pyx_f_8_cdec_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { +static int __pyx_f_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -35413,7 +35711,7 @@ static int __pyx_f_8_cdec_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_cdec_sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -35428,7 +35726,7 @@ static int __pyx_f_8_cdec_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx * # in which all matchings have the same first index as the one */ -static void __pyx_f_8_cdec_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 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) { __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -35511,9 +35809,9 @@ static void __pyx_f_8_cdec_sa_find_comparable_matchings(int __pyx_v_low, int __p } /* Python wrapper */ -static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_8_cdec_sa_Alignment *__pyx_v_alignment = 0; +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; @@ -35534,11 +35832,11 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p int __pyx_v_use_baeza_yates; int __pyx_v_use_collocations; int __pyx_v_use_index; - 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_68,&__pyx_n_s__precompute_rank,&__pyx_n_s_101,&__pyx_n_s_102,&__pyx_n_s_69,&__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}; 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_68,&__pyx_n_s__precompute_rank,&__pyx_n_s_101,&__pyx_n_s_102,&__pyx_n_s_69,&__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":257 @@ -35607,8 +35905,7 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment); - if (likely(values[0])) kw_args--; + 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) { @@ -35714,126 +36011,6 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p 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 = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[1]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":253 - * 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]) { - } else { - __pyx_v_category = ((char *)__pyx_k_103); - } - if (values[4]) { - } else { - __pyx_v_max_initial_size = ((unsigned int)10); - } - if (values[5]) { - } else { - __pyx_v_max_length = ((unsigned int)5); - } - if (values[6]) { - } else { - __pyx_v_max_nonterminals = ((unsigned int)2); - } - if (values[9]) { - } else { - __pyx_v_min_gap_size = ((unsigned int)2); - } - if (values[11]) { - } else { - __pyx_v_precompute_secondary_rank = ((unsigned int)20); - } - if (values[12]) { - } else { - __pyx_v_precompute_rank = ((unsigned int)100); - } - if (values[13]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":277 - * 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]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":279 - * 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]) { - } else { - __pyx_v_train_max_initial_size = ((unsigned int)10); - } - if (values[16]) { - } else { - __pyx_v_train_min_gap_size = ((unsigned int)2); - } - if (values[17]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":285 - * unsigned train_min_gap_size=2, - * # True if phrases should be tight, False otherwise (False == slower but better results) - * bint tight_phrases=False, # <<<<<<<<<<<<<< - * # True to require use of double-binary alg, false otherwise - * bint use_baeza_yates=True, - */ - __pyx_v_tight_phrases = ((int)0); - } - if (values[18]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":287 - * bint tight_phrases=False, - * # 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]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":289 - * 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]) { - } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":291 - * 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); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); @@ -35861,7 +36038,7 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p default: goto __pyx_L5_argtuple_error; } } - __pyx_v_alignment = ((struct __pyx_obj_8_cdec_sa_Alignment *)values[0]); + __pyx_v_alignment = ((struct __pyx_obj_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 = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { @@ -36007,12 +36184,12 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_Alignment, 1, "alignment", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(((struct __pyx_obj_8_cdec_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_alignment), __pyx_ptype_3_sa_Alignment, 1, "alignment", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -36029,7 +36206,7 @@ static int __pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__p * Alignment alignment, */ -static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_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) { +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -36057,13 +36234,13 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(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_8_cdec_sa_TrieTable)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 297; __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_8_cdec_sa_TrieTable *)__pyx_t_1); + __pyx_v_self->rules = ((struct __pyx_obj_3_sa_TrieTable *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":298 @@ -36075,11 +36252,11 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_o */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 298; __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 = 298; __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_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 298; __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); @@ -36558,13 +36735,13 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_o __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->findexes); __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); - __pyx_v_self->findexes = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_5); + __pyx_v_self->findexes = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); __pyx_t_5 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":360 @@ -36577,13 +36754,13 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_o __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->findexes1); __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_v_self->findexes1 = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_4); + __pyx_v_self->findexes1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_4); __pyx_t_4 = 0; __pyx_r = 0; @@ -36593,7 +36770,7 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_o __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -36601,17 +36778,17 @@ static int __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8_cdec_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_8_cdec_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsarray = 0; - struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_edarray = 0; - struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_sampler = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,0}; +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; 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,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -36626,18 +36803,15 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_3configure(PyObjec kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("configure", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("configure", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -36652,22 +36826,22 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_3configure(PyObjec values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_fsarray = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)values[0]); - __pyx_v_edarray = ((struct __pyx_obj_8_cdec_sa_DataArray *)values[1]); - __pyx_v_sampler = ((struct __pyx_obj_8_cdec_sa_Sampler *)values[2]); + __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]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("configure", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_8_cdec_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_8_cdec_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_8_cdec_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 362; __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 = 362; __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 = 362; __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -36684,7 +36858,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_3configure(PyObjec * Here we also use it to precompute the most expensive intersections */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_8_cdec_sa_Sampler *__pyx_v_sampler) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -36742,14 +36916,14 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct */ __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 369; __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_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 369; __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_8_cdec_sa_IntList *)__pyx_t_2); + __pyx_v_self->fid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":370 @@ -36761,14 +36935,14 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct */ __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 370; __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_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 370; __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_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_self->eid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":371 @@ -36803,7 +36977,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -36819,11 +36993,11 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_2configure(struct * cdef IntList idmap */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_DataArray *__pyx_v_darray) { +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_8_cdec_sa_IntList *__pyx_v_idmap = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_idmap = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -36864,10 +37038,10 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UN __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 = 379; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 379; __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_8_cdec_sa_IntList *)__pyx_t_3); + __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":380 @@ -36938,7 +37112,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UN __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_idmap); @@ -36948,12 +37122,12 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UN } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pattern2phrase (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -36966,7 +37140,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_5pattern2phrase(Py * result = () */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_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; @@ -37025,10 +37199,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(st 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++; + #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 = 390; __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++; + #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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -37078,7 +37260,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(st * 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 = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_new_id); __pyx_v_new_id = __pyx_t_4; @@ -37152,7 +37334,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(st __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_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = __pyx_t_9; @@ -37167,7 +37349,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(st __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -37180,12 +37362,12 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_4pattern2phrase(st } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pattern2phrase_plus (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -37198,7 +37380,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_7pattern2phrase_pl * # suffixed/prefixed with the NT category. */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_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; @@ -37271,10 +37453,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl 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++; + #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 = 405; __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++; + #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 = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -37324,7 +37514,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl * 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 = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_new_id); __pyx_v_new_id = __pyx_t_4; @@ -37397,7 +37587,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl __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_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -37410,7 +37600,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) * return patterns */ - __pyx_t_9 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -37425,7 +37615,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -37438,7 +37628,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl * return patterns * */ - __pyx_t_9 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -37453,7 +37643,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -37479,7 +37669,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_patterns); @@ -37493,12 +37683,12 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_6pattern2phrase_pl } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("precompute (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self)); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -37511,8 +37701,8 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_9precompute(PyObje * */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self) { - struct __pyx_obj_8_cdec_sa_Precomputation *__pyx_v_pre = 0; +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; PyObject *__pyx_v_start_time = NULL; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_arr = NULL; @@ -37527,9 +37717,9 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct 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)(PyObject *); + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; @@ -37554,7 +37744,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * logger.info("Reading precomputed data from file %s... ", self.precompute_file) * pre = Precomputation(from_binary=self.precompute_file) */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_f_8_cdec_sa_monitor_cpu()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_f_3_sa_monitor_cpu()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_start_time = __pyx_t_2; __pyx_t_2 = 0; @@ -37595,10 +37785,10 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_v_pre = ((struct __pyx_obj_8_cdec_sa_Precomputation *)__pyx_t_2); + __pyx_v_pre = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_t_2); __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":425 @@ -37835,86 +38025,28 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_pre->precomputed_index, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_5 = __pyx_t_2; __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_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = 0; + if (unlikely(__pyx_v_pre->precomputed_index == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; - } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; - } else { - __pyx_t_2 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L12_unpacking_done; - __pyx_L11_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L12_unpacking_done:; - } + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + while (1) { + __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_2, &__pyx_t_4, NULL, __pyx_t_8); + if (unlikely(__pyx_t_9 == 0)) break; + if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_pattern = __pyx_t_2; + __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_arr = __pyx_t_4; + __pyx_t_4 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":436 * logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) @@ -37923,20 +38055,20 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * for phrase in phrases: * self.precomputed_index[phrase] = arr */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pattern2phrase_plus); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pattern2phrase_plus); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 436; __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 = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pattern); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pattern); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pattern); __Pyx_GIVEREF(__pyx_v_pattern); - __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 = 436; __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 436; __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_2)); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_phrases); - __pyx_v_phrases = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_phrases = __pyx_t_3; + __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":437 * for pattern, arr in pre.precomputed_index.iteritems(): @@ -37946,34 +38078,42 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * if self.use_collocations: */ if (PyList_CheckExact(__pyx_v_phrases) || PyTuple_CheckExact(__pyx_v_phrases)) { - __pyx_t_4 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; - } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_3 = __pyx_t_11(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { + __pyx_t_2 = __pyx_t_11(__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 = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_phrase); - __pyx_v_phrase = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_phrase = __pyx_t_2; + __pyx_t_2 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":438 * phrases = self.pattern2phrase_plus(pattern) @@ -37984,7 +38124,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct */ if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8; @@ -38009,27 +38149,27 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_v_pre->precomputed_collocations; __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__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_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_112)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_112)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 440; __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_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_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":441 @@ -38039,86 +38179,28 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * phrase = self.pattern2phrase(pattern) * self.precomputed_collocations[phrase] = arr */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_pre->precomputed_collocations, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_5 = __pyx_t_3; __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_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_7 = 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 = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; - } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; - } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __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 (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L18_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L19_unpacking_done; - __pyx_L18_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L19_unpacking_done:; - } + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + while (1) { + __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_7, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_8); + if (unlikely(__pyx_t_9 == 0)) break; + if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_2; + __pyx_v_pattern = __pyx_t_2; __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":442 * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) @@ -38152,9 +38234,9 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L15; + goto __pyx_L13; } - __pyx_L15:; + __pyx_L13:; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":444 * phrase = self.pattern2phrase(pattern) @@ -38163,7 +38245,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct * logger.info("Processing precomputations took %f seconds", stop_time - start_time) * */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_f_8_cdec_sa_monitor_cpu()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_f_3_sa_monitor_cpu()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_v_stop_time = __pyx_t_5; __pyx_t_5 = 0; @@ -38206,8 +38288,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_pre); @@ -38223,12 +38304,12 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_8precompute(struct } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_precomputed_collocation (wrapper)", 0); - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -38241,7 +38322,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_11get_precomputed_ * arr = self.precomputed_collocations[phrase] */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { PyObject *__pyx_v_arr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -38304,7 +38385,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __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_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); 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_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); 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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; @@ -38332,7 +38413,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_arr); @@ -38349,7 +38430,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_10get_precomputed_ * int offset_by_one, int len_last, int num_subpatterns, int* result_len): */ -static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_i1; int __pyx_v_i2; int __pyx_v_med1; @@ -38372,8 +38453,8 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc int *__pyx_v_low_result; int *__pyx_v_med_result; int *__pyx_v_high_result; - struct __pyx_t_8_cdec_sa_Matching __pyx_v_loc1; - struct __pyx_t_8_cdec_sa_Matching __pyx_v_loc2; + struct __pyx_t_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_3_sa_Matching __pyx_v_loc2; int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -38463,7 +38544,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_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_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":481 * # Case 2: sets are non-overlapping @@ -38472,7 +38553,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: * return result */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_low2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":482 * assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr) @@ -38481,7 +38562,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * return result * */ - __pyx_t_3 = (((struct __pyx_vtabstruct_8_cdec_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); + __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); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":483 @@ -38504,7 +38585,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_low1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":486 * @@ -38513,7 +38594,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: * return result */ - __pyx_f_8_cdec_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_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":487 * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) @@ -38522,7 +38603,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * return result * */ - __pyx_t_3 = (((struct __pyx_vtabstruct_8_cdec_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); + __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); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":488 @@ -38645,7 +38726,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * * # binary search. There are two flavors, depending on */ - __pyx_r = ((struct __pyx_vtabstruct_8_cdec_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_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; } @@ -38667,7 +38748,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) * */ - __pyx_v_med2 = __pyx_f_8_cdec_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); + __pyx_v_med2 = __pyx_f_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":507 * if d_first: @@ -38676,7 +38757,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * * search_low = low1 */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":509 * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) @@ -38714,7 +38795,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); + __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":513 * while search_low < search_high: @@ -38723,7 +38804,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: */ - __pyx_f_8_cdec_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_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":514 * med1 = median(search_low, search_high, step1) @@ -38732,7 +38813,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if comparison == -1: * search_low = med1_plus */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_8_cdec_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_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":517 * if comparison == -1: @@ -38805,7 +38886,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * */ - __pyx_v_med1 = __pyx_f_8_cdec_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); + __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":523 * else: @@ -38814,7 +38895,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * * search_low = low2 */ - __pyx_f_8_cdec_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_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":525 * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) @@ -38852,7 +38933,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); + __pyx_v_med2 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":529 * while search_low < search_high: @@ -38861,7 +38942,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":530 * med2 = median(search_low, search_high, step2) @@ -38870,7 +38951,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if comparison == -1: * search_high = med2 */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_8_cdec_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_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":533 * if comparison == -1: @@ -39008,7 +39089,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * while med2_minus-step2 >= low2: * assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr) */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":551 * while i1 < med1_plus: @@ -39028,7 +39109,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: * med2_minus = med2_minus - step2 */ - __pyx_f_8_cdec_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_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":553 * while med2_minus-step2 >= low2: @@ -39037,7 +39118,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * med2_minus = med2_minus - step2 * else: */ - __pyx_t_3 = (((struct __pyx_vtabstruct_8_cdec_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); + __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); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":554 @@ -39092,7 +39173,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) * if comparison == 0: */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":560 * while i2 < high2: @@ -39101,7 +39182,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if comparison == 0: * pass */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_8_cdec_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_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":561 * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) @@ -39120,7 +39201,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * if comparison == -1: * break */ - __pyx_v_med_result = __pyx_f_8_cdec_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_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:; @@ -39381,7 +39462,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_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_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":594 * low_result_len = 0 @@ -39399,7 +39480,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * * result = extend_arr(result, result_len, low_result, low_result_len) */ - __pyx_v_high_result = ((struct __pyx_vtabstruct_8_cdec_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_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":597 * 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) @@ -39408,7 +39489,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * 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_8_cdec_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_low_result, __pyx_v_low_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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":598 * @@ -39417,7 +39498,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * result = extend_arr(result, result_len, high_result, high_result_len) * free(low_result) */ - __pyx_v_result = __pyx_f_8_cdec_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_med_result, __pyx_v_med_result_len); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":599 * result = extend_arr(result, result_len, low_result, low_result_len) @@ -39426,7 +39507,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * free(low_result) * free(med_result) */ - __pyx_v_result = __pyx_f_8_cdec_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_high_result, __pyx_v_high_result_len); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":600 * result = extend_arr(result, result_len, med_result, med_result_len) @@ -39468,7 +39549,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_cdec_sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -39483,12 +39564,12 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper(struc * """ */ -static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_obj_8_cdec_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_8_cdec_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last) { +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) { int __pyx_v_i1; int __pyx_v_comparison; int __pyx_v_prev_comparison; - struct __pyx_t_8_cdec_sa_Matching __pyx_v_l1_stack; - struct __pyx_t_8_cdec_sa_Matching *__pyx_v_loc1; + struct __pyx_t_3_sa_Matching __pyx_v_l1_stack; + struct __pyx_t_3_sa_Matching *__pyx_v_loc1; long __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -39530,7 +39611,7 @@ static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings_set(st * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) * if comparison == 0: */ - __pyx_f_8_cdec_sa_assign_matching(__pyx_v_loc1, __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":624 * while i1 < i1_plus: @@ -39539,7 +39620,7 @@ static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings_set(st * if comparison == 0: * prev_comparison = 0 */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_8_cdec_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_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":625 * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) @@ -39661,7 +39742,7 @@ static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings_set(st * */ -static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_t_8_cdec_sa_Matching *__pyx_v_loc1, struct __pyx_t_8_cdec_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last) { +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) { int __pyx_v_i; long __pyx_r; __Pyx_RefNannyDeclarations @@ -39979,15 +40060,15 @@ static long __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings(struct * int offset_by_one, int len_last, int num_subpatterns, int* result_len): */ -static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj_8_cdec_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_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) { 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_8_cdec_sa_Matching __pyx_v_loc1; - struct __pyx_t_8_cdec_sa_Matching __pyx_v_loc2; + struct __pyx_t_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_3_sa_Matching __pyx_v_loc2; int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -40055,7 +40136,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * while i2 < high2: * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":691 * # First, pop all unneeded loc2's off the stack @@ -40075,7 +40156,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: * i2 = i2 + step2 */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":693 * while i2 < high2: @@ -40084,7 +40165,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * i2 = i2 + step2 * else: */ - __pyx_t_3 = (((struct __pyx_vtabstruct_8_cdec_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); + __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); if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":694 @@ -40145,7 +40226,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * j2 = i2 * while j2 < high2: */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":702 * while i1 < high1 and arr1[j1] == arr1[i1]: @@ -40174,7 +40255,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) * if comparison == 0: */ - __pyx_f_8_cdec_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_j2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":705 * while j2 < high2: @@ -40183,7 +40264,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * if comparison == 0: * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_8_cdec_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_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":706 * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) @@ -40202,7 +40283,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * if comparison == 1: * pass */ - __pyx_v_result = __pyx_f_8_cdec_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_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:; @@ -40290,10 +40371,10 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper(struct __py * cdef VEB veb */ -static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_arr, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_loc, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_phrase) { +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) { int __pyx_v_i; int __pyx_v_j; - struct __pyx_obj_8_cdec_sa_VEB *__pyx_v_veb = 0; + struct __pyx_obj_3_sa_VEB *__pyx_v_veb = 0; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -40323,11 +40404,11 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ */ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 724; __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_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_loc->arr); __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); - __pyx_v_loc->arr = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_2); + __pyx_v_loc->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } @@ -40346,13 +40427,13 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ __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[8]; __pyx_lineno = 726; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[8]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __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_8_cdec_sa_IntList *)__pyx_t_3); + __pyx_v_loc->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":727 @@ -40369,10 +40450,10 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ 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*)__pyx_ptype_8_cdec_sa_VEB)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_VEB)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_veb = ((struct __pyx_obj_8_cdec_sa_VEB *)__pyx_t_3); + __pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":728 @@ -40392,7 +40473,7 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: */ - ((struct __pyx_vtabstruct_8_cdec_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); + ((struct __pyx_vtabstruct_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":730 @@ -40430,7 +40511,7 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ * loc.arr_low = 0 * loc.arr_high = loc.arr.len */ - __pyx_v_i = ((struct __pyx_vtabstruct_8_cdec_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); + __pyx_v_i = ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); } } __pyx_L3:; @@ -40457,7 +40538,7 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_cdec_sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_veb); __Pyx_RefNannyFinishContext(); @@ -40471,10 +40552,10 @@ static void __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct _ * */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_prefix, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_suffix, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_prefix_loc, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_suffix_loc, int __pyx_v_algorithm) { - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_arr1 = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_arr2 = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_result = 0; +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; int __pyx_v_low1; int __pyx_v_high1; int __pyx_v_step1; @@ -40489,11 +40570,12 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; + 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; @@ -40515,22 +40597,12 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * offset_by_one = 1 * else: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_isvar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 747; __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 = 747; __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 = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __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 = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_t_2); + if (__pyx_t_3) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":748 * @@ -40562,25 +40634,25 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * * if prefix_loc.arr is None: */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_suffix), __pyx_n_s__getchunk); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_suffix), __pyx_n_s__arity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __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 = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_suffix), __pyx_n_s__getchunk); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __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(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __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 = 752; __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_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_suffix), __pyx_n_s__arity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __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 = 752; __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 = 752; __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 = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_len_last = __pyx_t_5; + __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 = 752; __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":754 * len_last = len(suffix.getchunk(suffix.arity())) @@ -40589,8 +40661,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) * arr1 = prefix_loc.arr */ - __pyx_t_4 = (((PyObject *)__pyx_v_prefix_loc->arr) == Py_None); - if (__pyx_t_4) { + __pyx_t_7 = (((PyObject *)__pyx_v_prefix_loc->arr) == Py_None); + if (__pyx_t_7) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":755 * @@ -40599,10 +40671,10 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * arr1 = prefix_loc.arr * low1 = prefix_loc.arr_low */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->fsa->sa); - __Pyx_INCREF(__pyx_t_1); - ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1), __pyx_v_prefix_loc, __pyx_v_prefix); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L4; } __pyx_L4:; @@ -40651,8 +40723,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) * arr2 = suffix_loc.arr */ - __pyx_t_4 = (((PyObject *)__pyx_v_suffix_loc->arr) == Py_None); - if (__pyx_t_4) { + __pyx_t_7 = (((PyObject *)__pyx_v_suffix_loc->arr) == Py_None); + if (__pyx_t_7) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":762 * @@ -40661,10 +40733,10 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * arr2 = suffix_loc.arr * low2 = suffix_loc.arr_low */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->fsa->sa); - __Pyx_INCREF(__pyx_t_1); - ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1), __pyx_v_suffix_loc, __pyx_v_suffix); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L5; } __pyx_L5:; @@ -40713,17 +40785,17 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * * if algorithm == MERGE: */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_prefix), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 768; __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 = 768; __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_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_num_subpatterns = __pyx_t_6; + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_prefix), __pyx_n_s__arity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 768; __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 = 768; __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 = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_num_subpatterns = __pyx_t_3; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":770 * num_subpatterns = prefix.arity()+1 @@ -40732,8 +40804,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, */ - __pyx_t_4 = (__pyx_v_algorithm == __pyx_v_8_cdec_sa_MERGE); - if (__pyx_t_4) { + __pyx_t_7 = (__pyx_v_algorithm == __pyx_v_3_sa_MERGE); + if (__pyx_t_7) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":773 * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, @@ -40742,7 +40814,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * else: * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_8_cdec_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_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*/ { @@ -40754,7 +40826,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * * if result_len == 0: */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_8_cdec_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_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:; @@ -40765,8 +40837,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * free(result_ptr) * return None */ - __pyx_t_4 = (__pyx_v_result_len == 0); - if (__pyx_t_4) { + __pyx_t_7 = (__pyx_v_result_len == 0); + if (__pyx_t_7) { /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":780 * @@ -40799,10 +40871,10 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * free(result.arr) * result.arr = result_ptr */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; + __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 = 783; __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_t_5 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":784 * else: @@ -40848,23 +40920,23 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * cdef loc2str(self, PhraseLocation loc): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong(__pyx_v_result_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __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_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 788; __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 = 788; __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 = 788; __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 = 788; __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 = 788; __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 = 788; __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 = 788; __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 = 788; __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:; @@ -40873,9 +40945,9 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st 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.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr1); @@ -40894,7 +40966,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper(st * result = "{" */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_loc) { +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) { int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_v_result = NULL; @@ -41035,7 +41107,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUS __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -41052,14 +41124,14 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUS * cdef PhraseLocation prefix_loc, suffix_loc, result */ -static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_prefix_node, PyObject *__pyx_v_suffix_node, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_phrase) { - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_prefix = 0; - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_suffix = 0; - struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_prefix_loc = 0; - struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_suffix_loc = 0; - struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_v_result = 0; +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; CYTHON_UNUSED PyObject *__pyx_v_intersect_method = NULL; - struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_r = NULL; + struct __pyx_obj_3_sa_PhraseLocation *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -41079,8 +41151,8 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_prefix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 807; __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_8_cdec_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix = ((struct __pyx_obj_8_cdec_sa_Phrase *)__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 = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":808 @@ -41092,8 +41164,8 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_suffix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 808; __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_8_cdec_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix = ((struct __pyx_obj_8_cdec_sa_Phrase *)__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 = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":809 @@ -41105,8 +41177,8 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_prefix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 809; __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_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix_loc = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":810 @@ -41118,8 +41190,8 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_suffix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 810; __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_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix_loc = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__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 = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":812 @@ -41140,8 +41212,8 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi __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_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__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 = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":813 @@ -41193,11 +41265,11 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi * intersect_method="double binary" * else: */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_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_8_cdec_sa_BAEZA_YATES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 818; __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_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_t_3); + __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":819 @@ -41221,11 +41293,11 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi * intersect_method="merge" * return result */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_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_8_cdec_sa_MERGE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 821; __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_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_t_3); + __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":822 @@ -41256,13 +41328,13 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_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.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_prefix); @@ -41277,16 +41349,16 @@ static struct __pyx_obj_8_cdec_sa_PhraseLocation *__pyx_f_8_cdec_sa_23HieroCachi } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_frontier = 0; PyObject *__pyx_v_res = 0; PyObject *__pyx_v_fwords = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frontier,&__pyx_n_s__res,&__pyx_n_s__fwords,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; @@ -41301,18 +41373,15 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance(PyObject kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frontier); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frontier)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); - if (likely(values[1])) kw_args--; + 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 = 825; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[2])) kw_args--; + 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 = 825; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -41335,11 +41404,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance(PyObject __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -41352,7 +41421,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance(PyObject * nf = [] */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { +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) { unsigned int __pyx_v_na; PyObject *__pyx_v_nf = NULL; PyObject *__pyx_v_toskip = NULL; @@ -41415,10 +41484,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ 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++; + #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 = 828; __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++; + #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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -41432,27 +41509,33 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ } 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { + } 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); @@ -41463,12 +41546,13 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ 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 = 828; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } @@ -41477,21 +41561,22 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __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 { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_7 = PyList_GET_ITEM(sequence, 0); __pyx_t_9 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); @@ -41499,8 +41584,14 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ __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 = 828; __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 = 828; __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { + } 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); @@ -41513,12 +41604,13 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ 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 = 828; __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; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L8_unpacking_done:; } @@ -41697,7 +41789,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ * return self.advance(nf, res, fwords) * else: */ - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = (__pyx_t_2 > 0); if (__pyx_t_15) { @@ -41758,7 +41850,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_nf); @@ -41774,8 +41866,8 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_12advance(struct _ } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_skip = 0; PyObject *__pyx_v_i = 0; PyObject *__pyx_v_spanlen = 0; @@ -41783,11 +41875,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_is PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_next_states = 0; PyObject *__pyx_v_reachable_buffer = 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 *__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; @@ -41806,42 +41898,35 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_is kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__skip); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__skip)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[1])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen); - if (likely(values[2])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen); - if (likely(values[3])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[4])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states); - if (likely(values[5])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer); - if (likely(values[6])) kw_args--; + 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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -41872,11 +41957,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_is __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 = 841; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_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_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_8_cdec_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_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_RefNannyFinishContext(); return __pyx_r; } @@ -41889,7 +41974,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_is * frontier = [] */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_8_cdec_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_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) { PyObject *__pyx_v_frontier = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_reachable = NULL; @@ -42085,10 +42170,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is for (;;) { if (!__pyx_t_6 && 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++; + #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 = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_6 && 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++; + #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 = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -42125,10 +42218,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is for (;;) { if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -42249,10 +42350,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is for (;;) { if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_9)) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_9, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_9)) { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_9, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_4 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_4)) { @@ -42283,7 +42392,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_v_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_NE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); @@ -42387,7 +42496,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_frontier); @@ -42404,16 +42513,16 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_14get_all_nodes_is } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_dist = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__dist,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; @@ -42428,18 +42537,15 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable(PyObje kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom); - if (likely(values[1])) kw_args--; + 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 = 866; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist); - if (likely(values[2])) kw_args--; + 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 = 866; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -42462,11 +42568,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable(PyObje __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -42479,7 +42585,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable(PyObje * if (ifrom >= len(fwords)): */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist) { +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) { PyObject *__pyx_v_ret = NULL; PyObject *__pyx_v_alt_id = NULL; PyObject *__pyx_v_ifromchild = NULL; @@ -42578,10 +42684,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct 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++; + #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 = 870; __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++; + #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 = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) { @@ -42612,7 +42726,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__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_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); @@ -42760,10 +42874,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct for (;;) { if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_6)) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_6)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_3 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_3)) { @@ -42829,7 +42951,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); @@ -42841,16 +42963,16 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_16reachable(struct } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_ito = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__ito,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; @@ -42865,18 +42987,15 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest(PyObjec kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom); - if (likely(values[1])) kw_args--; + 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 = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito); - if (likely(values[2])) kw_args--; + 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 = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -42899,11 +43018,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest(PyObjec __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("shortest", 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.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -42916,7 +43035,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest(PyObjec * min = 1000 */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito) { +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) { unsigned int __pyx_v_alt_id; PyObject *__pyx_v_min = NULL; PyObject *__pyx_v_currmin = NULL; @@ -43067,7 +43186,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __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_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__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_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -43139,7 +43258,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(struct __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_min); @@ -43150,16 +43269,16 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_18shortest(struct } /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v__columns = 0; PyObject *__pyx_v_curr_idx = 0; PyObject *__pyx_v_min_dist = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___columns,&__pyx_n_s__curr_idx,&__pyx_n_s__min_dist,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)) { @@ -43175,12 +43294,10 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states( kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___columns); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___columns)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx); - if (likely(values[1])) kw_args--; + 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 = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -43210,11 +43327,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states( __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); + __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_RefNannyFinishContext(); return __pyx_r; } @@ -43227,7 +43344,7 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states( * candidate = [[curr_idx,0]] */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist) { +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) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_candidate = NULL; PyObject *__pyx_v_curr = NULL; @@ -43295,7 +43412,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states( * if curr[0] >= len(_columns): */ while (1) { - __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); + __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_3 > 0); if (!__pyx_t_4) break; @@ -43426,10 +43543,18 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states( 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++; + #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 = 910; __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++; + #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 = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_1)) { @@ -43484,7 +43609,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states( */ __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyInt_FromLong(__pyx_v_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_EQ); 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); @@ -43598,7 +43723,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states( __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -43612,19 +43737,19 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_20get_next_states( __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8_cdec_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_8_cdec_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_models = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__models,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("input (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__models,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -43638,12 +43763,10 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_23input(PyObject * kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__models); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__models)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("input", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -43664,11 +43787,11 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_23input(PyObject * __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("input", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_models); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_models); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -43681,15 +43804,15 @@ static PyObject *__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_23input(PyObject * * it looks up all of the rules that can be used to translate */ -static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_models) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_models) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_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_8_cdec_sa___pyx_scope_struct_1_input *)__pyx_ptype_8_cdec_sa___pyx_scope_struct_1_input->tp_new(__pyx_ptype_8_cdec_sa___pyx_scope_struct_1_input, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)__pyx_ptype_3_sa___pyx_scope_struct_2_input->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_2_input, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -43705,7 +43828,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(struct __p __Pyx_INCREF(__pyx_cur_scope->__pyx_v_models); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_models); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_23HieroCachingRuleFactory_24generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -43714,7 +43837,7 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(struct __p __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -43723,9 +43846,9 @@ static PyObject *__pyx_pf_8_cdec_sa_23HieroCachingRuleFactory_22input(struct __p return __pyx_r; } -static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *__pyx_cur_scope = ((struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *)__pyx_generator->closure); + struct __pyx_obj_3_sa___pyx_scope_struct_2_input *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)__pyx_generator->closure); PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -43748,11 +43871,11 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx int __pyx_t_19; float __pyx_t_20; Py_ssize_t __pyx_t_21; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - PyObject *(*__pyx_t_25)(PyObject *); - Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_25; + int __pyx_t_26; PyObject *(*__pyx_t_27)(PyObject *); int __pyx_t_28; int __pyx_t_29; @@ -43760,7 +43883,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L63_resume_from_yield; + case 1: goto __pyx_L59_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; @@ -43785,7 +43908,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * self.extract_time = 0.0 * nodes_isteps_away_buffer = {} */ - __pyx_cur_scope->__pyx_v_start_time = __pyx_f_8_cdec_sa_monitor_cpu(); + __pyx_cur_scope->__pyx_v_start_time = __pyx_f_3_sa_monitor_cpu(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":932 * flen = len(fwords) @@ -43840,11 +43963,11 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __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_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __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_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_3); @@ -43906,7 +44029,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __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_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); @@ -43980,7 +44103,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * if x1 in self.rules.root.children: * xroot = self.rules.root.children[x1] */ - __pyx_cur_scope->__pyx_v_x1 = __pyx_f_8_cdec_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); + __pyx_cur_scope->__pyx_v_x1 = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":948 * xroot = None @@ -44029,11 +44152,11 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); @@ -44096,7 +44219,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_v_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -44225,7 +44348,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * for k, i, alt, pathlen, node, prefix, is_shadow_path in frontier: */ while (1) { - __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); + __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = (__pyx_t_1 > 0); if (!__pyx_t_8) break; @@ -44254,15 +44377,25 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_12 = ((PyObject *)__pyx_cur_scope->__pyx_v_frontier); __Pyx_INCREF(__pyx_t_12); __pyx_t_1 = 0; for (;;) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_12)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_12, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 7)) { + if (size > 7) __Pyx_RaiseTooManyValuesError(7); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 7)) { - if (PyTuple_GET_SIZE(sequence) > 7) __Pyx_RaiseTooManyValuesError(7); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); @@ -44271,11 +44404,6 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); __pyx_t_15 = PyTuple_GET_ITEM(sequence, 6); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 7)) { - if (PyList_GET_SIZE(sequence) > 7) __Pyx_RaiseTooManyValuesError(7); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_13 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); __pyx_t_9 = PyList_GET_ITEM(sequence, 2); @@ -44291,34 +44419,36 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_15); + #else + Py_ssize_t i; + PyObject** temps[7] = {&__pyx_t_13,&__pyx_t_7,&__pyx_t_9,&__pyx_t_10,&__pyx_t_3,&__pyx_t_14,&__pyx_t_15}; + for (i=0; i < 7; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { + } else + { Py_ssize_t index = -1; + PyObject** temps[7] = {&__pyx_t_13,&__pyx_t_7,&__pyx_t_9,&__pyx_t_10,&__pyx_t_3,&__pyx_t_14,&__pyx_t_15}; __pyx_t_16 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; - index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_13)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - index = 1; __pyx_t_7 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_7)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - index = 2; __pyx_t_9 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_9)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 3; __pyx_t_10 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 4; __pyx_t_3 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 5; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - index = 6; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); + for (index=0; index < 7; index++) { + PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L21_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L22_unpacking_done; __pyx_L21_unpacking_failed:; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L22_unpacking_done:; } @@ -44401,7 +44531,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * # skipping because word_id is epsilon * if i+spanlen >= len(fwords): */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_8_cdec_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); @@ -44524,8 +44654,8 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * continue * * phrase = prefix + (word_id,) # <<<<<<<<<<<<<< - * str_phrase = map(sym_tostring, phrase) * hiero_phrase = Phrase(phrase) + * arity = hiero_phrase.arity() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -44544,67 +44674,41 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":978 * * phrase = prefix + (word_id,) - * str_phrase = map(sym_tostring, phrase) # <<<<<<<<<<<<<< - * hiero_phrase = Phrase(phrase) - * arity = hiero_phrase.arity() - */ - __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_tostring); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_phrase); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_str_phrase); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_str_phrase); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_str_phrase = __pyx_t_15; - __pyx_t_15 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":979 - * phrase = prefix + (word_id,) - * str_phrase = map(sym_tostring, phrase) * hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<< * arity = hiero_phrase.arity() * */ - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __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 = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 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_3); - __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":980 - * str_phrase = map(sym_tostring, phrase) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":979 + * phrase = prefix + (word_id,) * hiero_phrase = Phrase(phrase) * arity = hiero_phrase.arity() # <<<<<<<<<<<<<< * * lookup_required = False */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_15); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_15); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_cur_scope->__pyx_v_arity = __pyx_t_18; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":982 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":981 * arity = hiero_phrase.arity() * * lookup_required = False # <<<<<<<<<<<<<< @@ -44613,36 +44717,36 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ __pyx_cur_scope->__pyx_v_lookup_required = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":983 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":982 * * lookup_required = False * if word_id in node.children: # <<<<<<<<<<<<<< * if node.children[word_id] is None: * # Path dead-ends at this node */ - __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_8 = ((PySequence_Contains(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PySequence_Contains(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":984 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":983 * 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_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_8 = (__pyx_t_3 == Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":986 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":985 * if node.children[word_id] is None: * # Path dead-ends at this node * continue # <<<<<<<<<<<<<< @@ -44654,16 +44758,16 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":989 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":988 * else: * # Path continues at this node * node = node.children[word_id] # <<<<<<<<<<<<<< * else: * if node.suffix_link is None: */ - __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); @@ -44677,20 +44781,20 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":991 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":990 * node = node.children[word_id] * else: * if node.suffix_link is None: # <<<<<<<<<<<<<< * # Current node is root; lookup required * lookup_required = True */ - __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_8 = (__pyx_t_15 == Py_None); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":993 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":992 * if node.suffix_link is None: * # Current node is root; lookup required * lookup_required = True # <<<<<<<<<<<<<< @@ -44702,54 +44806,54 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":995 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":994 * 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_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_8 = ((PySequence_Contains(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PySequence_Contains(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":996 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":995 * 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_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_8 = (__pyx_t_3 == Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":998 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":997 * 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_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 997; __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":999 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":998 * # Suffix link reports path is dead end * node.children[word_id] = None * continue # <<<<<<<<<<<<<< @@ -44761,7 +44865,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1002 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1001 * else: * # Suffix link indicates lookup is reqired * lookup_required = True # <<<<<<<<<<<<<< @@ -44775,18 +44879,18 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1005 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1004 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< * # checking whether lookup_required * if lookup_required: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L30:; } @@ -44794,7 +44898,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L27:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1007 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1006 * raise Exception("Keyword trie error") * # checking whether lookup_required * if lookup_required: # <<<<<<<<<<<<<< @@ -44803,7 +44907,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ if (__pyx_cur_scope->__pyx_v_lookup_required) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1008 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1007 * # checking whether lookup_required * if lookup_required: * new_node = None # <<<<<<<<<<<<<< @@ -44816,66 +44920,66 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_new_node = Py_None; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1009 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1008 * 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_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1012 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1011 * # 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_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyObject_GetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __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":1013 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1012 * # 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_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __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":1014 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1013 * 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_3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -44887,7 +44991,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1016 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1015 * phrase=hiero_phrase) * else: * if arity > 0: # <<<<<<<<<<<<<< @@ -44897,71 +45001,75 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity > 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1018 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1017 * if arity > 0: * # Intersecting because of arity > 0 * phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase) # <<<<<<<<<<<<<< * else: * # Suffix array search */ - __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8_cdec_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_2, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_8_cdec_sa_PhraseLocation *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L34; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1021 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1020 * else: * # Suffix array search * phrase_location = node.phrase_location # <<<<<<<<<<<<<< - * sa_range = self.fsa.lookup(str_phrase[-1], len(str_phrase)-1, phrase_location.sa_low, phrase_location.sa_high) + * 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_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8_cdec_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1020; __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_3); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1022 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1021 * # Suffix array search * phrase_location = node.phrase_location - * sa_range = self.fsa.lookup(str_phrase[-1], len(str_phrase)-1, phrase_location.sa_low, phrase_location.sa_high) # <<<<<<<<<<<<<< + * 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_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->fsa), __pyx_n_s__lookup); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->fsa), __pyx_n_s__lookup); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_str_phrase, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_str_phrase); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_15 = PyInt_FromSsize_t((__pyx_t_5 - 1)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromSsize_t((__pyx_t_5 - 1)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_14); @@ -44972,7 +45080,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __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_9)); __pyx_t_9 = 0; @@ -44982,9 +45090,9 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1023 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1022 * phrase_location = node.phrase_location - * sa_range = self.fsa.lookup(str_phrase[-1], len(str_phrase)-1, phrase_location.sa_low, phrase_location.sa_high) + * 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: @@ -44992,36 +45100,36 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_8 = (__pyx_cur_scope->__pyx_v_sa_range != Py_None); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1024 - * sa_range = self.fsa.lookup(str_phrase[-1], len(str_phrase)-1, phrase_location.sa_low, phrase_location.sa_high) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1023 + * sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high) * if sa_range is not None: * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) # <<<<<<<<<<<<<< * else: * phrase_location = None */ - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 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_9); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_t_9); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L35; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1026 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1025 * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) * else: * phrase_location = None # <<<<<<<<<<<<<< @@ -45032,13 +45140,13 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __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_8_cdec_sa_PhraseLocation *)Py_None); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)Py_None); } __pyx_L35:; } __pyx_L34:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1028 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1027 * phrase_location = None * * if phrase_location is None: # <<<<<<<<<<<<<< @@ -45048,19 +45156,19 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_8 = (((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location) == Py_None); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1029 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1028 * * if phrase_location is None: * node.children[word_id] = None # <<<<<<<<<<<<<< * # Search failed * continue */ - __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - if (PyObject_SetItem(__pyx_t_9, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_9, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1031 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1030 * node.children[word_id] = None * # Search failed * continue # <<<<<<<<<<<<<< @@ -45072,7 +45180,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L36:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1033 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1032 * continue * # Search succeeded * suffix_link = self.rules.root # <<<<<<<<<<<<<< @@ -45085,32 +45193,32 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rules->root); __pyx_cur_scope->__pyx_v_suffix_link = __pyx_cur_scope->__pyx_v_self->rules->root; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1034 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1033 * # 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_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1035 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1034 * 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_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link); @@ -45122,35 +45230,35 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L37:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1036 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1035 * 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_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1037 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1036 * 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_9, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1038 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1037 * 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_9, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -45161,19 +45269,19 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L33:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1039 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1038 * suffix_link=suffix_link, * phrase=hiero_phrase) * node.children[word_id] = new_node # <<<<<<<<<<<<<< * node = new_node * */ - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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":1040 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1039 * phrase=hiero_phrase) * node.children[word_id] = new_node * node = new_node # <<<<<<<<<<<<<< @@ -45186,7 +45294,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __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":1045 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1044 * This should happen before we get to extraction (so that * the node will exist if needed)''' * if arity < self.max_nonterminals: # <<<<<<<<<<<<<< @@ -45196,14 +45304,14 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1046 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1045 * the node will exist if needed)''' * if arity < self.max_nonterminals: * xcat_index = arity+1 # <<<<<<<<<<<<<< * xcat = sym_setindex(self.category, xcat_index) * suffix_link_xcat_index = xcat_index */ - __pyx_t_10 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xcat_index); @@ -45211,17 +45319,17 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1047 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1046 * 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_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_xcat = __pyx_f_8_cdec_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_18); + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1046; __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_18); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1048 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1047 * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) * suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<< @@ -45234,24 +45342,24 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __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":1049 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1048 * 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_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1050 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1049 * suffix_link_xcat_index = xcat_index * if is_shadow_path: * suffix_link_xcat_index = xcat_index-1 # <<<<<<<<<<<<<< * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, */ - __pyx_t_10 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); @@ -45262,168 +45370,168 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L39:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1051 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1050 * 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_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_suffix_link_xcat = __pyx_f_8_cdec_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_18); + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __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_18); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1052 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1051 * suffix_link_xcat_index = xcat_index-1 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<< * suffix_link=node.suffix_link.children[suffix_link_xcat], * phrase= Phrase(phrase + (xcat,))) */ - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1053 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1052 * 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_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1054 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1053 * 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_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __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[8]; __pyx_lineno = 1054; __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 = 1053; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __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 = 1054; __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 = 1053; __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(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1052 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1051 * suffix_link_xcat_index = xcat_index-1 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<< * suffix_link=node.suffix_link.children[suffix_link_xcat], * phrase= Phrase(phrase + (xcat,))) */ - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_SetItemInt(__pyx_t_10, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_9, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_10, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_9, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L38; } __pyx_L38:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1057 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1056 * * # sample from range * if not is_shadow_path: # <<<<<<<<<<<<<< * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (!__pyx_t_8); if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1058 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1057 * # sample from range * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<< * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) */ - __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __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 = 1057; __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); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_8_cdec_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __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_10); - __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_10); + __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1059 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1058 * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns # <<<<<<<<<<<<<< * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: */ - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_num_subpatterns = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)__pyx_t_10)->num_subpatterns; + __pyx_cur_scope->__pyx_v_num_subpatterns = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_10)->num_subpatterns; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1060 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1059 * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) # <<<<<<<<<<<<<< * for j from 0 <= j < num_subpatterns: * chunklen.arr[j] = hiero_phrase.chunklen(j) */ - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __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_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1061 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1060 * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: # <<<<<<<<<<<<<< @@ -45433,24 +45541,24 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_18 = __pyx_cur_scope->__pyx_v_num_subpatterns; for (__pyx_cur_scope->__pyx_v_j = 0; __pyx_cur_scope->__pyx_v_j < __pyx_t_18; __pyx_cur_scope->__pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1062 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1061 * 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_8_cdec_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_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":1063 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1062 * for j from 0 <= j < num_subpatterns: * chunklen.arr[j] = hiero_phrase.chunklen(j) * extracts = [] # <<<<<<<<<<<<<< * j = 0 * extract_start = monitor_cpu() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __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 = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); @@ -45458,7 +45566,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_extracts = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1064 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1063 * chunklen.arr[j] = hiero_phrase.chunklen(j) * extracts = [] * j = 0 # <<<<<<<<<<<<<< @@ -45467,14 +45575,14 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ __pyx_cur_scope->__pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1065 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1064 * extracts = [] * j = 0 * extract_start = monitor_cpu() # <<<<<<<<<<<<<< * while j < sample.len: * extract = [] */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_f_8_cdec_sa_monitor_cpu()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3_sa_monitor_cpu()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_start); @@ -45482,7 +45590,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1066 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1065 * j = 0 * extract_start = monitor_cpu() * while j < sample.len: # <<<<<<<<<<<<<< @@ -45493,14 +45601,14 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_19 = (__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len); if (!__pyx_t_19) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1067 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1066 * extract_start = monitor_cpu() * while j < sample.len: * extract = [] # <<<<<<<<<<<<<< * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1067; __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 = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract); @@ -45508,23 +45616,23 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1069 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1068 * extract = [] * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) # <<<<<<<<<<<<<< * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend(extract) */ - __pyx_f_8_cdec_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_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":1070 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1069 * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) # <<<<<<<<<<<<<< * extracts.extend(extract) * j = j + num_subpatterns */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8_cdec_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_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((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_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract); @@ -45532,27 +45640,27 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_extract = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1071 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1070 * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend(extract) # <<<<<<<<<<<<<< * j = j + num_subpatterns * */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __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 = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_extract); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_cur_scope->__pyx_v_extract); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_extract); - __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1072 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1071 * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend(extract) * j = j + num_subpatterns # <<<<<<<<<<<<<< @@ -45562,7 +45670,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __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":1074 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1073 * j = j + num_subpatterns * * num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<< @@ -45571,22 +45679,22 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ if (unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1073; __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))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1073; __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":1075 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1074 * * 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_9 = PyFloat_FromDouble(__pyx_f_8_cdec_sa_monitor_cpu()); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyFloat_FromDouble(__pyx_f_3_sa_monitor_cpu()); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_stop); @@ -45594,44 +45702,44 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1076 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1075 * num_samples = sample.len/num_subpatterns * extract_stop = monitor_cpu() * self.extract_time = self.extract_time + extract_stop - extract_start # <<<<<<<<<<<<<< * if len(extracts) > 0: * fphrases = {} */ - __pyx_t_9 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Subtract(__pyx_t_10, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Subtract(__pyx_t_10, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_20 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_20 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_20 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_20; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1077 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1076 * extract_stop = monitor_cpu() * self.extract_time = self.extract_time + extract_stop - extract_start * if len(extracts) > 0: # <<<<<<<<<<<<<< * fphrases = {} * fals = {} */ - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); + __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (__pyx_t_5 > 0); if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1078 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1077 * self.extract_time = self.extract_time + extract_stop - extract_start * if len(extracts) > 0: * fphrases = {} # <<<<<<<<<<<<<< * fals = {} * fcount = {} */ - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases)); @@ -45639,14 +45747,14 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1079 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1078 * if len(extracts) > 0: * fphrases = {} * fals = {} # <<<<<<<<<<<<<< * fcount = {} * for f, e, count, als in extracts: */ - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fals)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fals)); @@ -45654,14 +45762,14 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_fals = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1080 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1079 * fphrases = {} * fals = {} * fcount = {} # <<<<<<<<<<<<<< * for f, e, count, als in extracts: * fcount.setdefault(f, 0.0) */ - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fcount)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fcount)); @@ -45669,7 +45777,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_fcount = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1081 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1080 * fals = {} * fcount = {} * for f, e, count, als in extracts: # <<<<<<<<<<<<<< @@ -45679,25 +45787,30 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_t_9 = ((PyObject *)__pyx_cur_scope->__pyx_v_extracts); __Pyx_INCREF(__pyx_t_9); __pyx_t_5 = 0; for (;;) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_10 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { PyObject* sequence = __pyx_t_10; + #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 = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_14 = PyList_GET_ITEM(sequence, 1); __pyx_t_15 = PyList_GET_ITEM(sequence, 2); @@ -45707,29 +45820,37 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(__pyx_t_2); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_14,&__pyx_t_15,&__pyx_t_2}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_14,&__pyx_t_15,&__pyx_t_2}; + __pyx_t_7 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L48_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_14)) goto __pyx_L48_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - index = 2; __pyx_t_15 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_15)) goto __pyx_L48_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 3; __pyx_t_2 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L48_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_17(__pyx_t_7); if (unlikely(!item)) goto __pyx_L48_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L49_unpacking_done; __pyx_L48_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L49_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); @@ -45753,64 +45874,64 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_als = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1082 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1081 * fcount = {} * for f, e, count, als in extracts: * fcount.setdefault(f, 0.0) # <<<<<<<<<<<<<< * fcount[f] = fcount[f] + count * fphrases.setdefault(f, {}) */ - __pyx_t_10 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyDict_SetDefault(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_SetDefault(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1083 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1082 * for f, e, count, als in extracts: * fcount.setdefault(f, 0.0) * fcount[f] = fcount[f] + count # <<<<<<<<<<<<<< * fphrases.setdefault(f, {}) * fphrases[f].setdefault(e, {}) */ - __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __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":1084 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1083 * fcount.setdefault(f, 0.0) * fcount[f] = fcount[f] + count * fphrases.setdefault(f, {}) # <<<<<<<<<<<<<< * fphrases[f].setdefault(e, {}) * fphrases[f][e].setdefault(als,0.0) */ - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_2 = __Pyx_PyDict_SetDefault(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_SetDefault(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1085 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1084 * fcount[f] = fcount[f] + count * fphrases.setdefault(f, {}) * fphrases[f].setdefault(e, {}) # <<<<<<<<<<<<<< * fphrases[f][e].setdefault(als,0.0) * fphrases[f][e][als] = fphrases[f][e][als] + count */ - __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setdefault); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setdefault); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_e); @@ -45818,30 +45939,30 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1086 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1085 * fphrases.setdefault(f, {}) * fphrases[f].setdefault(e, {}) * fphrases[f][e].setdefault(als,0.0) # <<<<<<<<<<<<<< * fphrases[f][e][als] = fphrases[f][e][als] + count * for f, elist in fphrases.iteritems(): */ - __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = PyObject_GetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__setdefault); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__setdefault); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __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 = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_als); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_cur_scope->__pyx_v_als); @@ -45849,177 +45970,121 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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":1087 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1086 * fphrases[f].setdefault(e, {}) * fphrases[f][e].setdefault(als,0.0) * fphrases[f][e][als] = fphrases[f][e][als] + count # <<<<<<<<<<<<<< * for f, elist in fphrases.iteritems(): * f_margin = fcount[f] */ - __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1086; __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_als); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_als); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyNumber_Add(__pyx_t_15, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_t_15, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_2 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (PyObject_SetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_als, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_2, __pyx_cur_scope->__pyx_v_als, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __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/rulefactory.pxi":1088 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1087 * fphrases[f][e].setdefault(als,0.0) * fphrases[f][e][als] = fphrases[f][e][als] + count * for f, elist in fphrases.iteritems(): # <<<<<<<<<<<<<< * f_margin = fcount[f] * for e, alslist in elist.iteritems(): */ - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases)); - __Pyx_XDECREF(__pyx_t_9); - __pyx_t_9 = ((PyObject *)__pyx_cur_scope->__pyx_v_fphrases); __pyx_t_5 = 0; - __pyx_t_21 = PyDict_Size(__pyx_t_9); + __pyx_t_10 = __Pyx_dict_iterator(((PyObject *)__pyx_cur_scope->__pyx_v_fphrases), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_21), (&__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); + __pyx_t_9 = __pyx_t_10; + __pyx_t_10 = 0; while (1) { - if (unlikely(__pyx_t_21 != PyDict_Size(__pyx_t_9))) { - PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (!PyDict_Next(__pyx_t_9, (&__pyx_t_5), (&__pyx_t_22), (&__pyx_t_23))) break; - __Pyx_INCREF(((PyObject *)__pyx_t_22)); + __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_9, __pyx_t_21, &__pyx_t_5, &__pyx_t_10, &__pyx_t_2, NULL, __pyx_t_18); + if (unlikely(__pyx_t_6 == 0)) break; + if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_t_22); - __pyx_cur_scope->__pyx_v_f = __pyx_t_22; - __Pyx_INCREF(((PyObject *)__pyx_t_23)); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_f = __pyx_t_10; + __pyx_t_10 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_elist); - __Pyx_GIVEREF(__pyx_t_23); - __pyx_cur_scope->__pyx_v_elist = __pyx_t_23; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_elist = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1089 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1088 * fphrases[f][e][als] = fphrases[f][e][als] + count * for f, elist in fphrases.iteritems(): * f_margin = fcount[f] # <<<<<<<<<<<<<< * for e, alslist in elist.iteritems(): * alignment = None */ - __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f_margin); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f_margin); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_f_margin = __pyx_t_10; - __pyx_t_10 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_f_margin = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1090 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1089 * for f, elist in fphrases.iteritems(): * f_margin = fcount[f] * for e, alslist in elist.iteritems(): # <<<<<<<<<<<<<< * alignment = None * count = 0 */ - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_elist, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_22 = 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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_23), (&__pyx_t_6)); 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); - __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_10 = __pyx_t_2; __Pyx_INCREF(__pyx_t_10); __pyx_t_24 = 0; - __pyx_t_25 = NULL; - } else { - __pyx_t_24 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_10; + __pyx_t_10 = 0; + while (1) { + __pyx_t_4 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_23, &__pyx_t_22, &__pyx_t_10, &__pyx_t_15, NULL, __pyx_t_6); + if (unlikely(__pyx_t_4 == 0)) break; + if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_25 = Py_TYPE(__pyx_t_10)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (!__pyx_t_25 && PyList_CheckExact(__pyx_t_10)) { - if (__pyx_t_24 >= PyList_GET_SIZE(__pyx_t_10)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_24); __Pyx_INCREF(__pyx_t_2); __pyx_t_24++; - } else if (!__pyx_t_25 && PyTuple_CheckExact(__pyx_t_10)) { - if (__pyx_t_24 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_24); __Pyx_INCREF(__pyx_t_2); __pyx_t_24++; - } else { - __pyx_t_2 = __pyx_t_25(__pyx_t_10); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = PyList_GET_ITEM(sequence, 0); - __pyx_t_14 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_3); if (unlikely(!__pyx_t_15)) goto __pyx_L54_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_3); if (unlikely(!__pyx_t_14)) goto __pyx_L54_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L55_unpacking_done; - __pyx_L54_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L55_unpacking_done:; - } + __Pyx_GOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_e = __pyx_t_15; - __pyx_t_15 = 0; + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_e = __pyx_t_10; + __pyx_t_10 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alslist); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_cur_scope->__pyx_v_alslist = __pyx_t_14; - __pyx_t_14 = 0; + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_alslist = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1091 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1090 * f_margin = fcount[f] * for e, alslist in elist.iteritems(): * alignment = None # <<<<<<<<<<<<<< @@ -46032,7 +46097,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_alignment = Py_None; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1092 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1091 * for e, alslist in elist.iteritems(): * alignment = None * count = 0 # <<<<<<<<<<<<<< @@ -46045,112 +46110,54 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_GIVEREF(__pyx_int_0); __pyx_cur_scope->__pyx_v_count = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1093 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1092 * alignment = None * count = 0 * for als, currcount in alslist.iteritems(): # <<<<<<<<<<<<<< * if currcount > count: * alignment = als */ - __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyList_CheckExact(__pyx_t_14) || PyTuple_CheckExact(__pyx_t_14)) { - __pyx_t_2 = __pyx_t_14; __Pyx_INCREF(__pyx_t_2); __pyx_t_26 = 0; - __pyx_t_27 = NULL; - } else { - __pyx_t_26 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_27 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_24 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_alslist == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - for (;;) { - if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; - } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; - } else { - __pyx_t_14 = __pyx_t_27(__pyx_t_2); - if (unlikely(!__pyx_t_14)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __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 (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __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); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_15)) goto __pyx_L58_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L58_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L59_unpacking_done; - __pyx_L58_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L59_unpacking_done:; - } + __pyx_t_10 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_alslist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_15); + __pyx_t_15 = __pyx_t_10; + __pyx_t_10 = 0; + while (1) { + __pyx_t_26 = __Pyx_dict_iter_next(__pyx_t_15, __pyx_t_25, &__pyx_t_24, &__pyx_t_10, &__pyx_t_14, NULL, __pyx_t_4); + if (unlikely(__pyx_t_26 == 0)) break; + if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_als); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_als = __pyx_t_15; - __pyx_t_15 = 0; + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_als = __pyx_t_10; + __pyx_t_10 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_currcount); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_currcount); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_currcount = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_14); + __pyx_cur_scope->__pyx_v_currcount = __pyx_t_14; + __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1094 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1093 * count = 0 * for als, currcount in alslist.iteritems(): * if currcount > count: # <<<<<<<<<<<<<< * alignment = als * count = currcount */ - __pyx_t_14 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_currcount, __pyx_cur_scope->__pyx_v_count, Py_GT); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_currcount, __pyx_cur_scope->__pyx_v_count, Py_GT); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1095 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1094 * for als, currcount in alslist.iteritems(): * if currcount > count: * alignment = als # <<<<<<<<<<<<<< @@ -46163,7 +46170,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_als); __pyx_cur_scope->__pyx_v_alignment = __pyx_cur_scope->__pyx_v_als; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1096 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1095 * if currcount > count: * alignment = als * count = currcount # <<<<<<<<<<<<<< @@ -46175,28 +46182,28 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_DECREF(__pyx_cur_scope->__pyx_v_count); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_currcount); __pyx_cur_scope->__pyx_v_count = __pyx_cur_scope->__pyx_v_currcount; - goto __pyx_L60; + goto __pyx_L56; } - __pyx_L60:; + __pyx_L56:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1097 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1096 * alignment = als * count = currcount * scores = [] # <<<<<<<<<<<<<< * for model in models: * scores.append(model(f, e, count, fcount[f], num_samples)) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_cur_scope->__pyx_v_scores = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + __pyx_cur_scope->__pyx_v_scores = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1098 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1097 * count = currcount * scores = [] * for model in models: # <<<<<<<<<<<<<< @@ -46204,26 +46211,34 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * yield Rule(self.category, f, e, */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_models) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_models)) { - __pyx_t_2 = __pyx_cur_scope->__pyx_v_models; __Pyx_INCREF(__pyx_t_2); __pyx_t_26 = 0; + __pyx_t_15 = __pyx_cur_scope->__pyx_v_models; __Pyx_INCREF(__pyx_t_15); __pyx_t_25 = 0; __pyx_t_27 = NULL; } else { - __pyx_t_26 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_models); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_27 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_25 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_models); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_27 = Py_TYPE(__pyx_t_15)->tp_iternext; } for (;;) { - if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; - } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; + if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_15)) { + if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_25); __Pyx_INCREF(__pyx_t_14); __pyx_t_25++; + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_15, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif + } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_15)) { + if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_25); __Pyx_INCREF(__pyx_t_14); __pyx_t_25++; + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_15, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_14 = __pyx_t_27(__pyx_t_2); + __pyx_t_14 = __pyx_t_27(__pyx_t_15); if (unlikely(!__pyx_t_14)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46235,114 +46250,118 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_model = __pyx_t_14; __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1099 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1098 * scores = [] * for model in models: * scores.append(model(f, e, count, fcount[f], num_samples)) # <<<<<<<<<<<<<< * yield Rule(self.category, f, e, * scores=scores, word_alignments=alignment) */ - __pyx_t_14 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fcount), __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_15, 0, __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_15, 1, __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_INCREF(__pyx_cur_scope->__pyx_v_count); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_cur_scope->__pyx_v_count); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_cur_scope->__pyx_v_count); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); __pyx_t_14 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_cur_scope->__pyx_v_model, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_scores, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_cur_scope->__pyx_v_model, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_scores, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __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_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1099 * for model in models: * scores.append(model(f, e, count, fcount[f], num_samples)) * yield Rule(self.category, f, e, # <<<<<<<<<<<<<< * scores=scores, word_alignments=alignment) * */ - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __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 = 1100; __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_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __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_3, 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_3, 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_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_15 = 0; + __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1100 * scores.append(model(f, e, count, fcount[f], num_samples)) * yield Rule(self.category, f, e, * scores=scores, word_alignments=alignment) # <<<<<<<<<<<<<< * * if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: */ - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__scores), ((PyObject *)__pyx_cur_scope->__pyx_v_scores)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__word_alignments), __pyx_cur_scope->__pyx_v_alignment) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Rule)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_15; - __pyx_t_15 = 0; + if (PyDict_SetItem(__pyx_t_15, ((PyObject *)__pyx_n_s__scores), ((PyObject *)__pyx_cur_scope->__pyx_v_scores)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_15, ((PyObject *)__pyx_n_s__word_alignments), __pyx_cur_scope->__pyx_v_alignment) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Rule)), ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_5; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_6; __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_9; - __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_10; + __pyx_cur_scope->__pyx_t_4 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_12; - __pyx_cur_scope->__pyx_t_5 = __pyx_t_21; - __pyx_cur_scope->__pyx_t_6 = __pyx_t_24; - __pyx_cur_scope->__pyx_t_7 = __pyx_t_25; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_12; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_18; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_21; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_22; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_23; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; - __pyx_L63_resume_from_yield:; + __pyx_L59_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __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_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_6 = __pyx_cur_scope->__pyx_t_3; + __pyx_t_9 = __pyx_cur_scope->__pyx_t_4; __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_12 = __pyx_cur_scope->__pyx_t_5; + __pyx_cur_scope->__pyx_t_5 = 0; __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_21 = __pyx_cur_scope->__pyx_t_5; - __pyx_t_24 = __pyx_cur_scope->__pyx_t_6; - __pyx_t_25 = __pyx_cur_scope->__pyx_t_7; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_21 = __pyx_cur_scope->__pyx_t_7; + __pyx_t_22 = __pyx_cur_scope->__pyx_t_8; + __pyx_t_23 = __pyx_cur_scope->__pyx_t_9; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __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_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L45; @@ -46355,41 +46374,41 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } __pyx_L32:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1102 * scores=scores, word_alignments=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, alt_id, pathlen + 1, node, phrase, is_shadow_path)) */ - __pyx_t_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (__pyx_t_21 < __pyx_cur_scope->__pyx_v_self->max_length); if (__pyx_t_19) { - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_15 = PyObject_RichCompare(__pyx_t_10, __pyx_t_9, Py_LT); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_9, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_RichCompare(__pyx_t_15, __pyx_t_9, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_9, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_29 = __pyx_t_28; } else { __pyx_t_29 = __pyx_t_8; @@ -46400,72 +46419,72 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1103 * * 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, alt_id, pathlen + 1, node, phrase, is_shadow_path)) * num_subpatterns = arity */ - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_9); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_9); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_21 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_21 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_21; __pyx_t_18+=1) { __pyx_cur_scope->__pyx_v_alt_id = __pyx_t_18; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1104 * 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, alt_id, pathlen + 1, node, phrase, is_shadow_path)) # <<<<<<<<<<<<<< * num_subpatterns = arity * if not is_shadow_path: */ - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_15 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __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_15); - __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); + __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); - PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_cur_scope->__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_10, 4, __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_3, 5, __pyx_cur_scope->__pyx_v_phrase); + PyTuple_SET_ITEM(__pyx_t_10, 5, __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_3, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __pyx_t_10 = 0; - __pyx_t_15 = 0; - __pyx_t_9 = 0; __pyx_t_2 = 0; - __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = 0; + __pyx_t_9 = 0; + __pyx_t_15 = 0; + __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_10)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1105 * for alt_id in range(len(fwords[i+spanlen])): * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) * num_subpatterns = arity # <<<<<<<<<<<<<< @@ -46474,18 +46493,18 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx */ __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1106 * new_frontier.append((k, i+spanlen, 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_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (!__pyx_t_8); if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1107 * num_subpatterns = arity * if not is_shadow_path: * num_subpatterns = num_subpatterns + 1 # <<<<<<<<<<<<<< @@ -46493,18 +46512,18 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * xcat = sym_setindex(self.category, arity+1) */ __pyx_cur_scope->__pyx_v_num_subpatterns = (__pyx_cur_scope->__pyx_v_num_subpatterns + 1); - goto __pyx_L67; + goto __pyx_L63; } - __pyx_L67:; + __pyx_L63:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1108 * 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_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = ((__pyx_t_21 + 1) < __pyx_cur_scope->__pyx_v_self->max_length); if (__pyx_t_19) { __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals); @@ -46520,168 +46539,168 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1110 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1109 * 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_8_cdec_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_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":1111 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1110 * 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_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_10, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1110; __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_xnode); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xnode); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_xnode = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_xnode = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1112 * 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_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __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 = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); __Pyx_INCREF(__pyx_int_1); PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); PyList_SET_ITEM(__pyx_t_9, 3, __pyx_cur_scope->__pyx_v_pathlen); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)PyList_AsTuple(__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_15 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = ((PyObject *)PyList_AsTuple(__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_key = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_cur_scope->__pyx_v_key = __pyx_t_10; + __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1113 * # 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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_10); + __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1114 * 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_8 = ((PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1115 * 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_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L69; + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L65; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1117 * 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_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_121); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_121); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = PyTuple_New(7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9); + __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __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); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_cur_scope->__pyx_v_pathlen); + PyTuple_SET_ITEM(__pyx_t_3, 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_15, 4, __pyx_cur_scope->__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_3, 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_15, 5, ((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); + PyTuple_SET_ITEM(__pyx_t_3, 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_15, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); + PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); __pyx_t_9 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1118; __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_15)); __pyx_t_15 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1118 * 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 = 1119; __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 = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L69:; + __pyx_L65:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1120 * nodes_isteps_away_buffer[key] = frontier_nodes * * for (i, alt, pathlen) in frontier_nodes: # <<<<<<<<<<<<<< @@ -46689,119 +46708,135 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * frontier = new_frontier */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes)) { - __pyx_t_2 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_2); __pyx_t_21 = 0; - __pyx_t_25 = NULL; + __pyx_t_15 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_15); __pyx_t_21 = 0; + __pyx_t_27 = NULL; } else { - __pyx_t_21 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_25 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_21 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_27 = Py_TYPE(__pyx_t_15)->tp_iternext; } for (;;) { - if (!__pyx_t_25 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_21); __Pyx_INCREF(__pyx_t_15); __pyx_t_21++; - } else if (!__pyx_t_25 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_21 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_21); __Pyx_INCREF(__pyx_t_15); __pyx_t_21++; + if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_15)) { + if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_21); __Pyx_INCREF(__pyx_t_3); __pyx_t_21++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif + } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_15)) { + if (__pyx_t_21 >= PyTuple_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_21); __Pyx_INCREF(__pyx_t_3); __pyx_t_21++; + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_15 = __pyx_t_25(__pyx_t_2); - if (unlikely(!__pyx_t_15)) { + __pyx_t_3 = __pyx_t_27(__pyx_t_15); + if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_15); + __Pyx_GOTREF(__pyx_t_3); } - if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) { - PyObject* sequence = __pyx_t_15; + 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 != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_10 = PyList_GET_ITEM(sequence, 0); __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - __pyx_t_10 = PyList_GET_ITEM(sequence, 2); + __pyx_t_2 = PyList_GET_ITEM(sequence, 2); } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __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 = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_14 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __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_3); __pyx_t_3 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_14)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L72_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_9 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L72_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_10 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L72_unpacking_failed; + index = 0; __pyx_t_10 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L68_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_14), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + index = 1; __pyx_t_9 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L68_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 2; __pyx_t_2 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_2)) goto __pyx_L68_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_14), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L73_unpacking_done; - __pyx_L72_unpacking_failed:; + goto __pyx_L69_unpacking_done; + __pyx_L68_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L73_unpacking_done:; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L69_unpacking_done:; } - __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_cur_scope->__pyx_v_i = __pyx_t_18; __pyx_cur_scope->__pyx_v_alt = __pyx_t_6; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_10; - __pyx_t_10 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1121 * * for (i, alt, pathlen) in frontier_nodes: * new_frontier.append((k, i, alt, pathlen, xnode, phrase +(xcat,), is_shadow_path)) # <<<<<<<<<<<<<< * frontier = new_frontier * */ - __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __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_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 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_14)); 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_14)); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); @@ -46810,30 +46845,30 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xnode); PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_cur_scope->__pyx_v_xnode); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xnode); - PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __pyx_t_15 = 0; - __pyx_t_10 = 0; - __pyx_t_9 = 0; __pyx_t_3 = 0; - __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L68; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L64; } - __pyx_L68:; - goto __pyx_L64; + __pyx_L64:; + goto __pyx_L60; } - __pyx_L64:; + __pyx_L60:; __pyx_L19_continue:; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1122 * for (i, alt, pathlen) in frontier_nodes: * new_frontier.append((k, i, alt, pathlen, xnode, phrase +(xcat,), is_shadow_path)) * frontier = new_frontier # <<<<<<<<<<<<<< @@ -46847,37 +46882,37 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1125 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1124 * frontier = new_frontier * * stop_time = monitor_cpu() # <<<<<<<<<<<<<< * logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time)) * gc.collect() */ - __pyx_t_12 = PyFloat_FromDouble(__pyx_f_8_cdec_sa_monitor_cpu()); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble(__pyx_f_3_sa_monitor_cpu()); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1125 * * 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_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); 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_2 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__info); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); 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_14 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_kp_s_122)); PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_kp_s_122)); @@ -46885,55 +46920,55 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1127 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1126 * 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_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_12 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__collect); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__collect); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1127 * 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_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_12 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_kp_s_123)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_123)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_kp_s_123)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_123)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -46952,11 +46987,12 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx __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":1131 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1130 * * * cdef int find_fixpoint(self, # <<<<<<<<<<<<<< @@ -46964,7 +47000,7 @@ static PyObject *__pyx_gb_8_cdec_sa_23HieroCachingRuleFactory_24generator1(__pyx * int* f_links_low, int* f_links_high, */ -static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_e_low_prev; int __pyx_v_e_high_prev; int __pyx_v_f_low_prev; @@ -46986,7 +47022,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_fixpoint", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1145 * 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 # <<<<<<<<<<<<<< @@ -46995,7 +47031,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_e_low[0]) = __pyx_v_e_in_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1146 * * e_low[0] = e_in_low * e_high[0] = e_in_high # <<<<<<<<<<<<<< @@ -47004,19 +47040,19 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_e_high[0]) = __pyx_v_e_in_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1147 * 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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_8_cdec_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 = 1148; __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 = 1147; __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 = 1147; __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":1149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1148 * 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: # <<<<<<<<<<<<<< @@ -47026,7 +47062,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_3 = ((__pyx_v_e_low[0]) == -1); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1154 * # rule X -> X_1 w X_2 / X_1 X_2. This is probably * # not worth the bother, though. * return 0 # <<<<<<<<<<<<<< @@ -47038,7 +47074,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1156 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1155 * # not worth the bother, though. * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: # <<<<<<<<<<<<<< @@ -47054,7 +47090,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1156 * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: * if e_in_low - e_low[0] < min_ex_size: # <<<<<<<<<<<<<< @@ -47064,7 +47100,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_5 = ((__pyx_v_e_in_low - (__pyx_v_e_low[0])) < __pyx_v_min_ex_size); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1157 * 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 # <<<<<<<<<<<<<< @@ -47073,7 +47109,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1158 * if e_in_low - e_low[0] < min_ex_size: * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: # <<<<<<<<<<<<<< @@ -47083,7 +47119,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_5 = ((__pyx_v_e_low[0]) < 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1160 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1159 * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: * return 0 # <<<<<<<<<<<<<< @@ -47102,7 +47138,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1161 * return 0 * * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -47112,7 +47148,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_5 = (((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1163 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1162 * * if e_high[0] - e_low[0] > max_e_len: * return 0 # <<<<<<<<<<<<<< @@ -47124,7 +47160,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py goto __pyx_L6; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1164 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1163 * if e_high[0] - e_low[0] > max_e_len: * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: # <<<<<<<<<<<<<< @@ -47140,7 +47176,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1164 * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: * if e_high[0] - e_in_high < min_ex_size: # <<<<<<<<<<<<<< @@ -47150,7 +47186,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (((__pyx_v_e_high[0]) - __pyx_v_e_in_high) < __pyx_v_min_ex_size); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1166 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1165 * 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 # <<<<<<<<<<<<<< @@ -47159,7 +47195,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1166 * 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: # <<<<<<<<<<<<<< @@ -47169,7 +47205,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_e_high[0]) > __pyx_v_e_sent_len); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1168 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1167 * e_high[0] = e_in_high + min_ex_size * if e_high[0] > e_sent_len: * return 0 # <<<<<<<<<<<<<< @@ -47188,7 +47224,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1169 * return 0 * * f_back_low[0] = -1 # <<<<<<<<<<<<<< @@ -47197,7 +47233,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_f_back_low[0]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1170 * * f_back_low[0] = -1 * f_back_high[0] = -1 # <<<<<<<<<<<<<< @@ -47206,7 +47242,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_f_back_high[0]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1171 * f_back_low[0] = -1 * f_back_high[0] = -1 * f_low_prev = f_low # <<<<<<<<<<<<<< @@ -47215,17 +47251,17 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_f_low_prev = __pyx_v_f_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1173 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1172 * 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 = 1173; __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 = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_high_prev = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1174 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1173 * f_low_prev = f_low * f_high_prev = f_high * new_x = 0 # <<<<<<<<<<<<<< @@ -47234,7 +47270,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_new_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1175 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1174 * f_high_prev = f_high * new_x = 0 * new_low_x = 0 # <<<<<<<<<<<<<< @@ -47243,7 +47279,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_new_low_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1176 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1175 * new_x = 0 * new_low_x = 0 * new_high_x = 0 # <<<<<<<<<<<<<< @@ -47252,7 +47288,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_new_high_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1177 * new_high_x = 0 * * while True: # <<<<<<<<<<<<<< @@ -47262,7 +47298,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py while (1) { if (!1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1179 * while True: * * if f_back_low[0] == -1: # <<<<<<<<<<<<<< @@ -47272,45 +47308,45 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_f_back_low[0]) == -1); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1180 * * 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_8_cdec_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 = 1181; __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_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 = 1180; __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":1183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1182 * 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_8_cdec_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 = 1183; __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_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 = 1182; __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":1184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1183 * 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_8_cdec_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 = 1184; __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_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 = 1183; __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":1186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1185 * 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: # <<<<<<<<<<<<<< @@ -47320,7 +47356,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_f_back_low[0]) > __pyx_v_f_low); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1186 * * if f_back_low[0] > f_low: * f_back_low[0] = f_low # <<<<<<<<<<<<<< @@ -47332,36 +47368,36 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L12:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1189 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1188 * 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 = 1189; __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 = 1188; __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); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_high, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __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 = 1189; __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 = 1188; __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":1190 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1189 * * 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 = 1190; __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 = 1189; __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":1192 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1191 * f_back_high[0] = f_high * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<< @@ -47377,7 +47413,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1193 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1192 * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: * return 1 # <<<<<<<<<<<<<< @@ -47390,7 +47426,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1195 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1194 * return 1 * * if allow_low_x == 0 and f_back_low[0] < f_low: # <<<<<<<<<<<<<< @@ -47406,7 +47442,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1196 * if allow_low_x == 0 and f_back_low[0] < f_low: * # FAIL: f phrase is not tight * return 0 # <<<<<<<<<<<<<< @@ -47419,7 +47455,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1199 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1198 * return 0 * * if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<< @@ -47429,7 +47465,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_5 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1201 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1200 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: f back projection is too wide * return 0 # <<<<<<<<<<<<<< @@ -47442,7 +47478,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1203 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1202 * return 0 * * if allow_high_x == 0 and f_back_high[0] > f_high: # <<<<<<<<<<<<<< @@ -47451,12 +47487,12 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __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 = 1203; __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 = 1202; __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); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_v_f_high, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 1203; __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 = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; } else { @@ -47464,7 +47500,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1204 * if allow_high_x == 0 and f_back_high[0] > f_high: * # FAIL: extension on high side not allowed * return 0 # <<<<<<<<<<<<<< @@ -47477,7 +47513,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1207 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1206 * return 0 * * if f_low != f_back_low[0]: # <<<<<<<<<<<<<< @@ -47487,7 +47523,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (__pyx_v_f_low != (__pyx_v_f_back_low[0])); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1207 * * if f_low != f_back_low[0]: * if new_low_x == 0: # <<<<<<<<<<<<<< @@ -47497,7 +47533,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (__pyx_v_new_low_x == 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1208 * if f_low != f_back_low[0]: * if new_low_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -47507,7 +47543,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (__pyx_v_new_x >= __pyx_v_max_new_x); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1210 * if new_x >= max_new_x: * # FAIL: extension required on low side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -47520,7 +47556,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1213 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1212 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -47529,7 +47565,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1214 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1213 * else: * new_x = new_x + 1 * new_low_x = 1 # <<<<<<<<<<<<<< @@ -47543,7 +47579,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L19:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1215 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1214 * new_x = new_x + 1 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: # <<<<<<<<<<<<<< @@ -47553,7 +47589,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_f_low - (__pyx_v_f_back_low[0])) < __pyx_v_min_fx_size); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1216 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1215 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: * f_back_low[0] = f_low - min_fx_size # <<<<<<<<<<<<<< @@ -47562,7 +47598,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ (__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1217 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1216 * 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: # <<<<<<<<<<<<<< @@ -47572,7 +47608,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1219 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1218 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on low side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -47585,7 +47621,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L22:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1220 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1219 * # FAIL: extension required on low side violates max initial length * return 0 * if f_back_low[0] < 0: # <<<<<<<<<<<<<< @@ -47595,7 +47631,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_f_back_low[0]) < 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1222 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1221 * if f_back_low[0] < 0: * # FAIL: extension required on low side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -47614,23 +47650,23 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L18:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1224 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1223 * 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 = 1224; __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 = 1223; __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); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_v_f_high, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __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 = 1224; __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 = 1223; __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":1225 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1224 * * if f_high != f_back_high[0]: * if new_high_x == 0: # <<<<<<<<<<<<<< @@ -47640,7 +47676,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (__pyx_v_new_high_x == 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1226 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1225 * if f_high != f_back_high[0]: * if new_high_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -47650,7 +47686,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (__pyx_v_new_x >= __pyx_v_max_new_x); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1228 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1227 * if new_x >= max_new_x: * # FAIL: extension required on high side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -47663,7 +47699,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1230 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1229 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -47672,7 +47708,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1231 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1230 * else: * new_x = new_x + 1 * new_high_x = 1 # <<<<<<<<<<<<<< @@ -47686,45 +47722,45 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L25:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1231 * 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 = 1232; __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 = 1231; __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 = 1232; __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 = 1231; __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 = 1232; __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 = 1231; __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); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_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 = 1232; __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 = 1231; __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":1233 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1232 * 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 = 1233; __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 = 1232; __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 = 1233; __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 = 1232; __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 = 1233; __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 = 1232; __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":1234 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1233 * 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: # <<<<<<<<<<<<<< @@ -47734,7 +47770,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1235 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on high side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -47747,7 +47783,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1236 * # FAIL: extension required on high side violates max initial length * return 0 * if f_back_high[0] > f_sent_len: # <<<<<<<<<<<<<< @@ -47757,7 +47793,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_4 = ((__pyx_v_f_back_high[0]) > __pyx_v_f_sent_len); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1239 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1238 * if f_back_high[0] > f_sent_len: * # FAIL: extension required on high side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -47776,7 +47812,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1240 * return 0 * * e_low_prev = e_low[0] # <<<<<<<<<<<<<< @@ -47785,7 +47821,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_e_low_prev = (__pyx_v_e_low[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1242 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1241 * * e_low_prev = e_low[0] * e_high_prev = e_high[0] # <<<<<<<<<<<<<< @@ -47794,29 +47830,29 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_e_high_prev = (__pyx_v_e_high[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1244 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1243 * 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_8_cdec_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 = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1243; __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":1245 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1244 * * 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_8_cdec_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 = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1244; __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":1246 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1245 * 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: # <<<<<<<<<<<<<< @@ -47832,7 +47868,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1247 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1246 * 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 # <<<<<<<<<<<<<< @@ -47845,7 +47881,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L30:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1248 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1247 * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: * return 1 * if allow_arbitrary_x == 0: # <<<<<<<<<<<<<< @@ -47855,7 +47891,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_3 = (__pyx_v_allow_arbitrary_x == 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1250 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1249 * if allow_arbitrary_x == 0: * # FAIL: arbitrary expansion not permitted * return 0 # <<<<<<<<<<<<<< @@ -47868,7 +47904,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L31:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1251 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1250 * # FAIL: arbitrary expansion not permitted * return 0 * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -47878,7 +47914,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __pyx_t_3 = (((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1253 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1252 * if e_high[0] - e_low[0] > max_e_len: * # FAIL: re-projection violates sentence max phrase length * return 0 # <<<<<<<<<<<<<< @@ -47891,7 +47927,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py } __pyx_L32:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1253 * # FAIL: re-projection violates sentence max phrase length * return 0 * f_low_prev = f_back_low[0] # <<<<<<<<<<<<<< @@ -47900,7 +47936,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py */ __pyx_v_f_low_prev = (__pyx_v_f_back_low[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1254 * return 0 * f_low_prev = f_back_low[0] * f_high_prev = f_back_high[0] # <<<<<<<<<<<<<< @@ -47916,14 +47952,14 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("_cdec_sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("_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":1258 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1257 * * * cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<< @@ -47931,7 +47967,7 @@ static int __pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint(struct __py * cdef int i */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYTHON_UNUSED struct __pyx_obj_8_cdec_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_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) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -47941,7 +47977,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT int __pyx_t_4; __Pyx_RefNannySetupContext("find_projection", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1261 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1260 * int* out_low, int* out_high): * cdef int i * for i from in_low <= i < in_high: # <<<<<<<<<<<<<< @@ -47951,7 +47987,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT __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":1262 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1261 * cdef int i * for i from in_low <= i < in_high: * if in_links_low[i] != -1: # <<<<<<<<<<<<<< @@ -47961,7 +47997,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT __pyx_t_2 = ((__pyx_v_in_links_low[__pyx_v_i]) != -1); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1263 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1262 * 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]: # <<<<<<<<<<<<<< @@ -47977,7 +48013,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1264 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1263 * 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] # <<<<<<<<<<<<<< @@ -47989,7 +48025,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1265 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1264 * 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]: # <<<<<<<<<<<<<< @@ -48005,7 +48041,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1266 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1265 * 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] # <<<<<<<<<<<<<< @@ -48027,7 +48063,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1269 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1268 * * * cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): # <<<<<<<<<<<<<< @@ -48035,13 +48071,13 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection(CYT * new_len = arr_len[0] + data_len */ -static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED struct __pyx_obj_8_cdec_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_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) { 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":1271 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1270 * 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 # <<<<<<<<<<<<<< @@ -48050,7 +48086,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN */ __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1272 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1271 * cdef int new_len * new_len = arr_len[0] + data_len * arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48059,7 +48095,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN */ __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1272 * new_len = arr_len[0] + data_len * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48068,7 +48104,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN */ 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":1274 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1273 * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len # <<<<<<<<<<<<<< @@ -48077,7 +48113,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN */ (__pyx_v_arr_len[0]) = __pyx_v_new_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1275 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1274 * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len * return arr # <<<<<<<<<<<<<< @@ -48093,7 +48129,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1278 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1277 * * * 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, # <<<<<<<<<<<<<< @@ -48101,7 +48137,7 @@ static int *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UN * int sent_id, int e_sent_len, int e_sent_start): */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(struct __pyx_obj_8_cdec_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_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) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -48118,7 +48154,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str int __pyx_v_len2; int __pyx_v_step; int __pyx_v_num_chunks; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_ephr_arr = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_ephr_arr = 0; PyObject *__pyx_v_result = 0; PyObject *__pyx_v_indexes = NULL; PyObject *__pyx_r = NULL; @@ -48139,19 +48175,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract_phrases", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1286 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1285 * cdef result * * result = [] # <<<<<<<<<<<<<< * len1 = 0 * e_gaps1 = <int*> malloc(0) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1286; __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 = 1285; __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":1287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1286 * * result = [] * len1 = 0 # <<<<<<<<<<<<<< @@ -48160,7 +48196,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_len1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1288 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1287 * result = [] * len1 = 0 * e_gaps1 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -48169,19 +48205,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gaps1 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1289 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1288 * len1 = 0 * e_gaps1 = <int*> malloc(0) * ephr_arr = IntList() # <<<<<<<<<<<<<< * * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ephr_arr = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_ephr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1291 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1290 * ephr_arr = IntList() * * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<< @@ -48190,7 +48226,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1292 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1291 * * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) * if num_gaps > 0: # <<<<<<<<<<<<<< @@ -48200,7 +48236,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = (__pyx_v_num_gaps > 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1293 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1292 * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) * if num_gaps > 0: * e_gap_order[0] = 0 # <<<<<<<<<<<<<< @@ -48209,7 +48245,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ (__pyx_v_e_gap_order[0]) = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1294 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1293 * if num_gaps > 0: * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -48219,7 +48255,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1295 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1294 * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: # <<<<<<<<<<<<<< @@ -48229,7 +48265,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1296 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1295 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<< @@ -48239,7 +48275,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = ((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1296 * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: # <<<<<<<<<<<<<< @@ -48249,7 +48285,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1298 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1297 * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<< @@ -48259,7 +48295,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str (__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":1299 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1298 * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i # <<<<<<<<<<<<<< @@ -48268,7 +48304,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ (__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1300 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1299 * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i * break # <<<<<<<<<<<<<< @@ -48282,7 +48318,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1302 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1301 * break * else: * e_gap_order[i] = i # <<<<<<<<<<<<<< @@ -48297,7 +48333,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1304 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1303 * e_gap_order[i] = i * * e_x_low = e_low # <<<<<<<<<<<<<< @@ -48306,7 +48342,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_x_low = __pyx_v_e_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1304 * * e_x_low = e_low * e_x_high = e_high # <<<<<<<<<<<<<< @@ -48315,7 +48351,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_x_high = __pyx_v_e_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1306 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1305 * e_x_low = e_low * e_x_high = e_high * if self.tight_phrases == 0: # <<<<<<<<<<<<<< @@ -48325,7 +48361,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = (__pyx_v_self->tight_phrases == 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1307 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1306 * e_x_high = e_high * if self.tight_phrases == 0: * 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: # <<<<<<<<<<<<<< @@ -48348,7 +48384,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1308 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1307 * if self.tight_phrases == 0: * 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 # <<<<<<<<<<<<<< @@ -48358,7 +48394,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_v_e_x_low = (__pyx_v_e_x_low - 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1308 * 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: # <<<<<<<<<<<<<< @@ -48381,7 +48417,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1310 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1309 * 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 # <<<<<<<<<<<<<< @@ -48394,7 +48430,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1312 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1311 * e_x_high = e_x_high + 1 * * for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<< @@ -48404,17 +48440,17 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1313 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1312 * * 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_8_cdec_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_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":1315 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1314 * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) * * for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -48424,7 +48460,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1316 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1315 * * for i from 0 <= i < num_gaps: * e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -48433,7 +48469,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1317 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1316 * for i from 0 <= i < num_gaps: * e_gaps2 = <int*> malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -48442,7 +48478,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_len2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1319 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1318 * len2 = 0 * * j = e_gap_order[i] # <<<<<<<<<<<<<< @@ -48451,7 +48487,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1320 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1319 * * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<< @@ -48460,7 +48496,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1321 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1320 * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] # <<<<<<<<<<<<<< @@ -48469,7 +48505,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1321 * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] * if self.tight_phrases == 0: # <<<<<<<<<<<<<< @@ -48479,7 +48515,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = (__pyx_v_self->tight_phrases == 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1323 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1322 * e_x_gap_high = e_gap_high[j] * if self.tight_phrases == 0: * while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1: # <<<<<<<<<<<<<< @@ -48496,7 +48532,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1324 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1323 * if self.tight_phrases == 0: * 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 # <<<<<<<<<<<<<< @@ -48506,7 +48542,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1325 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1324 * 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: # <<<<<<<<<<<<<< @@ -48523,7 +48559,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1326 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1325 * 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 # <<<<<<<<<<<<<< @@ -48536,7 +48572,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } __pyx_L20:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1328 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1327 * e_x_gap_high = e_x_gap_high + 1 * * k = 0 # <<<<<<<<<<<<<< @@ -48545,7 +48581,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_k = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1328 * * k = 0 * step = 1+(i*2) # <<<<<<<<<<<<<< @@ -48554,7 +48590,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_step = (1 + (__pyx_v_i * 2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1329 * k = 0 * step = 1+(i*2) * while k < len1: # <<<<<<<<<<<<<< @@ -48565,7 +48601,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_6 = (__pyx_v_k < __pyx_v_len1); if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1331 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1330 * step = 1+(i*2) * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: # <<<<<<<<<<<<<< @@ -48575,7 +48611,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1331 * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: * if m >= e_gaps1[k+step-1]: # <<<<<<<<<<<<<< @@ -48585,7 +48621,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_6 = (__pyx_v_m >= (__pyx_v_e_gaps1[((__pyx_v_k + __pyx_v_step) - 1)])); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1333 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1332 * 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: # <<<<<<<<<<<<<< @@ -48595,7 +48631,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1334 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1333 * 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 # <<<<<<<<<<<<<< @@ -48605,32 +48641,32 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_6 = ((__pyx_v_n - __pyx_v_m) >= 1); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1335 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1334 * 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_8_cdec_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_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":1336 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1335 * 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_8_cdec_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_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":1337 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1336 * 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_8_cdec_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_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:; @@ -48640,7 +48676,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_L29:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1338 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1337 * 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 # <<<<<<<<<<<<<< @@ -48650,7 +48686,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_v_k = (__pyx_v_k + __pyx_v_step); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1338 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) * k = k + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -48659,7 +48695,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1340 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1339 * k = k + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -48668,7 +48704,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1341 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1340 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -48678,7 +48714,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_v_len1 = __pyx_v_len2; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1343 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1342 * len1 = len2 * * step = 1+(num_gaps*2) # <<<<<<<<<<<<<< @@ -48687,7 +48723,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_step = (1 + (__pyx_v_num_gaps * 2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1344 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1343 * * step = 1+(num_gaps*2) * e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -48696,7 +48732,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1345 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1344 * step = 1+(num_gaps*2) * e_gaps2 = <int*> malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -48705,7 +48741,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_len2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1346 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1345 * e_gaps2 = <int*> malloc(0) * len2 = 0 * for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<< @@ -48715,7 +48751,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1346 * len2 = 0 * for i from e_high <= i <= e_x_high: * j = 0 # <<<<<<<<<<<<<< @@ -48724,7 +48760,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1347 * for i from e_high <= i <= e_x_high: * j = 0 * while j < len1: # <<<<<<<<<<<<<< @@ -48735,7 +48771,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_6 = (__pyx_v_j < __pyx_v_len1); if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1348 * j = 0 * while j < len1: * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: # <<<<<<<<<<<<<< @@ -48751,28 +48787,28 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1349 * 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_8_cdec_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_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":1351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1350 * 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_8_cdec_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_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":1352 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1351 * 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 # <<<<<<<<<<<<<< @@ -48783,7 +48819,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1353 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1352 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) * j = j + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -48792,7 +48828,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1354 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1353 * j = j + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -48801,7 +48837,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1355 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1354 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -48810,7 +48846,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_len1 = __pyx_v_len2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1357 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1356 * len1 = len2 * * step = (num_gaps+1)*2 # <<<<<<<<<<<<<< @@ -48819,7 +48855,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_step = ((__pyx_v_num_gaps + 1) * 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1358 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1357 * * step = (num_gaps+1)*2 * i = 0 # <<<<<<<<<<<<<< @@ -48828,7 +48864,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1360 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1359 * i = 0 * * while i < len1: # <<<<<<<<<<<<<< @@ -48839,16 +48875,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = (__pyx_v_i < __pyx_v_len1); if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1361 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1360 * * while i < len1: * ephr_arr._clear() # <<<<<<<<<<<<<< * num_chunks = 0 * indexes = [] */ - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1361 * while i < len1: * ephr_arr._clear() * num_chunks = 0 # <<<<<<<<<<<<<< @@ -48857,20 +48893,20 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_num_chunks = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1363 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1362 * ephr_arr._clear() * num_chunks = 0 * indexes = [] # <<<<<<<<<<<<<< * for j from 0 <= j < num_gaps+1: * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1363; __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 = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(((PyObject *)__pyx_v_indexes)); __pyx_v_indexes = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1363 * num_chunks = 0 * indexes = [] * for j from 0 <= j < num_gaps+1: # <<<<<<<<<<<<<< @@ -48880,7 +48916,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1364 * indexes = [] * for j from 0 <= j < num_gaps+1: * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<< @@ -48890,7 +48926,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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)])); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1366 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1365 * 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 # <<<<<<<<<<<<<< @@ -48902,7 +48938,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } __pyx_L42:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1367 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1366 * 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]: # <<<<<<<<<<<<<< @@ -48912,19 +48948,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __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":1368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1367 * 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 = 1368; __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 = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1367; __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":1369 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1368 * 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]]) # <<<<<<<<<<<<<< @@ -48932,14 +48968,14 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str * indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) */ __pyx_t_4 = (__pyx_v_self->eda->data->arr[(__pyx_v_e_sent_start + __pyx_v_k)]); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_vtabstruct_8_cdec_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); + ((struct __pyx_vtabstruct_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":1370 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1369 * indexes.append(k) * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: # <<<<<<<<<<<<<< @@ -48949,32 +48985,32 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_t_2 = (__pyx_v_j < __pyx_v_num_gaps); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1370 * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: * indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) # <<<<<<<<<<<<<< * ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) * i = i + step */ - __pyx_t_1 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = 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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1370; __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":1372 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1371 * 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_8_cdec_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); + ((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))); goto __pyx_L45; } __pyx_L45:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1373 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1372 * 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 # <<<<<<<<<<<<<< @@ -48983,7 +49019,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ __pyx_v_i = (__pyx_v_i + __pyx_v_step); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1374 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1373 * 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: # <<<<<<<<<<<<<< @@ -48999,22 +49035,22 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1375 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1374 * 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 = 1375; __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 = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_ephr_arr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_ephr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_ephr_arr)); - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __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 = 1375; __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 = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); @@ -49022,7 +49058,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_indexes)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indexes)); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -49031,7 +49067,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_L46:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1377 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1376 * result.append((Phrase(ephr_arr),indexes)) * * free(e_gaps1) # <<<<<<<<<<<<<< @@ -49040,7 +49076,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1378 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1377 * * free(e_gaps1) * free(e_gap_order) # <<<<<<<<<<<<<< @@ -49049,7 +49085,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str */ free(__pyx_v_e_gap_order); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1379 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1378 * free(e_gaps1) * free(e_gap_order) * return result # <<<<<<<<<<<<<< @@ -49066,7 +49102,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_ephr_arr); @@ -49077,7 +49113,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1381 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1380 * return result * * cdef create_alignments(self, int* sent_links, int num_links, findexes, eindexes): # <<<<<<<<<<<<<< @@ -49085,9 +49121,9 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases(str * ret = IntList() */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(CYTHON_UNUSED struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_sent_links, int __pyx_v_num_links, PyObject *__pyx_v_findexes, PyObject *__pyx_v_eindexes) { +static PyObject *__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, PyObject *__pyx_v_findexes, PyObject *__pyx_v_eindexes) { unsigned int __pyx_v_i; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_ret = NULL; + struct __pyx_obj_3_sa_IntList *__pyx_v_ret = NULL; PyObject *__pyx_v_s = NULL; PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_j = NULL; @@ -49105,56 +49141,56 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_alignments", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1383 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1382 * cdef create_alignments(self, int* sent_links, int num_links, findexes, eindexes): * cdef unsigned i * ret = IntList() # <<<<<<<<<<<<<< * for i in range(len(findexes)): * s = findexes[i] */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ret = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_ret = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1384 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1383 * cdef unsigned i * ret = IntList() * for i in range(len(findexes)): # <<<<<<<<<<<<<< * s = findexes[i] * if (s<0): */ - __pyx_t_2 = PyObject_Length(__pyx_v_findexes); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_findexes); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 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":1385 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1384 * ret = IntList() * for i in range(len(findexes)): * s = findexes[i] # <<<<<<<<<<<<<< * if (s<0): * continue */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_findexes, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_findexes, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_s); __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1386 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1385 * for i in range(len(findexes)): * s = findexes[i] * if (s<0): # <<<<<<<<<<<<<< * continue * idx = 0 */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_s, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_s, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1386; __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 = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1387 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1386 * s = findexes[i] * if (s<0): * continue # <<<<<<<<<<<<<< @@ -49166,7 +49202,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1388 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1387 * if (s<0): * continue * idx = 0 # <<<<<<<<<<<<<< @@ -49177,7 +49213,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C __Pyx_XDECREF(__pyx_v_idx); __pyx_v_idx = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1388 * continue * idx = 0 * while (idx < num_links*2): # <<<<<<<<<<<<<< @@ -49185,53 +49221,53 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C * 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 = 1389; __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 = 1388; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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 = 1389; __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 = 1388; __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":1390 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1389 * idx = 0 * while (idx < num_links*2): * if (sent_links[idx] == s): # <<<<<<<<<<<<<< * j = eindexes.index(sent_links[idx+1]) * ret.append(i*65536+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 = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __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 = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_s, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_s, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __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 = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1391 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1390 * while (idx < num_links*2): * if (sent_links[idx] == s): * j = eindexes.index(sent_links[idx+1]) # <<<<<<<<<<<<<< * ret.append(i*65536+j) * idx += 2 */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_eindexes, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_eindexes, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Add(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __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 = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1390; __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_7)); __pyx_t_7 = 0; @@ -49239,19 +49275,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C __pyx_v_j = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1392 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1391 * if (sent_links[idx] == s): * j = eindexes.index(sent_links[idx+1]) * ret.append(i*65536+j) # <<<<<<<<<<<<<< * idx += 2 * return ret */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_i * 65536)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_i * 65536)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -49259,14 +49295,14 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1393 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1392 * j = eindexes.index(sent_links[idx+1]) * ret.append(i*65536+j) * idx += 2 # <<<<<<<<<<<<<< * return ret * */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_idx); __pyx_v_idx = __pyx_t_5; @@ -49275,7 +49311,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C __pyx_L3_continue:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1394 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1393 * ret.append(i*65536+j) * idx += 2 * return ret # <<<<<<<<<<<<<< @@ -49293,7 +49329,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_ret); @@ -49305,7 +49341,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1396 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1395 * return ret * * cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): # <<<<<<<<<<<<<< @@ -49313,7 +49349,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments(C * cdef int *f_gap_low, *f_gap_high, *e_gap_low, *e_gap_high, num_gaps, gap_start */ -static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_phrase, struct __pyx_t_8_cdec_sa_Matching *__pyx_v_matching, int *__pyx_v_chunklen, int __pyx_v_num_chunks) { +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) { int *__pyx_v_sent_links; int *__pyx_v_e_links_low; int *__pyx_v_e_links_high; @@ -49354,8 +49390,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py float __pyx_v_pair_count; PyObject *__pyx_v_extracts = 0; PyObject *__pyx_v_phrase_list = 0; - struct __pyx_obj_8_cdec_sa_IntList *__pyx_v_fphr_arr = 0; - struct __pyx_obj_8_cdec_sa_Phrase *__pyx_v_fphr = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_fphr_arr = 0; + struct __pyx_obj_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; @@ -49399,19 +49435,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1409 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1408 * cdef reason_for_failure * * fphr_arr = IntList() # <<<<<<<<<<<<<< * phrase_len = phrase.n * extracts = [] */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_fphr_arr = ((struct __pyx_obj_8_cdec_sa_IntList *)__pyx_t_1); + __pyx_v_fphr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1410 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1409 * * fphr_arr = IntList() * phrase_len = phrase.n # <<<<<<<<<<<<<< @@ -49420,28 +49456,28 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_phrase_len = __pyx_v_phrase->n; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1411 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1410 * 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 = 1411; __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 = 1410; __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":1412 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1411 * 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_8_cdec_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_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":1414 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1413 * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<< @@ -49450,7 +49486,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1415 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1414 * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] * e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<< @@ -49459,7 +49495,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1416 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1415 * 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 # <<<<<<<<<<<<<< @@ -49468,7 +49504,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1417 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1416 * 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] # <<<<<<<<<<<<<< @@ -49477,7 +49513,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1418 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1417 * 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] # <<<<<<<<<<<<<< @@ -49486,7 +49522,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1419 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1418 * 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 # <<<<<<<<<<<<<< @@ -49495,21 +49531,21 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1421 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1420 * f_sent_len = f_sent_end - f_sent_start - 1 * * self.findexes1.reset() # <<<<<<<<<<<<<< * sofar = 0 * for i in range(num_chunks): */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes1), __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes1), __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1420; __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 = 1421; __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[8]; __pyx_lineno = 1420; __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":1422 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1421 * * self.findexes1.reset() * sofar = 0 # <<<<<<<<<<<<<< @@ -49519,7 +49555,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_INCREF(__pyx_int_0); __pyx_v_sofar = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1423 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1422 * self.findexes1.reset() * sofar = 0 * for i in range(num_chunks): # <<<<<<<<<<<<<< @@ -49530,7 +49566,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1424 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1423 * sofar = 0 * for i in range(num_chunks): * for j in range(chunklen[i]): # <<<<<<<<<<<<<< @@ -49541,35 +49577,35 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py 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":1425 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1424 * 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_2 = 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_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = 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_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1424; __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":1426 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1425 * 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 = 1426; __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 = 1425; __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":1427 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1426 * self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); * sofar += 1 * if (i+1<num_chunks): # <<<<<<<<<<<<<< @@ -49579,28 +49615,28 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = ((__pyx_v_i + 1) < __pyx_v_num_chunks); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1428 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1427 * 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 = 1428; __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 = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1427; __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":1429 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1428 * if (i+1<num_chunks): * self.findexes1.append(phrase[sofar]) * sofar += 1 # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_sofar); __pyx_v_sofar = __pyx_t_2; @@ -49610,7 +49646,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_L7:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1432 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1431 * * * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -49619,7 +49655,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1433 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1432 * * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -49628,7 +49664,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1434 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1433 * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -49637,7 +49673,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1435 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1434 * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -49646,7 +49682,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1436 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1435 * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49655,7 +49691,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1437 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1436 * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49664,7 +49700,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1438 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1437 * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49673,7 +49709,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1439 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1438 * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49682,7 +49718,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1440 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1439 * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49691,7 +49727,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1441 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1440 * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) * memset(f_gap_high, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -49700,7 +49736,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1442 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1441 * 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)) # <<<<<<<<<<<<<< @@ -49709,7 +49745,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1443 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1442 * 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)) # <<<<<<<<<<<<<< @@ -49718,7 +49754,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1445 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1444 * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) * * reason_for_failure = "" # <<<<<<<<<<<<<< @@ -49728,7 +49764,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_INCREF(((PyObject *)__pyx_kp_s_42)); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_42); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1447 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1446 * reason_for_failure = "" * * for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<< @@ -49738,7 +49774,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_e_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1448 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1447 * * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -49747,7 +49783,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__pyx_v_e_links_low[__pyx_v_i]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1449 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1448 * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 * e_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -49757,7 +49793,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py (__pyx_v_e_links_high[__pyx_v_i]) = -1; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1450 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1449 * e_links_low[i] = -1 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<< @@ -49767,7 +49803,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_f_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1451 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1450 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -49776,7 +49812,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__pyx_v_f_links_low[__pyx_v_i]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1452 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1451 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 * f_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -49786,7 +49822,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py (__pyx_v_f_links_high[__pyx_v_i]) = -1; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1458 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1457 * # links that we care about (but then how to look up * # when we want to check something on the e side?) * i = 0 # <<<<<<<<<<<<<< @@ -49795,7 +49831,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1459 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1458 * # when we want to check something on the e side?) * i = 0 * while i < num_links*2: # <<<<<<<<<<<<<< @@ -49806,7 +49842,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_i < (__pyx_v_num_links * 2)); if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1460 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1459 * i = 0 * while i < num_links*2: * f_i = sent_links[i] # <<<<<<<<<<<<<< @@ -49815,7 +49851,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1461 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1460 * while i < num_links*2: * f_i = sent_links[i] * e_i = sent_links[i+1] # <<<<<<<<<<<<<< @@ -49824,7 +49860,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1462 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1461 * 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: # <<<<<<<<<<<<<< @@ -49840,7 +49876,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1463 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1462 * 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 # <<<<<<<<<<<<<< @@ -49852,7 +49888,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1464 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1463 * 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: # <<<<<<<<<<<<<< @@ -49868,7 +49904,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1465 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1464 * 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 # <<<<<<<<<<<<<< @@ -49880,7 +49916,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1466 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1465 * 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: # <<<<<<<<<<<<<< @@ -49896,7 +49932,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1467 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1466 * 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 # <<<<<<<<<<<<<< @@ -49908,7 +49944,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1468 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1467 * 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: # <<<<<<<<<<<<<< @@ -49924,7 +49960,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1469 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1468 * 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 # <<<<<<<<<<<<<< @@ -49936,7 +49972,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1470 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1469 * 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 # <<<<<<<<<<<<<< @@ -49946,19 +49982,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_v_i = (__pyx_v_i + 2); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1472 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1471 * 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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_als = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1473 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1472 * * als = [] * for x in range(matching.start,matching.end): # <<<<<<<<<<<<<< @@ -49969,18 +50005,18 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py for (__pyx_t_4 = __pyx_v_matching->start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_x = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1474 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1473 * 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_2 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __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 = 1474; __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 = 1473; __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 = 1474; __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 = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -49992,17 +50028,17 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_v_al = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1475 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1474 * 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 = PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1477 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1476 * als.append(al) * # check all source-side alignment constraints * met_constraints = 1 # <<<<<<<<<<<<<< @@ -50011,7 +50047,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1478 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1477 * # check all source-side alignment constraints * met_constraints = 1 * if self.require_aligned_terminal: # <<<<<<<<<<<<<< @@ -50020,7 +50056,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->require_aligned_terminal) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1479 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1478 * met_constraints = 1 * if self.require_aligned_terminal: * num_aligned_chunks = 0 # <<<<<<<<<<<<<< @@ -50029,7 +50065,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_num_aligned_chunks = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1480 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1479 * if self.require_aligned_terminal: * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: # <<<<<<<<<<<<<< @@ -50039,7 +50075,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_num_chunks; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1481 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1480 * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: * for j from 0 <= j < chunklen[i]: # <<<<<<<<<<<<<< @@ -50049,7 +50085,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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":1482 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1481 * 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: # <<<<<<<<<<<<<< @@ -50059,7 +50095,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1483 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1482 * 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 # <<<<<<<<<<<<<< @@ -50068,7 +50104,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1484 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1483 * if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: * num_aligned_chunks = num_aligned_chunks + 1 * break # <<<<<<<<<<<<<< @@ -50083,7 +50119,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_L24_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1485 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1484 * num_aligned_chunks = num_aligned_chunks + 1 * break * if num_aligned_chunks == 0: # <<<<<<<<<<<<<< @@ -50093,7 +50129,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_num_aligned_chunks == 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1486 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1485 * break * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<< @@ -50104,7 +50140,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_124); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1487 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1486 * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -50116,7 +50152,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L26:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1488 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1487 * reason_for_failure = "No aligned terminals" * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: # <<<<<<<<<<<<<< @@ -50131,7 +50167,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1489 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1488 * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<< @@ -50142,7 +50178,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_125); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1490 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1489 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -50157,7 +50193,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L20:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1492 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1491 * met_constraints = 0 * * if met_constraints and self.tight_phrases: # <<<<<<<<<<<<<< @@ -50171,7 +50207,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1494 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1493 * if met_constraints and self.tight_phrases: * # outside edge constraints are checked later * for i from 0 <= i < num_chunks-1: # <<<<<<<<<<<<<< @@ -50181,7 +50217,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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":1495 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1494 * # 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: # <<<<<<<<<<<<<< @@ -50191,7 +50227,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = ((__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); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1496 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1495 * 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" # <<<<<<<<<<<<<< @@ -50202,7 +50238,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_126); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1497 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1496 * 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 # <<<<<<<<<<<<<< @@ -50211,7 +50247,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1498 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1497 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -50223,7 +50259,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L31:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1499 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1498 * met_constraints = 0 * break * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: # <<<<<<<<<<<<<< @@ -50233,7 +50269,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = ((__pyx_v_f_links_low[(((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - 1) - __pyx_v_f_sent_start)]) == -1); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1500 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1499 * break * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: * reason_for_failure = "Gaps are not tight phrases" # <<<<<<<<<<<<<< @@ -50244,7 +50280,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_126); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1501 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1500 * 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 # <<<<<<<<<<<<<< @@ -50253,7 +50289,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1502 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1501 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -50270,7 +50306,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1504 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1503 * break * * f_low = matching.arr[matching.start] - f_sent_start # <<<<<<<<<<<<<< @@ -50279,7 +50315,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1505 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1504 * * 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 # <<<<<<<<<<<<<< @@ -50288,7 +50324,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1506 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1505 * 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: # <<<<<<<<<<<<<< @@ -50297,28 +50333,28 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_met_constraints) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1508 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1507 * 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 = 1508; __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 = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1512 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1511 * 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_3 = ((struct __pyx_vtabstruct_8_cdec_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); + __pyx_t_3 = ((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); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1513 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1512 * self.train_min_gap_size, 0, * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 # <<<<<<<<<<<<<< @@ -50327,7 +50363,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_error = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1514 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1513 * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 * num_gaps = 0 # <<<<<<<<<<<<<< @@ -50336,7 +50372,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_num_gaps = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1516 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1515 * num_gaps = 0 * * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -50346,7 +50382,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1517 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1516 * * if f_back_low < f_low: * f_gap_low[0] = f_back_low # <<<<<<<<<<<<<< @@ -50355,7 +50391,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1518 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1517 * if f_back_low < f_low: * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low # <<<<<<<<<<<<<< @@ -50364,7 +50400,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__pyx_v_f_gap_high[0]) = __pyx_v_f_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1519 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1518 * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low * num_gaps = 1 # <<<<<<<<<<<<<< @@ -50373,7 +50409,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_num_gaps = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1520 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1519 * f_gap_high[0] = f_low * num_gaps = 1 * gap_start = 0 # <<<<<<<<<<<<<< @@ -50382,7 +50418,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_start = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1521 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1520 * num_gaps = 1 * gap_start = 0 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -50391,7 +50427,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1522 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1521 * gap_start = 0 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -50401,7 +50437,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_phrase_len > __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1523 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1522 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -50413,7 +50449,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L36:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1524 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1523 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -50422,7 +50458,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1525 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1524 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: # <<<<<<<<<<<<<< @@ -50438,7 +50474,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1526 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1525 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -50447,7 +50483,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1527 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1526 * 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" # <<<<<<<<<<<<<< @@ -50467,7 +50503,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1529 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1528 * reason_for_failure = "Inside edges of preceding subphrase are not tight" * else: * gap_start = 1 # <<<<<<<<<<<<<< @@ -50476,7 +50512,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_start = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1530 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1529 * else: * gap_start = 1 * if self.tight_phrases and f_links_low[f_low] == -1: # <<<<<<<<<<<<<< @@ -50491,7 +50527,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1533 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1532 * # 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 # <<<<<<<<<<<<<< @@ -50505,7 +50541,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L35:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1535 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1534 * met_constraints = 0 * * for i from 0 <= i < matching.size - 1: # <<<<<<<<<<<<<< @@ -50515,7 +50551,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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":1536 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1535 * * for i from 0 <= i < matching.size - 1: * f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start # <<<<<<<<<<<<<< @@ -50524,7 +50560,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__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":1537 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1536 * 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 # <<<<<<<<<<<<<< @@ -50533,7 +50569,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__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":1538 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1537 * 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 # <<<<<<<<<<<<<< @@ -50543,7 +50579,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1540 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1539 * num_gaps = num_gaps + 1 * * if f_high < f_back_high: # <<<<<<<<<<<<<< @@ -50553,7 +50589,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_f_high < __pyx_v_f_back_high); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1541 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1540 * * if f_high < f_back_high: * f_gap_low[gap_start+num_gaps] = f_high # <<<<<<<<<<<<<< @@ -50562,7 +50598,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__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":1542 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1541 * 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 # <<<<<<<<<<<<<< @@ -50571,7 +50607,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ (__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":1543 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1542 * f_gap_low[gap_start+num_gaps] = f_high * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< @@ -50580,7 +50616,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1544 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1543 * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -50589,7 +50625,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1545 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1544 * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -50599,7 +50635,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_phrase_len > __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1546 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1545 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -50611,7 +50647,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L43:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1547 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1546 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -50620,7 +50656,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1548 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1547 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: # <<<<<<<<<<<<<< @@ -50636,7 +50672,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1549 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1548 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -50645,7 +50681,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1550 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1549 * 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" # <<<<<<<<<<<<<< @@ -50665,7 +50701,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1552 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1551 * reason_for_failure = "Inside edges of following subphrase are not tight" * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: # <<<<<<<<<<<<<< @@ -50680,7 +50716,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1553 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1552 * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -50694,7 +50730,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L42:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1555 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1554 * met_constraints = 0 * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -50704,7 +50740,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_gap_error == 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1556 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1555 * * if gap_error == 0: * e_word_count = e_high - e_low # <<<<<<<<<<<<<< @@ -50713,7 +50749,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1557 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1556 * if gap_error == 0: * e_word_count = e_high - e_low * for i from 0 <= i < num_gaps: # check integrity of subphrases # <<<<<<<<<<<<<< @@ -50723,28 +50759,28 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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":1558 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1557 * 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 = 1558; __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 = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1563 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1562 * 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_7 = (((struct __pyx_vtabstruct_8_cdec_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); + __pyx_t_7 = (((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); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1565 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1564 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0) == 0: * gap_error = 1 # <<<<<<<<<<<<<< @@ -50753,18 +50789,18 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1566 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1565 * 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 = 1566; __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 = 1565; __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 = 1566; __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 = 1565; __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 = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); @@ -50772,14 +50808,14 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_GIVEREF(__pyx_t_1); __pyx_t_10 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_129), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_129), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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":1567 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1566 * 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 # <<<<<<<<<<<<<< @@ -50796,7 +50832,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L47:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1569 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1568 * break * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -50806,7 +50842,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_gap_error == 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1570 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1569 * * if gap_error == 0: * i = 1 # <<<<<<<<<<<<<< @@ -50815,21 +50851,21 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1571 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1570 * 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 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1570; __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 = 1571; __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[8]; __pyx_lineno = 1570; __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":1572 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1571 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -50839,16 +50875,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1573 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1572 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1574 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1573 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -50857,16 +50893,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1575 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1574 * 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_2 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1574; __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; @@ -50874,27 +50910,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L52:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1576 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1575 * 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 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1575; __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 = 1576; __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 = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1575; __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_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1577 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1576 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -50904,40 +50940,26 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1578 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1577 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_isvar); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyInt_FromLong((__pyx_v_phrase->syms[__pyx_v_j])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1578; __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 = 1578; __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_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__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 = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_7) { + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1579 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1578 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1580 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1579 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -50949,19 +50971,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1582 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1581 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((struct __pyx_vtabstruct_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":1583 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1582 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -50971,51 +50993,51 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_f_back_high > __pyx_v_f_high); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1584 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1583 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1585 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1584 * 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_2 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1585; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L56; } __pyx_L56:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1587 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1586 * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1587; __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 = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr_arr)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_fphr = ((struct __pyx_obj_8_cdec_sa_Phrase *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_10); + __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1588 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1587 * * fphr = Phrase(fphr_arr) * if met_constraints: # <<<<<<<<<<<<<< @@ -51024,47 +51046,47 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_met_constraints) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1591 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1590 * 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_2 = ((struct __pyx_vtabstruct_8_cdec_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_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_phrase_list = __pyx_t_2; - __pyx_t_2 = 0; + __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 = 1588; __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":1592 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1591 * 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 = 1592; __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 = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = (__pyx_t_13 > 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1593 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1592 * 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 = 1593; __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 = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1592; __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":1595 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1594 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -51073,36 +51095,36 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_pair_count = 0.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1596 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1595 * 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_2 = PyInt_FromLong(__pyx_v_f_back_low); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __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 = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __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 = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong(__pyx_v_e_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __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 = 1595; __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 = 1596; __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 = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_10 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_10 = 0; __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_130), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_130), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1595; __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); @@ -51111,7 +51133,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L58:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1597 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1596 * 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: # <<<<<<<<<<<<<< @@ -51122,23 +51144,31 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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 = 1597; __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 = 1596; __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++; + #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 = 1596; __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++; + #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 = 1596; __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 = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -51146,54 +51176,61 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } 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 = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = PyList_GET_ITEM(sequence, 0); - __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_2)->tp_iternext; - index = 0; __pyx_t_10 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_10)) goto __pyx_L61_unpacking_failed; + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - index = 1; __pyx_t_1 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L61_unpacking_failed; + __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); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L61_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1596; __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_2); __pyx_t_2 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L62_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_1; + __pyx_v_phrase2 = __pyx_t_1; __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1598 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1597 * 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) # <<<<<<<<<<<<<< @@ -51202,31 +51239,31 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_t_15 = ((PyObject *)__pyx_v_self->findexes); __Pyx_INCREF(__pyx_t_15); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_15, __pyx_v_eindexes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_15, __pyx_v_eindexes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_v_als1); - __pyx_v_als1 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_als1 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1599 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1598 * 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_1 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1599; __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 = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_als1); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_als1); __Pyx_GIVEREF(__pyx_v_als1); - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1598; __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 = 1599; __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 = 1598; __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)); @@ -51234,23 +51271,23 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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_1); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1598; __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L57; } __pyx_L57:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1601 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1600 * extracts.append((fphr, phrase2, pair_count, tuple(als1))) * * if (num_gaps < self.max_nonterminals and # <<<<<<<<<<<<<< @@ -51260,7 +51297,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_num_gaps < __pyx_v_self->max_nonterminals); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1602 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1601 * * if (num_gaps < self.max_nonterminals and * phrase_len < self.max_length and # <<<<<<<<<<<<<< @@ -51270,7 +51307,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_phrase_len < __pyx_v_self->max_length); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1603 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1602 * 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): # <<<<<<<<<<<<<< @@ -51288,7 +51325,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1604 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1603 * 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 # <<<<<<<<<<<<<< @@ -51298,7 +51335,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_f_back_low == __pyx_v_f_low); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1605 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1604 * 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 # <<<<<<<<<<<<<< @@ -51308,7 +51345,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = (__pyx_v_f_low >= __pyx_v_self->train_min_gap_size); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1606 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1605 * 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))): # <<<<<<<<<<<<<< @@ -51338,7 +51375,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1607 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1606 * 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 # <<<<<<<<<<<<<< @@ -51347,7 +51384,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1608 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1607 * ((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 # <<<<<<<<<<<<<< @@ -51356,7 +51393,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1609 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1608 * f_x_low = f_low-self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -51365,7 +51402,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1610 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1609 * met_constraints = 1 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<< @@ -51382,7 +51419,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1611 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1610 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -51395,7 +51432,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L65:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1612 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1611 * 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: # <<<<<<<<<<<<<< @@ -51411,7 +51448,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1613 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1612 * 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 # <<<<<<<<<<<<<< @@ -51423,7 +51460,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L68:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1615 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1614 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -51432,27 +51469,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_met_constraints) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1616 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1615 * * 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 = 1616; __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 = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1620 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1619 * 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) and * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and */ - if (((struct __pyx_vtabstruct_8_cdec_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)) { + if (((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)) { __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1622 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1621 * self.train_max_initial_size, self.train_max_initial_size, * 1, 1, 1, 1, 0, 1, 0) and * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and # <<<<<<<<<<<<<< @@ -51468,31 +51505,31 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1623 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1622 * 1, 1, 1, 1, 0, 1, 0) 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_10 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1627 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1626 * -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_9 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_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_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); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = ((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); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { __pyx_t_9 = __pyx_t_7; } __pyx_t_7 = __pyx_t_9; } else { - __pyx_t_7 = ((struct __pyx_vtabstruct_8_cdec_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); + __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); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } __pyx_t_9 = __pyx_t_7; @@ -51501,16 +51538,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1629 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1628 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1630 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1629 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -51519,44 +51556,44 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1631 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1630 * 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 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1630; __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1632 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1631 * 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_10 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1631; __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 = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __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":1633 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1632 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1634 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1633 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -51565,27 +51602,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1635 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1634 * 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 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((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_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1635; __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 = 1634; __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_10)); __pyx_t_10 = 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":1636 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1635 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -51595,40 +51632,26 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1637 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1636 * 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_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_isvar); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyInt_FromLong((__pyx_v_phrase->syms[__pyx_v_j])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_9) { + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1638 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1637 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1639 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1638 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -51640,19 +51663,19 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1641 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1640 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((struct __pyx_vtabstruct_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":1642 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1641 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -51662,93 +51685,93 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_f_back_high > __pyx_v_f_high); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1643 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1642 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1644 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1643 * 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_10 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __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 = 1643; __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 = 1643; __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:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1645 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1644 * 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_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1645; __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 = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); - PyTuple_SET_ITEM(__pyx_t_14, 0, ((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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __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 = 1644; __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_8_cdec_sa_Phrase *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_15); + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1648 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1647 * 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_10 = ((struct __pyx_vtabstruct_8_cdec_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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_XDECREF(__pyx_v_phrase_list); - __pyx_v_phrase_list = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_v_phrase_list = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1649 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1648 * 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 = 1649; __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 = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = (__pyx_t_13 > 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1650 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1649 * 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 = 1650; __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 = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1649; __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":1652 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1651 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -51759,7 +51782,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L74:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1653 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1652 * else: * pair_count = 0 * for phrase2,eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -51767,133 +51790,148 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py * extracts.append((fphr, phrase2, pair_count, tuple(als2))) */ if (PyList_CheckExact(__pyx_v_phrase_list) || PyTuple_CheckExact(__pyx_v_phrase_list)) { - __pyx_t_10 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0; + __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_10 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = Py_TYPE(__pyx_t_10)->tp_iternext; + __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 = 1652; __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_10)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_10)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; + 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++; + #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 = 1652; __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++; + #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 = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_14 = __pyx_t_16(__pyx_t_10); - if (unlikely(!__pyx_t_14)) { + __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 = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_14); + __Pyx_GOTREF(__pyx_t_1); } - if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) { - PyObject* sequence = __pyx_t_14; + 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 = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = PyList_GET_ITEM(sequence, 0); - __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + __pyx_t_14 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else { + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __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 = 1652; __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_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L77_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_2)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_15)) goto __pyx_L77_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_1 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L77_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1652; __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_2); __pyx_t_2 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L78_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_15; - __pyx_t_15 = 0; + __pyx_v_phrase2 = __pyx_t_14; + __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_eindexes = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1654 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1653 * 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_14 = ((PyObject *)__pyx_v_self->findexes); - __Pyx_INCREF(__pyx_t_14); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_14, __pyx_v_eindexes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_1 = ((PyObject *)__pyx_v_self->findexes); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_1, __pyx_v_eindexes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_als2); - __pyx_v_als2 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_als2 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1655 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1654 * 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_1 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1654; __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 = 1654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_v_als2); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_als2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_als2); __Pyx_GIVEREF(__pyx_v_als2); - __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 = 1655; __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 = 1655; __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 = 1654; __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 = 1654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); - PyTuple_SET_ITEM(__pyx_t_14, 0, ((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_14, 1, __pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_phrase2); __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_1 = 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 = 1655; __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; + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_2 = 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 = 1654; __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; goto __pyx_L69; } __pyx_L69:; @@ -51901,7 +51939,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L64:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1657 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1656 * extracts.append((fphr, phrase2, pair_count, tuple(als2))) * * if (f_back_high == f_high and # <<<<<<<<<<<<<< @@ -51911,7 +51949,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_f_back_high == __pyx_v_f_high); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1658 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1657 * * if (f_back_high == f_high and * f_sent_len - f_high >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -51921,7 +51959,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = ((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1659 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1658 * 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))): # <<<<<<<<<<<<<< @@ -51951,7 +51989,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1660 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1659 * 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 # <<<<<<<<<<<<<< @@ -51960,7 +51998,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1661 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1660 * ((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 # <<<<<<<<<<<<<< @@ -51969,7 +52007,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1662 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1661 * f_x_high = f_high+self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -51978,7 +52016,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1663 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1662 * met_constraints = 1 * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<< @@ -51995,7 +52033,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1664 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1663 * 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 # <<<<<<<<<<<<<< @@ -52008,7 +52046,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L80:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1665 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1664 * 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: # <<<<<<<<<<<<<< @@ -52024,7 +52062,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1666 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1665 * 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 # <<<<<<<<<<<<<< @@ -52036,7 +52074,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L83:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1668 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1667 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -52045,27 +52083,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_met_constraints) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1669 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1668 * * 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_10 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1673 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1672 * 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_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_10, __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)) { - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + 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)) { + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1675 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1674 * 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 # <<<<<<<<<<<<<< @@ -52081,32 +52119,32 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1676 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1675 * 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_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1681 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1680 * 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_9 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_15, __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); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_9 = ((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); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else { __pyx_t_9 = __pyx_t_7; } __pyx_t_7 = __pyx_t_9; } else { - __pyx_t_7 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_10, __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); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = ((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); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } __pyx_t_9 = __pyx_t_7; } else { @@ -52114,16 +52152,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1683 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1682 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1684 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1683 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -52132,21 +52170,21 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1685 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1684 * fphr_arr._clear() * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) */ - __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_15 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __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 = 1684; __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":1686 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1685 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -52156,16 +52194,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1687 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1686 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1688 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1687 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -52174,44 +52212,44 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1689 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1688 * 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_15 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1688; __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 = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L85; } __pyx_L85:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1690 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1689 * 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_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); 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_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((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_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __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 = 1689; __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":1691 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1690 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -52221,40 +52259,26 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1692 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1691 * 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_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_isvar); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = PyInt_FromLong((__pyx_v_phrase->syms[__pyx_v_j])); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __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_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_9) { + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1693 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1692 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1694 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1693 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -52266,102 +52290,102 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1696 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1695 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((struct __pyx_vtabstruct_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":1697 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1696 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1698 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1697 * fphr_arr._append(phrase.syms[j]) * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * fphr = Phrase(fphr_arr) * phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low+gap_start, e_gap_high+gap_start, e_links_low, num_gaps+1, */ - __pyx_t_15 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __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 = 1697; __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 = 1697; __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":1699 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1698 * 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_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_fphr_arr)); + PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __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 = 1698; __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_8_cdec_sa_Phrase *)__pyx_t_15); - __pyx_t_15 = 0; + __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1702 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1701 * 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_15 = ((struct __pyx_vtabstruct_8_cdec_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_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); + __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 = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_phrase_list); - __pyx_v_phrase_list = __pyx_t_15; - __pyx_t_15 = 0; + __pyx_v_phrase_list = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1703 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1702 * 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 = 1703; __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 = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = (__pyx_t_13 > 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1704 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1703 * 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 = 1704; __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 = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1703; __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":1706 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1705 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -52372,7 +52396,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L89:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1707 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1706 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -52380,133 +52404,148 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py * extracts.append((fphr, phrase2, pair_count, tuple(als3))) */ 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_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_15 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; + __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 = 1706; __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_15)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_15)) break; - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_15)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_15)) break; - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; + 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++; + #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 = 1706; __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++; + #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 = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #endif } else { - __pyx_t_10 = __pyx_t_16(__pyx_t_15); - if (unlikely(!__pyx_t_10)) { + __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 = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_14); } - if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { - PyObject* sequence = __pyx_t_10; + 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 = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = PyList_GET_ITEM(sequence, 0); - __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + __pyx_t_15 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else { + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __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 = 1706; __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_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L92_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_2)->tp_iternext; - index = 0; __pyx_t_14 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_14)) goto __pyx_L92_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - index = 1; __pyx_t_1 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L92_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L93_unpacking_done; __pyx_L92_unpacking_failed:; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L93_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_14; - __pyx_t_14 = 0; + __pyx_v_phrase2 = __pyx_t_15; + __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_eindexes = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1708 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1707 * 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_10 = ((PyObject *)__pyx_v_self->findexes); - __Pyx_INCREF(__pyx_t_10); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_10, __pyx_v_eindexes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_14 = ((PyObject *)__pyx_v_self->findexes); + __Pyx_INCREF(__pyx_t_14); + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_14, __pyx_v_eindexes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_v_als3); - __pyx_v_als3 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_als3 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1709 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1708 * 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_1 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1709; __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 = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_v_als3); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_als3); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_als3); __Pyx_GIVEREF(__pyx_v_als3); - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1709; __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 = 1708; __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 = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_fphr)); + PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); __Pyx_INCREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_phrase2); __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_1 = 0; - __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_2 = 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 = 1708; __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_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L84; } __pyx_L84:; @@ -52514,7 +52553,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L79:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1710 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1709 * 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 # <<<<<<<<<<<<<< @@ -52524,7 +52563,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_9 = (__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1711 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1710 * extracts.append((fphr, phrase2, pair_count, tuple(als3))) * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and # <<<<<<<<<<<<<< @@ -52534,7 +52573,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_7 = ((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1712 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1711 * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and * f_back_high == f_high and # <<<<<<<<<<<<<< @@ -52544,7 +52583,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_18 = (__pyx_v_f_back_high == __pyx_v_f_high); if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1713 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1712 * phrase_len+1 < self.max_length and * f_back_high == f_high and * f_back_low == f_low and # <<<<<<<<<<<<<< @@ -52554,7 +52593,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_8 = (__pyx_v_f_back_low == __pyx_v_f_low); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1714 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1713 * 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 # <<<<<<<<<<<<<< @@ -52564,7 +52603,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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); if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1715 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1714 * 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 # <<<<<<<<<<<<<< @@ -52574,7 +52613,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_20 = (__pyx_v_f_low >= __pyx_v_self->train_min_gap_size); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1716 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1715 * 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 # <<<<<<<<<<<<<< @@ -52584,7 +52623,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_21 = (__pyx_v_f_high <= (__pyx_v_f_sent_len - __pyx_v_self->train_min_gap_size)); if (__pyx_t_21) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1717 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1716 * 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))): # <<<<<<<<<<<<<< @@ -52634,7 +52673,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1719 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1718 * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): * * met_constraints = 1 # <<<<<<<<<<<<<< @@ -52643,7 +52682,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1720 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1719 * * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<< @@ -52652,7 +52691,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1721 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1720 * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -52661,7 +52700,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1722 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1721 * 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: # <<<<<<<<<<<<<< @@ -52678,7 +52717,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1723 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1722 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -52691,7 +52730,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L95:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1724 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1723 * 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: # <<<<<<<<<<<<<< @@ -52701,7 +52740,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_18 = (__pyx_v_f_x_low < 0); if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1725 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1724 * f_x_low = f_x_low - 1 * if f_x_low < 0: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -52713,7 +52752,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L98:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1727 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1726 * met_constraints = 0 * * f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<< @@ -52722,7 +52761,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __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":1728 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1727 * * f_x_high = f_high+self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -52731,7 +52770,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_self->tight_phrases) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1729 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1728 * 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: # <<<<<<<<<<<<<< @@ -52748,7 +52787,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (!__pyx_t_9) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1730 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1729 * 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 # <<<<<<<<<<<<<< @@ -52761,7 +52800,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L99:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1731 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1730 * 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: # <<<<<<<<<<<<<< @@ -52777,7 +52816,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1732 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1731 * 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 # <<<<<<<<<<<<<< @@ -52789,7 +52828,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L102:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1734 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1733 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -52798,27 +52837,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ if (__pyx_v_met_constraints) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1735 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1734 * * 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_15 = PyInt_FromLong(__pyx_v_f_x_high); 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_t_1 = PyInt_FromLong(__pyx_v_f_x_high); 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1739 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1738 * 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) and * ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and */ - if (((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_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, 2, 1, 1, 1, 1)) { - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (((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)) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1741 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1740 * self.train_max_initial_size, self.train_max_initial_size, * 1, 1, 2, 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 # <<<<<<<<<<<<<< @@ -52840,46 +52879,46 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1742 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1741 * 1, 1, 2, 1, 1, 1, 1) and * ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and * self.find_fixpoint(f_x_low, f_low, # <<<<<<<<<<<<<< * f_links_low, f_links_high, e_links_low, e_links_high, * -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high, */ - __pyx_t_14 = PyInt_FromLong(__pyx_v_f_low); 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_15 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1746 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1745 * -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_3 = ((struct __pyx_vtabstruct_8_cdec_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); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_15, __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); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1748 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1747 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0) and * self.find_fixpoint(f_high, f_x_high, # <<<<<<<<<<<<<< * f_links_low, f_links_high, e_links_low, e_links_high, * -1, -1, e_gap_low+1+num_gaps, e_gap_high+1+num_gaps, */ - __pyx_t_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1753 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1752 * 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_4 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_e_gap_high + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_high + 1) + __pyx_v_num_gaps), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_15, __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); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_7 = __pyx_t_4; } else { __pyx_t_7 = __pyx_t_3; @@ -52890,8 +52929,8 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_9 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_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, 2, 1, 1, 1, 1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_9 = ((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); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_t_8 = __pyx_t_9; } else { @@ -52899,16 +52938,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1755 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1754 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1756 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1755 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -52917,44 +52956,44 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1757 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1756 * 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_15 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1756; __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 = 1756; __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 = 1757; __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_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1758 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1757 * 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_14 = PyInt_FromLong(__pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __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 = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __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 = 1757; __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":1759 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1758 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1760 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1759 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -52963,27 +53002,27 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1761 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1760 * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 * self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<< * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): */ - __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1760; __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 = 1760; __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 = 1761; __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)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_10 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __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 = 1760; __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":1762 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1761 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -52993,40 +53032,26 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1763 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1762 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_isvar); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyInt_FromLong((__pyx_v_phrase->syms[__pyx_v_j])); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_8) { + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1764 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1763 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1765 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1764 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -53038,102 +53063,102 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1767 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1766 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((struct __pyx_vtabstruct_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":1768 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1767 * 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_8_cdec_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1769 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1768 * 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_8_cdec_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1768; __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 = 1769; __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 = 1768; __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":1770 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1769 * 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 = 1770; __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 = 1769; __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_8_cdec_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1769; __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_8_cdec_sa_Phrase *)__pyx_t_14); + __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1773 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1772 * 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_8_cdec_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 = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1770; __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":1774 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1773 * 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 = 1774; __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 = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = (__pyx_t_13 > 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1775 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1774 * 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 = 1775; __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 = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __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":1777 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1776 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -53144,7 +53169,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L107:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1778 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1777 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -53155,23 +53180,31 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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 = 1778; __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 = 1777; __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++; + #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 = 1777; __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++; + #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 = 1777; __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 = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -53179,54 +53212,61 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } 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 = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = PyList_GET_ITEM(sequence, 0); - __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_2)->tp_iternext; - index = 0; __pyx_t_10 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_10)) goto __pyx_L110_unpacking_failed; + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - index = 1; __pyx_t_1 = __pyx_t_17(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L110_unpacking_failed; + __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); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L110_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __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_2); __pyx_t_2 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L111_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_1; + __pyx_v_phrase2 = __pyx_t_1; __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1779 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1778 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -53235,31 +53275,31 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ __pyx_t_15 = ((PyObject *)__pyx_v_self->findexes); __Pyx_INCREF(__pyx_t_15); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_15, __pyx_v_eindexes); 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_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, __pyx_t_15, __pyx_v_eindexes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_v_als4); - __pyx_v_als4 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_als4 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1780 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1779 * 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_1 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1780; __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 = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(1); 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_INCREF(__pyx_v_als4); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_als4); __Pyx_GIVEREF(__pyx_v_als4); - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1779; __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 = 1780; __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 = 1779; __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)); @@ -53267,16 +53307,16 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __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_1); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 1779; __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L103; @@ -53295,7 +53335,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1782 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1781 * extracts.append((fphr, phrase2, pair_count, tuple(als4))) * else: * reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<< @@ -53311,7 +53351,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py } __pyx_L33:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1784 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1783 * reason_for_failure = "Unable to extract basic phrase" * * free(sent_links) # <<<<<<<<<<<<<< @@ -53320,7 +53360,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_sent_links); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1785 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1784 * * free(sent_links) * free(f_links_low) # <<<<<<<<<<<<<< @@ -53329,7 +53369,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_f_links_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1786 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1785 * free(sent_links) * free(f_links_low) * free(f_links_high) # <<<<<<<<<<<<<< @@ -53338,7 +53378,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_f_links_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1787 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1786 * free(f_links_low) * free(f_links_high) * free(e_links_low) # <<<<<<<<<<<<<< @@ -53347,7 +53387,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_e_links_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1788 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1787 * free(f_links_high) * free(e_links_low) * free(e_links_high) # <<<<<<<<<<<<<< @@ -53356,7 +53396,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_e_links_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1789 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1788 * free(e_links_low) * free(e_links_high) * free(f_gap_low) # <<<<<<<<<<<<<< @@ -53365,7 +53405,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_f_gap_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1790 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1789 * free(e_links_high) * free(f_gap_low) * free(f_gap_high) # <<<<<<<<<<<<<< @@ -53374,7 +53414,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_f_gap_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1791 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1790 * free(f_gap_low) * free(f_gap_high) * free(e_gap_low) # <<<<<<<<<<<<<< @@ -53383,7 +53423,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_e_gap_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1792 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1791 * free(f_gap_high) * free(e_gap_low) * free(e_gap_high) # <<<<<<<<<<<<<< @@ -53392,7 +53432,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py */ free(__pyx_v_e_gap_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1794 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1793 * free(e_gap_high) * * return extracts # <<<<<<<<<<<<<< @@ -53410,7 +53450,7 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("_cdec_sa.HieroCachingRuleFactory.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_extracts); @@ -53431,33 +53471,33 @@ static PyObject *__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract(struct __py __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_8_cdec_sa_FloatList __pyx_vtable_8_cdec_sa_FloatList; +static struct __pyx_vtabstruct_3_sa_Phrase __pyx_vtable_3_sa_Phrase; -static PyObject *__pyx_tp_new_8_cdec_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_FloatList *p; +static PyObject *__pyx_tp_new_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_Phrase *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_FloatList *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_FloatList; - if (__pyx_pw_8_cdec_sa_9FloatList_1__cinit__(o, a, k) < 0) { + p = ((struct __pyx_obj_3_sa_Phrase *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_Phrase; + if (__pyx_pw_3_sa_6Phrase_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_FloatList(PyObject *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_8_cdec_sa_9FloatList_3__dealloc__(o); + __pyx_pw_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_8_cdec_sa_FloatList(PyObject *o, Py_ssize_t i) { +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); @@ -53465,25 +53505,28 @@ static PyObject *__pyx_sq_item_8_cdec_sa_FloatList(PyObject *o, Py_ssize_t i) { return r; } -static int __pyx_mp_ass_subscript_8_cdec_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_8_cdec_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 PyObject *__pyx_getprop_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_6Phrase_5words_1__get__(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_FloatList[] = { - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_8_cdec_sa_9FloatList_11append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_8_cdec_sa_9FloatList_13write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_8_cdec_sa_9FloatList_15read, METH_O, __Pyx_DOCSTR(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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_FloatList = { +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 PyNumberMethods __pyx_tp_as_number_Phrase = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -53541,11 +53584,11 @@ static PyNumberMethods __pyx_tp_as_number_FloatList = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_FloatList = { - __pyx_pw_8_cdec_sa_9FloatList_9__len__, /*sq_length*/ +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_8_cdec_sa_FloatList, /*sq_item*/ + __pyx_sq_item_3_sa_Phrase, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -53554,13 +53597,13 @@ static PySequenceMethods __pyx_tp_as_sequence_FloatList = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_FloatList = { - __pyx_pw_8_cdec_sa_9FloatList_9__len__, /*mp_length*/ - __pyx_pw_8_cdec_sa_9FloatList_5__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_8_cdec_sa_FloatList, /*mp_ass_subscript*/ +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 PyBufferProcs __pyx_tp_as_buffer_FloatList = { +static PyBufferProcs __pyx_tp_as_buffer_Phrase = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -53581,41 +53624,41 @@ static PyBufferProcs __pyx_tp_as_buffer_FloatList = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_FloatList = { +static PyTypeObject __pyx_type_3_sa_Phrase = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.FloatList"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_FloatList), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Phrase"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Phrase), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_FloatList, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Phrase, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + __pyx_pw_3_sa_6Phrase_21__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_FloatList, /*tp_as_number*/ - &__pyx_tp_as_sequence_FloatList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_FloatList, /*tp_as_mapping*/ - 0, /*tp_hash*/ + &__pyx_tp_as_number_Phrase, /*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_call*/ - 0, /*tp_str*/ + __pyx_pw_3_sa_6Phrase_5__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_FloatList, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_Phrase, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_3_sa_6Phrase_29__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_FloatList, /*tp_methods*/ + __pyx_methods_3_sa_Phrase, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_3_sa_Phrase, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -53623,7 +53666,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_FloatList = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_FloatList, /*tp_new*/ + __pyx_tp_new_3_sa_Phrase, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -53636,66 +53679,133 @@ static PyTypeObject __pyx_type_8_cdec_sa_FloatList = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_IntList __pyx_vtable_8_cdec_sa_IntList; -static PyObject *__pyx_tp_new_8_cdec_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_IntList *p; +static PyObject *__pyx_tp_new_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_Rule *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_IntList *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_IntList; - if (__pyx_pw_8_cdec_sa_7IntList_1__cinit__(o, a, k) < 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->word_alignments = Py_None; Py_INCREF(Py_None); + if (__pyx_pw_3_sa_4Rule_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_IntList(PyObject *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 *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_8_cdec_sa_7IntList_15__dealloc__(o); + __pyx_pw_3_sa_4Rule_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } + Py_XDECREF(((PyObject *)p->f)); + Py_XDECREF(((PyObject *)p->e)); + Py_XDECREF(p->word_alignments); (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_sq_item_8_cdec_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_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->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->word_alignments); + p->word_alignments = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; } -static int __pyx_mp_ass_subscript_8_cdec_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { +static PyObject *__pyx_getprop_3_sa_4Rule_scores(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_4Rule_6scores_1__get__(o); +} + +static int __pyx_setprop_3_sa_4Rule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_7IntList_19__setitem__(o, i, v); + return __pyx_pw_3_sa_4Rule_6scores_3__set__(o, v); } else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } -static PyMethodDef __pyx_methods_8_cdec_sa_IntList[] = { - {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_5index, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("partition"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_7partition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_doquicksort"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_9_doquicksort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sort"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_11sort, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_13reset, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getSize"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_23getSize, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_25append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_27extend, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_29write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_8_cdec_sa_7IntList_31read, METH_O, __Pyx_DOCSTR(0)}, +static PyObject *__pyx_getprop_3_sa_4Rule_lhs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_4Rule_3lhs_1__get__(o); +} + +static int __pyx_setprop_3_sa_4Rule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_3_sa_4Rule_3lhs_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +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 PyObject *__pyx_getprop_3_sa_4Rule_word_alignments(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_4Rule_15word_alignments_1__get__(o); +} + +static int __pyx_setprop_3_sa_4Rule_word_alignments(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_3_sa_4Rule_15word_alignments_3__set__(o, v); + } + else { + return __pyx_pw_3_sa_4Rule_15word_alignments_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_3_sa_Rule[] = { + {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pw_3_sa_4Rule_11fmerge, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_3_sa_4Rule_13arity, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_IntList = { +static struct PyGetSetDef __pyx_getsets_3_sa_Rule[] = { + {(char *)"scores", __pyx_getprop_3_sa_4Rule_scores, __pyx_setprop_3_sa_4Rule_scores, 0, 0}, + {(char *)"lhs", __pyx_getprop_3_sa_4Rule_lhs, __pyx_setprop_3_sa_4Rule_lhs, 0, 0}, + {(char *)"f", __pyx_getprop_3_sa_4Rule_f, 0, 0, 0}, + {(char *)"e", __pyx_getprop_3_sa_4Rule_e, 0, 0, 0}, + {(char *)"word_alignments", __pyx_getprop_3_sa_4Rule_word_alignments, __pyx_setprop_3_sa_4Rule_word_alignments, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Rule = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -53731,7 +53841,7 @@ static PyNumberMethods __pyx_tp_as_number_IntList = { #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif - 0, /*nb_inplace_add*/ + __pyx_pw_3_sa_4Rule_9__iadd__, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 @@ -53753,11 +53863,11 @@ static PyNumberMethods __pyx_tp_as_number_IntList = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_IntList = { - __pyx_pw_8_cdec_sa_7IntList_21__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_Rule = { + 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - __pyx_sq_item_8_cdec_sa_IntList, /*sq_item*/ + 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -53766,13 +53876,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IntList = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_IntList = { - __pyx_pw_8_cdec_sa_7IntList_21__len__, /*mp_length*/ - __pyx_pw_8_cdec_sa_7IntList_17__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_8_cdec_sa_IntList, /*mp_ass_subscript*/ +static PyMappingMethods __pyx_tp_as_mapping_Rule = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_IntList = { +static PyBufferProcs __pyx_tp_as_buffer_Rule = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -53793,41 +53903,41 @@ static PyBufferProcs __pyx_tp_as_buffer_IntList = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_IntList = { +static PyTypeObject __pyx_type_3_sa_Rule = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.IntList"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_IntList), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Rule"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Rule), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_IntList, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Rule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + __pyx_pw_3_sa_4Rule_7__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_IntList, /*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_number_Rule, /*tp_as_number*/ + &__pyx_tp_as_sequence_Rule, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Rule, /*tp_as_mapping*/ + __pyx_pw_3_sa_4Rule_5__hash__, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_8_cdec_sa_7IntList_3__str__, /*tp_str*/ + __pyx_pw_3_sa_4Rule_15__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_IntList, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + &__pyx_tp_as_buffer_Rule, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_3_sa_Rule, /*tp_traverse*/ + __pyx_tp_clear_3_sa_Rule, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_IntList, /*tp_methods*/ + __pyx_methods_3_sa_Rule, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_3_sa_Rule, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -53835,7 +53945,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_IntList = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_IntList, /*tp_new*/ + __pyx_tp_new_3_sa_Rule, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -53848,38 +53958,59 @@ static PyTypeObject __pyx_type_8_cdec_sa_IntList = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_StringMap __pyx_vtable_8_cdec_sa_StringMap; +static struct __pyx_vtabstruct_3_sa_FloatList __pyx_vtable_3_sa_FloatList; -static PyObject *__pyx_tp_new_8_cdec_sa_StringMap(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_StringMap *p; +static PyObject *__pyx_tp_new_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_FloatList *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_StringMap *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_StringMap; - if (__pyx_pw_8_cdec_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { + p = ((struct __pyx_obj_3_sa_FloatList *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_FloatList; + if (__pyx_pw_3_sa_9FloatList_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_StringMap(PyObject *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_8_cdec_sa_9StringMap_3__dealloc__(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_8_cdec_sa_StringMap[] = { +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 PyNumberMethods __pyx_tp_as_number_StringMap = { +static PyNumberMethods __pyx_tp_as_number_FloatList = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -53937,11 +54068,11 @@ static PyNumberMethods __pyx_tp_as_number_StringMap = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_StringMap = { - 0, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_FloatList = { + __pyx_pw_3_sa_9FloatList_9__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - 0, /*sq_item*/ + __pyx_sq_item_3_sa_FloatList, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -53950,13 +54081,13 @@ static PySequenceMethods __pyx_tp_as_sequence_StringMap = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_StringMap = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ +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 PyBufferProcs __pyx_tp_as_buffer_StringMap = { +static PyBufferProcs __pyx_tp_as_buffer_FloatList = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -53977,12 +54108,12 @@ static PyBufferProcs __pyx_tp_as_buffer_StringMap = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_StringMap = { +static PyTypeObject __pyx_type_3_sa_FloatList = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.StringMap"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_StringMap), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.FloatList"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_FloatList), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_StringMap, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_FloatList, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -53992,15 +54123,15 @@ static PyTypeObject __pyx_type_8_cdec_sa_StringMap = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_StringMap, /*tp_as_number*/ - &__pyx_tp_as_sequence_StringMap, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_StringMap, /*tp_as_mapping*/ + &__pyx_tp_as_number_FloatList, /*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*/ - &__pyx_tp_as_buffer_StringMap, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_FloatList, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ @@ -54009,7 +54140,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_StringMap = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_StringMap, /*tp_methods*/ + __pyx_methods_3_sa_FloatList, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -54019,7 +54150,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_StringMap = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_StringMap, /*tp_new*/ + __pyx_tp_new_3_sa_FloatList, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -54032,93 +54163,66 @@ static PyTypeObject __pyx_type_8_cdec_sa_StringMap = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_DataArray __pyx_vtable_8_cdec_sa_DataArray; +static struct __pyx_vtabstruct_3_sa_IntList __pyx_vtable_3_sa_IntList; -static PyObject *__pyx_tp_new_8_cdec_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_DataArray *p; +static PyObject *__pyx_tp_new_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_IntList *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_DataArray *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_DataArray; - p->word2id = Py_None; Py_INCREF(Py_None); - p->id2word = Py_None; Py_INCREF(Py_None); - p->data = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_id = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_9DataArray_1__cinit__(o, a, k) < 0) { + p = ((struct __pyx_obj_3_sa_IntList *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_IntList; + if (__pyx_pw_3_sa_7IntList_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_DataArray(PyObject *o) { - struct __pyx_obj_8_cdec_sa_DataArray *p = (struct __pyx_obj_8_cdec_sa_DataArray *)o; - Py_XDECREF(p->word2id); - Py_XDECREF(p->id2word); - Py_XDECREF(((PyObject *)p->data)); - Py_XDECREF(((PyObject *)p->sent_id)); - Py_XDECREF(((PyObject *)p->sent_index)); +static void __pyx_tp_dealloc_3_sa_IntList(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_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_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_8_cdec_sa_DataArray(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_8_cdec_sa_DataArray *p = (struct __pyx_obj_8_cdec_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; +static int __pyx_mp_ass_subscript_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_3_sa_7IntList_19__setitem__(o, i, v); } - if (p->sent_index) { - e = (*v)(((PyObject*)p->sent_index), 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_8_cdec_sa_DataArray(PyObject *o) { - struct __pyx_obj_8_cdec_sa_DataArray *p = (struct __pyx_obj_8_cdec_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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_id); - p->sent_id = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_8_cdec_sa_DataArray[] = { - {__Pyx_NAMESTR("getSentId"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_5getSentId, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getSent"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_7getSent, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getSentPos"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_9getSentPos, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_11get_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_word"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_13get_word, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_15write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_17read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_19read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_21write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_23write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_8_cdec_sa_9DataArray_25write_enhanced, METH_O, __Pyx_DOCSTR(0)}, +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("getSize"), (PyCFunction)__pyx_pw_3_sa_7IntList_23getSize, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_3_sa_7IntList_25append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_3_sa_7IntList_27extend, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_3_sa_7IntList_29write, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_3_sa_7IntList_31read, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_DataArray = { +static PyNumberMethods __pyx_tp_as_number_IntList = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -54176,11 +54280,11 @@ static PyNumberMethods __pyx_tp_as_number_DataArray = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_DataArray = { - __pyx_pw_8_cdec_sa_9DataArray_3__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_IntList = { + __pyx_pw_3_sa_7IntList_21__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - 0, /*sq_item*/ + __pyx_sq_item_3_sa_IntList, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -54189,13 +54293,13 @@ static PySequenceMethods __pyx_tp_as_sequence_DataArray = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_DataArray = { - __pyx_pw_8_cdec_sa_9DataArray_3__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ +static PyMappingMethods __pyx_tp_as_mapping_IntList = { + __pyx_pw_3_sa_7IntList_21__len__, /*mp_length*/ + __pyx_pw_3_sa_7IntList_17__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_3_sa_IntList, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_DataArray = { +static PyBufferProcs __pyx_tp_as_buffer_IntList = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -54216,12 +54320,12 @@ static PyBufferProcs __pyx_tp_as_buffer_DataArray = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_DataArray = { +static PyTypeObject __pyx_type_3_sa_IntList = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.DataArray"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_DataArray), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.IntList"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_IntList), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_DataArray, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_IntList, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -54231,24 +54335,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_DataArray = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_DataArray, /*tp_as_number*/ - &__pyx_tp_as_sequence_DataArray, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_DataArray, /*tp_as_mapping*/ + &__pyx_tp_as_number_IntList, /*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*/ - 0, /*tp_str*/ + __pyx_pw_3_sa_7IntList_3__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_DataArray, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + &__pyx_tp_as_buffer_IntList, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_DataArray, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_DataArray, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_DataArray, /*tp_methods*/ + __pyx_methods_3_sa_IntList, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -54258,7 +54362,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_DataArray = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_DataArray, /*tp_new*/ + __pyx_tp_new_3_sa_IntList, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -54271,66 +54375,38 @@ static PyTypeObject __pyx_type_8_cdec_sa_DataArray = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_Alignment __pyx_vtable_8_cdec_sa_Alignment; +static struct __pyx_vtabstruct_3_sa_StringMap __pyx_vtable_3_sa_StringMap; -static PyObject *__pyx_tp_new_8_cdec_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Alignment *p; +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Alignment *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_Alignment; - p->links = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_9Alignment_5__cinit__(o, a, k) < 0) { + p = ((struct __pyx_obj_3_sa_StringMap *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_StringMap; + if (__pyx_pw_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Alignment(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Alignment *p = (struct __pyx_obj_8_cdec_sa_Alignment *)o; - Py_XDECREF(((PyObject *)p->links)); - Py_XDECREF(((PyObject *)p->sent_index)); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_8_cdec_sa_Alignment(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_8_cdec_sa_Alignment *p = (struct __pyx_obj_8_cdec_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; +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); } - return 0; -} - -static int __pyx_tp_clear_8_cdec_sa_Alignment(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Alignment *p = (struct __pyx_obj_8_cdec_sa_Alignment *)o; - PyObject* tmp; - tmp = ((PyObject*)p->links); - p->links = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; + (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_Alignment[] = { - {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_1unlink, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_9Alignment_unlink)}, - {__Pyx_NAMESTR("get_sent_links"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_3get_sent_links, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_7read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_9read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_11write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_13write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_15write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("alignment"), (PyCFunction)__pyx_pw_8_cdec_sa_9Alignment_17alignment, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_9Alignment_16alignment)}, +static PyMethodDef __pyx_methods_3_sa_StringMap[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_Alignment = { +static PyNumberMethods __pyx_tp_as_number_StringMap = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -54388,7 +54464,7 @@ static PyNumberMethods __pyx_tp_as_number_Alignment = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_Alignment = { +static PySequenceMethods __pyx_tp_as_sequence_StringMap = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -54401,13 +54477,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Alignment = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_Alignment = { +static PyMappingMethods __pyx_tp_as_mapping_StringMap = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_Alignment = { +static PyBufferProcs __pyx_tp_as_buffer_StringMap = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -54428,12 +54504,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Alignment = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Alignment = { +static PyTypeObject __pyx_type_3_sa_StringMap = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Alignment"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Alignment), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.StringMap"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_StringMap), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Alignment, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_StringMap, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -54443,24 +54519,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alignment = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Alignment, /*tp_as_number*/ - &__pyx_tp_as_sequence_Alignment, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Alignment, /*tp_as_mapping*/ + &__pyx_tp_as_number_StringMap, /*tp_as_number*/ + &__pyx_tp_as_sequence_StringMap, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_StringMap, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Alignment, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + &__pyx_tp_as_buffer_StringMap, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_Alignment, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_Alignment, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_Alignment, /*tp_methods*/ + __pyx_methods_3_sa_StringMap, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -54470,7 +54546,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alignment = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Alignment, /*tp_new*/ + __pyx_tp_new_3_sa_StringMap, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -54483,114 +54559,93 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alignment = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_BiLex __pyx_vtable_8_cdec_sa_BiLex; +static struct __pyx_vtabstruct_3_sa_DataArray __pyx_vtable_3_sa_DataArray; -static PyObject *__pyx_tp_new_8_cdec_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_BiLex *p; +static PyObject *__pyx_tp_new_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_DataArray *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_BiLex *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_BiLex; - p->col1 = ((struct __pyx_obj_8_cdec_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->col2 = ((struct __pyx_obj_8_cdec_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->f_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->e_index = ((struct __pyx_obj_8_cdec_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 (__pyx_pw_8_cdec_sa_5BiLex_1__cinit__(o, a, k) < 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 (__pyx_pw_3_sa_9DataArray_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_BiLex(PyObject *o) { - struct __pyx_obj_8_cdec_sa_BiLex *p = (struct __pyx_obj_8_cdec_sa_BiLex *)o; - Py_XDECREF(((PyObject *)p->col1)); - Py_XDECREF(((PyObject *)p->col2)); - Py_XDECREF(((PyObject *)p->f_index)); - Py_XDECREF(((PyObject *)p->e_index)); - Py_XDECREF(p->id2eword); - Py_XDECREF(p->id2fword); - Py_XDECREF(p->eword2id); - Py_XDECREF(p->fword2id); +static void __pyx_tp_dealloc_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; + Py_XDECREF(p->word2id); + Py_XDECREF(p->id2word); + Py_XDECREF(((PyObject *)p->data)); + Py_XDECREF(((PyObject *)p->sent_id)); + Py_XDECREF(((PyObject *)p->sent_index)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_BiLex(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_DataArray(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_BiLex *p = (struct __pyx_obj_8_cdec_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; + 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->id2eword) { - e = (*v)(p->id2eword, a); if (e) return e; + if (p->id2word) { + e = (*v)(p->id2word, a); if (e) return e; } - if (p->id2fword) { - e = (*v)(p->id2fword, a); if (e) return e; + if (p->data) { + e = (*v)(((PyObject*)p->data), a); if (e) return e; } - if (p->eword2id) { - e = (*v)(p->eword2id, a); if (e) return e; + if (p->sent_id) { + e = (*v)(((PyObject*)p->sent_id), a); if (e) return e; } - if (p->fword2id) { - e = (*v)(p->fword2id, 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_8_cdec_sa_BiLex(PyObject *o) { - struct __pyx_obj_8_cdec_sa_BiLex *p = (struct __pyx_obj_8_cdec_sa_BiLex *)o; +static int __pyx_tp_clear_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; PyObject* tmp; - tmp = ((PyObject*)p->col1); - p->col1 = ((struct __pyx_obj_8_cdec_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->col2); - p->col2 = ((struct __pyx_obj_8_cdec_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->f_index); - p->f_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->e_index); - p->e_index = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->word2id); + p->word2id = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2eword); - p->id2eword = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->id2word); + p->id2word = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2fword); - p->id2fword = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->data); + p->data = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->eword2id); - p->eword2id = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->sent_id); + p->sent_id = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->fword2id); - p->fword2id = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->sent_index); + p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_BiLex[] = { - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_3write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_5read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_8_cdec_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_5BiLex_16write_text)}, +static PyMethodDef __pyx_methods_3_sa_DataArray[] = { + {__Pyx_NAMESTR("getSentId"), (PyCFunction)__pyx_pw_3_sa_9DataArray_5getSentId, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getSent"), (PyCFunction)__pyx_pw_3_sa_9DataArray_7getSent, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getSentPos"), (PyCFunction)__pyx_pw_3_sa_9DataArray_9getSentPos, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pw_3_sa_9DataArray_11get_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_word"), (PyCFunction)__pyx_pw_3_sa_9DataArray_13get_word, 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_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_19read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_21write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pw_3_sa_9DataArray_23write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_9DataArray_25write_enhanced, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_BiLex = { +static PyNumberMethods __pyx_tp_as_number_DataArray = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -54648,8 +54703,8 @@ static PyNumberMethods __pyx_tp_as_number_BiLex = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_BiLex = { - 0, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_DataArray = { + __pyx_pw_3_sa_9DataArray_3__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ @@ -54661,13 +54716,13 @@ static PySequenceMethods __pyx_tp_as_sequence_BiLex = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_BiLex = { - 0, /*mp_length*/ +static PyMappingMethods __pyx_tp_as_mapping_DataArray = { + __pyx_pw_3_sa_9DataArray_3__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_BiLex = { +static PyBufferProcs __pyx_tp_as_buffer_DataArray = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -54688,12 +54743,12 @@ static PyBufferProcs __pyx_tp_as_buffer_BiLex = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_BiLex = { +static PyTypeObject __pyx_type_3_sa_DataArray = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.BiLex"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_BiLex), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.DataArray"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_DataArray), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_BiLex, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_DataArray, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -54703,24 +54758,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_BiLex = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_BiLex, /*tp_as_number*/ - &__pyx_tp_as_sequence_BiLex, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BiLex, /*tp_as_mapping*/ + &__pyx_tp_as_number_DataArray, /*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*/ - &__pyx_tp_as_buffer_BiLex, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_DataArray, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_BiLex, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_BiLex, /*tp_clear*/ + __pyx_tp_traverse_3_sa_DataArray, /*tp_traverse*/ + __pyx_tp_clear_3_sa_DataArray, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_BiLex, /*tp_methods*/ + __pyx_methods_3_sa_DataArray, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -54730,7 +54785,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_BiLex = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_BiLex, /*tp_new*/ + __pyx_tp_new_3_sa_DataArray, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -54743,23 +54798,66 @@ static PyTypeObject __pyx_type_8_cdec_sa_BiLex = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_3_sa_Alignment __pyx_vtable_3_sa_Alignment; -static PyObject *__pyx_tp_new_8_cdec_sa_BitSetIterator(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_Alignment *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!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 (__pyx_pw_3_sa_9Alignment_5__cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_BitSetIterator(PyObject *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; + Py_XDECREF(((PyObject *)p->links)); + Py_XDECREF(((PyObject *)p->sent_index)); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_BitSetIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_8_cdec_sa_14BitSetIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, +static int __pyx_tp_traverse_3_sa_Alignment(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; + } + if (p->sent_index) { + e = (*v)(((PyObject*)p->sent_index), 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; + PyObject* tmp; + tmp = ((PyObject*)p->links); + p->links = ((struct __pyx_obj_3_sa_IntList *)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); + 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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_BitSetIterator = { +static PyNumberMethods __pyx_tp_as_number_Alignment = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -54817,7 +54915,7 @@ static PyNumberMethods __pyx_tp_as_number_BitSetIterator = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_BitSetIterator = { +static PySequenceMethods __pyx_tp_as_sequence_Alignment = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -54830,13 +54928,13 @@ static PySequenceMethods __pyx_tp_as_sequence_BitSetIterator = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_BitSetIterator = { +static PyMappingMethods __pyx_tp_as_mapping_Alignment = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_BitSetIterator = { +static PyBufferProcs __pyx_tp_as_buffer_Alignment = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -54857,12 +54955,12 @@ static PyBufferProcs __pyx_tp_as_buffer_BitSetIterator = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_BitSetIterator = { +static PyTypeObject __pyx_type_3_sa_Alignment = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.BitSetIterator"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_BitSetIterator), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Alignment"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Alignment), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_BitSetIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Alignment, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -54872,24 +54970,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSetIterator = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_BitSetIterator, /*tp_as_number*/ - &__pyx_tp_as_sequence_BitSetIterator, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BitSetIterator, /*tp_as_mapping*/ + &__pyx_tp_as_number_Alignment, /*tp_as_number*/ + &__pyx_tp_as_sequence_Alignment, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Alignment, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BitSetIterator, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + &__pyx_tp_as_buffer_Alignment, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_3_sa_Alignment, /*tp_traverse*/ + __pyx_tp_clear_3_sa_Alignment, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pw_8_cdec_sa_14BitSetIterator_1__next__, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_BitSetIterator, /*tp_methods*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa_Alignment, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -54899,7 +54997,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSetIterator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_BitSetIterator, /*tp_new*/ + __pyx_tp_new_3_sa_Alignment, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -54912,38 +55010,114 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSetIterator = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_3_sa_BiLex __pyx_vtable_3_sa_BiLex; -static PyObject *__pyx_tp_new_8_cdec_sa_BitSet(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_BiLex *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - if (__pyx_pw_8_cdec_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 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 (__pyx_pw_3_sa_5BiLex_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_BitSet(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_8_cdec_sa_6BitSet_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } +static void __pyx_tp_dealloc_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)o; + Py_XDECREF(((PyObject *)p->col1)); + Py_XDECREF(((PyObject *)p->col2)); + Py_XDECREF(((PyObject *)p->f_index)); + Py_XDECREF(((PyObject *)p->e_index)); + Py_XDECREF(p->id2eword); + Py_XDECREF(p->id2fword); + Py_XDECREF(p->eword2id); + Py_XDECREF(p->fword2id); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_BitSet[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_8_cdec_sa_6BitSet_7insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_8_cdec_sa_6BitSet_9findsucc, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("min"), (PyCFunction)__pyx_pw_8_cdec_sa_6BitSet_13min, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("max"), (PyCFunction)__pyx_pw_8_cdec_sa_6BitSet_15max, METH_NOARGS, __Pyx_DOCSTR(0)}, +static int __pyx_tp_traverse_3_sa_BiLex(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; + } + 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_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)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); + 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_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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_BitSet = { +static PyNumberMethods __pyx_tp_as_number_BiLex = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55001,26 +55175,26 @@ static PyNumberMethods __pyx_tp_as_number_BitSet = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_BitSet = { - __pyx_pw_8_cdec_sa_6BitSet_17__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_BiLex = { + 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ - __pyx_pw_8_cdec_sa_6BitSet_19__contains__, /*sq_contains*/ + 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_BitSet = { - __pyx_pw_8_cdec_sa_6BitSet_17__len__, /*mp_length*/ +static PyMappingMethods __pyx_tp_as_mapping_BiLex = { + 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_BitSet = { +static PyBufferProcs __pyx_tp_as_buffer_BiLex = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -55041,12 +55215,12 @@ static PyBufferProcs __pyx_tp_as_buffer_BitSet = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_BitSet = { +static PyTypeObject __pyx_type_3_sa_BiLex = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.BitSet"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_BitSet), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.BiLex"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_BiLex), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_BitSet, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_BiLex, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -55056,24 +55230,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSet = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_BitSet, /*tp_as_number*/ - &__pyx_tp_as_sequence_BitSet, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ + &__pyx_tp_as_number_BiLex, /*tp_as_number*/ + &__pyx_tp_as_sequence_BiLex, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BiLex, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_8_cdec_sa_6BitSet_11__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BitSet, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + &__pyx_tp_as_buffer_BiLex, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_3_sa_BiLex, /*tp_traverse*/ + __pyx_tp_clear_3_sa_BiLex, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_8_cdec_sa_6BitSet_5__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_BitSet, /*tp_methods*/ + __pyx_methods_3_sa_BiLex, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -55083,7 +55257,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSet = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_BitSet, /*tp_new*/ + __pyx_tp_new_3_sa_BiLex, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -55097,22 +55271,22 @@ static PyTypeObject __pyx_type_8_cdec_sa_BitSet = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_VEBIterator(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_BitSetIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; } -static void __pyx_tp_dealloc_8_cdec_sa_VEBIterator(PyObject *o) { +static void __pyx_tp_dealloc_3_sa_BitSetIterator(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_VEBIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_8_cdec_sa_11VEBIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_VEBIterator = { +static PyNumberMethods __pyx_tp_as_number_BitSetIterator = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55170,7 +55344,7 @@ static PyNumberMethods __pyx_tp_as_number_VEBIterator = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_VEBIterator = { +static PySequenceMethods __pyx_tp_as_sequence_BitSetIterator = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -55183,13 +55357,13 @@ static PySequenceMethods __pyx_tp_as_sequence_VEBIterator = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_VEBIterator = { +static PyMappingMethods __pyx_tp_as_mapping_BitSetIterator = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_VEBIterator = { +static PyBufferProcs __pyx_tp_as_buffer_BitSetIterator = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -55210,12 +55384,12 @@ static PyBufferProcs __pyx_tp_as_buffer_VEBIterator = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_VEBIterator = { +static PyTypeObject __pyx_type_3_sa_BitSetIterator = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.VEBIterator"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_VEBIterator), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.BitSetIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_BitSetIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_VEBIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_BitSetIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -55225,15 +55399,15 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEBIterator = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_VEBIterator, /*tp_as_number*/ - &__pyx_tp_as_sequence_VEBIterator, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_VEBIterator, /*tp_as_mapping*/ + &__pyx_tp_as_number_BitSetIterator, /*tp_as_number*/ + &__pyx_tp_as_sequence_BitSetIterator, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BitSetIterator, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_VEBIterator, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_BitSetIterator, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ @@ -55241,8 +55415,8 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEBIterator = { 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pw_8_cdec_sa_11VEBIterator_1__next__, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_VEBIterator, /*tp_methods*/ + __pyx_pw_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ + __pyx_methods_3_sa_BitSetIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -55252,7 +55426,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEBIterator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_VEBIterator, /*tp_new*/ + __pyx_tp_new_3_sa_BitSetIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -55265,26 +55439,22 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEBIterator = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_VEB __pyx_vtable_8_cdec_sa_VEB; -static PyObject *__pyx_tp_new_8_cdec_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_VEB *p; +static PyObject *__pyx_tp_new_3_sa_BitSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_VEB *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_VEB; - if (__pyx_pw_8_cdec_sa_3VEB_1__cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_VEB(PyObject *o) { +static void __pyx_tp_dealloc_3_sa_BitSet(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_8_cdec_sa_3VEB_3__dealloc__(o); + __pyx_pw_3_sa_6BitSet_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -55292,13 +55462,15 @@ static void __pyx_tp_dealloc_8_cdec_sa_VEB(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_VEB[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_8_cdec_sa_3VEB_7insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_8_cdec_sa_3VEB_9findsucc, METH_O, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_VEB = { +static PyNumberMethods __pyx_tp_as_number_BitSet = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55356,26 +55528,26 @@ static PyNumberMethods __pyx_tp_as_number_VEB = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_VEB = { - __pyx_pw_8_cdec_sa_3VEB_11__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_BitSet = { + __pyx_pw_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_8_cdec_sa_3VEB_13__contains__, /*sq_contains*/ + __pyx_pw_3_sa_6BitSet_19__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_VEB = { - __pyx_pw_8_cdec_sa_3VEB_11__len__, /*mp_length*/ +static PyMappingMethods __pyx_tp_as_mapping_BitSet = { + __pyx_pw_3_sa_6BitSet_17__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_VEB = { +static PyBufferProcs __pyx_tp_as_buffer_BitSet = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -55396,12 +55568,12 @@ static PyBufferProcs __pyx_tp_as_buffer_VEB = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_VEB = { +static PyTypeObject __pyx_type_3_sa_BitSet = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.VEB"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_VEB), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.BitSet"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_BitSet), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_VEB, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_BitSet, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -55411,24 +55583,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEB = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_VEB, /*tp_as_number*/ - &__pyx_tp_as_sequence_VEB, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_VEB, /*tp_as_mapping*/ + &__pyx_tp_as_number_BitSet, /*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*/ - 0, /*tp_str*/ + __pyx_pw_3_sa_6BitSet_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_VEB, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_BitSet, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_8_cdec_sa_3VEB_5__iter__, /*tp_iter*/ + __pyx_pw_3_sa_6BitSet_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_VEB, /*tp_methods*/ + __pyx_methods_3_sa_BitSet, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -55438,7 +55610,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEB = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_VEB, /*tp_new*/ + __pyx_tp_new_3_sa_BitSet, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -55452,56 +55624,22 @@ static PyTypeObject __pyx_type_8_cdec_sa_VEB = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_LCP *p; +static PyObject *__pyx_tp_new_3_sa_VEBIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_LCP *)o); - p->sa = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->lcp = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_3LCP_1__cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_LCP(PyObject *o) { - struct __pyx_obj_8_cdec_sa_LCP *p = (struct __pyx_obj_8_cdec_sa_LCP *)o; - Py_XDECREF(((PyObject *)p->sa)); - Py_XDECREF(((PyObject *)p->lcp)); +static void __pyx_tp_dealloc_3_sa_VEBIterator(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_LCP(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_8_cdec_sa_LCP *p = (struct __pyx_obj_8_cdec_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_8_cdec_sa_LCP(PyObject *o) { - struct __pyx_obj_8_cdec_sa_LCP *p = (struct __pyx_obj_8_cdec_sa_LCP *)o; - PyObject* tmp; - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->lcp); - p->lcp = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_8_cdec_sa_LCP[] = { - {__Pyx_NAMESTR("compute_stats"), (PyCFunction)__pyx_pw_8_cdec_sa_3LCP_3compute_stats, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_3LCP_2compute_stats)}, +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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_LCP = { +static PyNumberMethods __pyx_tp_as_number_VEBIterator = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55559,7 +55697,7 @@ static PyNumberMethods __pyx_tp_as_number_LCP = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_LCP = { +static PySequenceMethods __pyx_tp_as_sequence_VEBIterator = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -55572,13 +55710,13 @@ static PySequenceMethods __pyx_tp_as_sequence_LCP = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_LCP = { +static PyMappingMethods __pyx_tp_as_mapping_VEBIterator = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_LCP = { +static PyBufferProcs __pyx_tp_as_buffer_VEBIterator = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -55599,12 +55737,12 @@ static PyBufferProcs __pyx_tp_as_buffer_LCP = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_LCP = { +static PyTypeObject __pyx_type_3_sa_VEBIterator = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.LCP"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_LCP), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.VEBIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_VEBIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_LCP, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_VEBIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -55614,24 +55752,24 @@ static PyTypeObject __pyx_type_8_cdec_sa_LCP = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_LCP, /*tp_as_number*/ - &__pyx_tp_as_sequence_LCP, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_LCP, /*tp_as_mapping*/ + &__pyx_tp_as_number_VEBIterator, /*tp_as_number*/ + &__pyx_tp_as_sequence_VEBIterator, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VEBIterator, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_LCP, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + &__pyx_tp_as_buffer_VEBIterator, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_LCP, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_LCP, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_LCP, /*tp_methods*/ + __pyx_pw_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ + __pyx_methods_3_sa_VEBIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -55641,7 +55779,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_LCP = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_LCP, /*tp_new*/ + __pyx_tp_new_3_sa_VEBIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -55654,89 +55792,40 @@ static PyTypeObject __pyx_type_8_cdec_sa_LCP = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_Alphabet __pyx_vtable_8_cdec_sa_Alphabet; +static struct __pyx_vtabstruct_3_sa_VEB __pyx_vtable_3_sa_VEB; -static PyObject *__pyx_tp_new_8_cdec_sa_Alphabet(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Alphabet *p; +static PyObject *__pyx_tp_new_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_VEB *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Alphabet *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_Alphabet; - p->terminals = ((struct __pyx_obj_8_cdec_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->nonterminals = ((struct __pyx_obj_8_cdec_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { + p = ((struct __pyx_obj_3_sa_VEB *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_VEB; + if (__pyx_pw_3_sa_3VEB_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Alphabet(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Alphabet *p = (struct __pyx_obj_8_cdec_sa_Alphabet *)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_8_cdec_sa_8Alphabet_3__dealloc__(o); + __pyx_pw_3_sa_3VEB_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - Py_XDECREF(((PyObject *)p->terminals)); - Py_XDECREF(((PyObject *)p->nonterminals)); - Py_XDECREF(((PyObject *)p->id2sym)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_Alphabet(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_8_cdec_sa_Alphabet *p = (struct __pyx_obj_8_cdec_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_8_cdec_sa_Alphabet(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Alphabet *p = (struct __pyx_obj_8_cdec_sa_Alphabet *)o; - PyObject* tmp; - tmp = ((PyObject*)p->terminals); - p->terminals = ((struct __pyx_obj_8_cdec_sa_StringMap *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->nonterminals); - p->nonterminals = ((struct __pyx_obj_8_cdec_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_8_cdec_sa_8Alphabet_terminals(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_8Alphabet_9terminals_1__get__(o); -} - -static PyObject *__pyx_getprop_8_cdec_sa_8Alphabet_nonterminals(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_8Alphabet_12nonterminals_1__get__(o); -} - -static PyMethodDef __pyx_methods_8_cdec_sa_Alphabet[] = { +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 struct PyGetSetDef __pyx_getsets_8_cdec_sa_Alphabet[] = { - {(char *)"terminals", __pyx_getprop_8_cdec_sa_8Alphabet_terminals, 0, 0, 0}, - {(char *)"nonterminals", __pyx_getprop_8_cdec_sa_8Alphabet_nonterminals, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_Alphabet = { +static PyNumberMethods __pyx_tp_as_number_VEB = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55794,26 +55883,26 @@ static PyNumberMethods __pyx_tp_as_number_Alphabet = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_Alphabet = { - 0, /*sq_length*/ +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*/ - 0, /*sq_contains*/ + __pyx_pw_3_sa_3VEB_13__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_Alphabet = { - 0, /*mp_length*/ +static PyMappingMethods __pyx_tp_as_mapping_VEB = { + __pyx_pw_3_sa_3VEB_11__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_Alphabet = { +static PyBufferProcs __pyx_tp_as_buffer_VEB = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -55834,12 +55923,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Alphabet = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Alphabet = { +static PyTypeObject __pyx_type_3_sa_VEB = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Alphabet"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Alphabet), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.VEB"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_VEB), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Alphabet, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_VEB, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -55849,26 +55938,26 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alphabet = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Alphabet, /*tp_as_number*/ - &__pyx_tp_as_sequence_Alphabet, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Alphabet, /*tp_as_mapping*/ + &__pyx_tp_as_number_VEB, /*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*/ - &__pyx_tp_as_buffer_Alphabet, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + &__pyx_tp_as_buffer_VEB, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_Alphabet, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_Alphabet, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_3_sa_3VEB_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_Alphabet, /*tp_methods*/ + __pyx_methods_3_sa_VEB, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_8_cdec_sa_Alphabet, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -55876,7 +55965,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alphabet = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Alphabet, /*tp_new*/ + __pyx_tp_new_3_sa_VEB, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -55889,53 +55978,57 @@ static PyTypeObject __pyx_type_8_cdec_sa_Alphabet = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_Phrase __pyx_vtable_8_cdec_sa_Phrase; -static PyObject *__pyx_tp_new_8_cdec_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Phrase *p; +static PyObject *__pyx_tp_new_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_LCP *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Phrase *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_Phrase; - if (__pyx_pw_8_cdec_sa_6Phrase_1__cinit__(o, a, k) < 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 (__pyx_pw_3_sa_3LCP_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Phrase(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_8_cdec_sa_6Phrase_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } +static void __pyx_tp_dealloc_3_sa_LCP(PyObject *o) { + struct __pyx_obj_3_sa_LCP *p = (struct __pyx_obj_3_sa_LCP *)o; + Py_XDECREF(((PyObject *)p->sa)); + Py_XDECREF(((PyObject *)p->lcp)); (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_sq_item_8_cdec_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_3_sa_LCP(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; + } + if (p->lcp) { + e = (*v)(((PyObject*)p->lcp), a); if (e) return e; + } + return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_Phrase[] = { - {__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_7handle, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_6Phrase_6handle)}, - {__Pyx_NAMESTR("strhandle"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_9strhandle, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_11arity, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvarpos"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_13getvarpos, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvar"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_15getvar, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("clen"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_17clen, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getchunk"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_19getchunk, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("subst"), (PyCFunction)__pyx_pw_8_cdec_sa_6Phrase_31subst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(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; + PyObject* tmp; + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_3_sa_SuffixArray *)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); + 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)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_Phrase = { +static PyNumberMethods __pyx_tp_as_number_LCP = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -55993,11 +56086,11 @@ static PyNumberMethods __pyx_tp_as_number_Phrase = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_Phrase = { - __pyx_pw_8_cdec_sa_6Phrase_25__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_LCP = { + 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - __pyx_sq_item_8_cdec_sa_Phrase, /*sq_item*/ + 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -56006,13 +56099,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Phrase = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_Phrase = { - __pyx_pw_8_cdec_sa_6Phrase_25__len__, /*mp_length*/ - __pyx_pw_8_cdec_sa_6Phrase_27__getitem__, /*mp_subscript*/ +static PyMappingMethods __pyx_tp_as_mapping_LCP = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_Phrase = { +static PyBufferProcs __pyx_tp_as_buffer_LCP = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -56033,39 +56126,39 @@ static PyBufferProcs __pyx_tp_as_buffer_Phrase = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Phrase = { +static PyTypeObject __pyx_type_3_sa_LCP = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Phrase"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Phrase), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.LCP"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_LCP), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Phrase, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_LCP, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_pw_8_cdec_sa_6Phrase_21__cmp__, /*tp_compare*/ + 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Phrase, /*tp_as_number*/ - &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ - __pyx_pw_8_cdec_sa_6Phrase_23__hash__, /*tp_hash*/ + &__pyx_tp_as_number_LCP, /*tp_as_number*/ + &__pyx_tp_as_sequence_LCP, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_LCP, /*tp_as_mapping*/ + 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_8_cdec_sa_6Phrase_5__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Phrase, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + &__pyx_tp_as_buffer_LCP, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_3_sa_LCP, /*tp_traverse*/ + __pyx_tp_clear_3_sa_LCP, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_8_cdec_sa_6Phrase_29__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_Phrase, /*tp_methods*/ + __pyx_methods_3_sa_LCP, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -56075,7 +56168,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Phrase = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Phrase, /*tp_new*/ + __pyx_tp_new_3_sa_LCP, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -56088,133 +56181,89 @@ static PyTypeObject __pyx_type_8_cdec_sa_Phrase = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_3_sa_Alphabet __pyx_vtable_3_sa_Alphabet; -static PyObject *__pyx_tp_new_8_cdec_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Rule *p; +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Rule *)o); - p->f = ((struct __pyx_obj_8_cdec_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->e = ((struct __pyx_obj_8_cdec_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->word_alignments = Py_None; Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_4Rule_1__cinit__(o, a, k) < 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 (__pyx_pw_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Rule(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Rule *p = (struct __pyx_obj_8_cdec_sa_Rule *)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; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_8_cdec_sa_4Rule_3__dealloc__(o); + __pyx_pw_3_sa_8Alphabet_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - Py_XDECREF(((PyObject *)p->f)); - Py_XDECREF(((PyObject *)p->e)); - Py_XDECREF(p->word_alignments); + Py_XDECREF(((PyObject *)p->terminals)); + Py_XDECREF(((PyObject *)p->nonterminals)); + Py_XDECREF(((PyObject *)p->id2sym)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_Rule(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_Alphabet(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_Rule *p = (struct __pyx_obj_8_cdec_sa_Rule *)o; - if (p->f) { - e = (*v)(((PyObject*)p->f), a); if (e) return 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->e) { - e = (*v)(((PyObject*)p->e), a); if (e) return e; + if (p->nonterminals) { + e = (*v)(((PyObject*)p->nonterminals), a); if (e) return e; } - if (p->word_alignments) { - e = (*v)(p->word_alignments, a); if (e) return e; + if (p->id2sym) { + e = (*v)(p->id2sym, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_8_cdec_sa_Rule(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Rule *p = (struct __pyx_obj_8_cdec_sa_Rule *)o; +static int __pyx_tp_clear_3_sa_Alphabet(PyObject *o) { + struct __pyx_obj_3_sa_Alphabet *p = (struct __pyx_obj_3_sa_Alphabet *)o; PyObject* tmp; - tmp = ((PyObject*)p->f); - p->f = ((struct __pyx_obj_8_cdec_sa_Phrase *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->terminals); + p->terminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->e); - p->e = ((struct __pyx_obj_8_cdec_sa_Phrase *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->nonterminals); + p->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->word_alignments); - p->word_alignments = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->id2sym); + p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_getprop_8_cdec_sa_4Rule_scores(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_4Rule_6scores_1__get__(o); -} - -static int __pyx_setprop_8_cdec_sa_4Rule_scores(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pw_8_cdec_sa_4Rule_6scores_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_8_cdec_sa_4Rule_lhs(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_4Rule_3lhs_1__get__(o); -} - -static int __pyx_setprop_8_cdec_sa_4Rule_lhs(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pw_8_cdec_sa_4Rule_3lhs_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_8_cdec_sa_4Rule_f(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_4Rule_1f_1__get__(o); -} - -static PyObject *__pyx_getprop_8_cdec_sa_4Rule_e(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_4Rule_1e_1__get__(o); +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_8_cdec_sa_4Rule_word_alignments(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_4Rule_15word_alignments_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 int __pyx_setprop_8_cdec_sa_4Rule_word_alignments(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pw_8_cdec_sa_4Rule_15word_alignments_3__set__(o, v); - } - else { - return __pyx_pw_8_cdec_sa_4Rule_15word_alignments_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_8_cdec_sa_Rule[] = { - {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pw_8_cdec_sa_4Rule_11fmerge, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_8_cdec_sa_4Rule_13arity, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_3_sa_Alphabet[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_8_cdec_sa_Rule[] = { - {(char *)"scores", __pyx_getprop_8_cdec_sa_4Rule_scores, __pyx_setprop_8_cdec_sa_4Rule_scores, 0, 0}, - {(char *)"lhs", __pyx_getprop_8_cdec_sa_4Rule_lhs, __pyx_setprop_8_cdec_sa_4Rule_lhs, 0, 0}, - {(char *)"f", __pyx_getprop_8_cdec_sa_4Rule_f, 0, 0, 0}, - {(char *)"e", __pyx_getprop_8_cdec_sa_4Rule_e, 0, 0, 0}, - {(char *)"word_alignments", __pyx_getprop_8_cdec_sa_4Rule_word_alignments, __pyx_setprop_8_cdec_sa_4Rule_word_alignments, 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 PyNumberMethods __pyx_tp_as_number_Rule = { +static PyNumberMethods __pyx_tp_as_number_Alphabet = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -56250,7 +56299,7 @@ static PyNumberMethods __pyx_tp_as_number_Rule = { #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif - __pyx_pw_8_cdec_sa_4Rule_9__iadd__, /*nb_inplace_add*/ + 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 @@ -56272,7 +56321,7 @@ static PyNumberMethods __pyx_tp_as_number_Rule = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence_Rule = { +static PySequenceMethods __pyx_tp_as_sequence_Alphabet = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -56285,13 +56334,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Rule = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_Rule = { +static PyMappingMethods __pyx_tp_as_mapping_Alphabet = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_Rule = { +static PyBufferProcs __pyx_tp_as_buffer_Alphabet = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -56312,41 +56361,41 @@ static PyBufferProcs __pyx_tp_as_buffer_Rule = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Rule = { +static PyTypeObject __pyx_type_3_sa_Alphabet = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Rule"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Rule), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Alphabet"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Alphabet), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Rule, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Alphabet, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_pw_8_cdec_sa_4Rule_7__cmp__, /*tp_compare*/ + 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Rule, /*tp_as_number*/ - &__pyx_tp_as_sequence_Rule, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Rule, /*tp_as_mapping*/ - __pyx_pw_8_cdec_sa_4Rule_5__hash__, /*tp_hash*/ + &__pyx_tp_as_number_Alphabet, /*tp_as_number*/ + &__pyx_tp_as_sequence_Alphabet, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Alphabet, /*tp_as_mapping*/ + 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_8_cdec_sa_4Rule_15__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Rule, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_Alphabet, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_Rule, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_Rule, /*tp_clear*/ + __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_8_cdec_sa_Rule, /*tp_methods*/ + __pyx_methods_3_sa_Alphabet, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_8_cdec_sa_Rule, /*tp_getset*/ + __pyx_getsets_3_sa_Alphabet, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -56354,7 +56403,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Rule = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Rule, /*tp_new*/ + __pyx_tp_new_3_sa_Alphabet, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -56367,26 +56416,26 @@ static PyTypeObject __pyx_type_8_cdec_sa_Rule = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_TrieMap __pyx_vtable_8_cdec_sa_TrieMap; +static struct __pyx_vtabstruct_3_sa_TrieMap __pyx_vtable_3_sa_TrieMap; -static PyObject *__pyx_tp_new_8_cdec_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_TrieMap *p; +static PyObject *__pyx_tp_new_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_TrieMap *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_TrieMap *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_TrieMap; - if (__pyx_pw_8_cdec_sa_7TrieMap_1__cinit__(o, a, k) < 0) { + p = ((struct __pyx_obj_3_sa_TrieMap *)o); + p->__pyx_vtab = __pyx_vtabptr_3_sa_TrieMap; + if (__pyx_pw_3_sa_7TrieMap_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_TrieMap(PyObject *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_8_cdec_sa_7TrieMap_3__dealloc__(o); + __pyx_pw_3_sa_7TrieMap_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -56394,10 +56443,10 @@ static void __pyx_tp_dealloc_8_cdec_sa_TrieMap(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_8_cdec_sa_TrieMap[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_8_cdec_sa_7TrieMap_5insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pw_8_cdec_sa_7TrieMap_7contains, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("toMap"), (PyCFunction)__pyx_pw_8_cdec_sa_7TrieMap_9toMap, METH_O, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; @@ -56499,12 +56548,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TrieMap = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_TrieMap = { +static PyTypeObject __pyx_type_3_sa_TrieMap = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.TrieMap"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_TrieMap), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.TrieMap"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_TrieMap), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_TrieMap, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_TrieMap, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -56531,7 +56580,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieMap = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_TrieMap, /*tp_methods*/ + __pyx_methods_3_sa_TrieMap, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -56541,7 +56590,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieMap = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_TrieMap, /*tp_new*/ + __pyx_tp_new_3_sa_TrieMap, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -56554,32 +56603,32 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieMap = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_Precomputation __pyx_vtable_8_cdec_sa_Precomputation; +static struct __pyx_vtabstruct_3_sa_Precomputation __pyx_vtable_3_sa_Precomputation; -static PyObject *__pyx_tp_new_8_cdec_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Precomputation *p; +static PyObject *__pyx_tp_new_3_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_Precomputation *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Precomputation *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_Precomputation; + 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 (__pyx_pw_8_cdec_sa_14Precomputation_1__cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_14Precomputation_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Precomputation(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Precomputation *p = (struct __pyx_obj_8_cdec_sa_Precomputation *)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; Py_XDECREF(p->precomputed_index); Py_XDECREF(p->precomputed_collocations); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_Precomputation(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_Precomputation(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_Precomputation *p = (struct __pyx_obj_8_cdec_sa_Precomputation *)o; + 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; } @@ -56589,8 +56638,8 @@ static int __pyx_tp_traverse_8_cdec_sa_Precomputation(PyObject *o, visitproc v, return 0; } -static int __pyx_tp_clear_8_cdec_sa_Precomputation(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Precomputation *p = (struct __pyx_obj_8_cdec_sa_Precomputation *)o; +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); @@ -56601,10 +56650,10 @@ static int __pyx_tp_clear_8_cdec_sa_Precomputation(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_Precomputation[] = { - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_14Precomputation_3read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_14Precomputation_5write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_8_cdec_sa_14Precomputation_7precompute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(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)}, {0, 0, 0, 0} }; @@ -56706,12 +56755,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Precomputation = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Precomputation = { +static PyTypeObject __pyx_type_3_sa_Precomputation = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Precomputation"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Precomputation), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Precomputation"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Precomputation), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Precomputation, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Precomputation, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -56732,13 +56781,13 @@ static PyTypeObject __pyx_type_8_cdec_sa_Precomputation = { &__pyx_tp_as_buffer_Precomputation, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_Precomputation, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_Precomputation, /*tp_clear*/ + __pyx_tp_traverse_3_sa_Precomputation, /*tp_traverse*/ + __pyx_tp_clear_3_sa_Precomputation, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_Precomputation, /*tp_methods*/ + __pyx_methods_3_sa_Precomputation, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -56748,7 +56797,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Precomputation = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Precomputation, /*tp_new*/ + __pyx_tp_new_3_sa_Precomputation, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -56761,34 +56810,34 @@ static PyTypeObject __pyx_type_8_cdec_sa_Precomputation = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_SuffixArray __pyx_vtable_8_cdec_sa_SuffixArray; +static struct __pyx_vtabstruct_3_sa_SuffixArray __pyx_vtable_3_sa_SuffixArray; -static PyObject *__pyx_tp_new_8_cdec_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_SuffixArray *p; +static PyObject *__pyx_tp_new_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_SuffixArray *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_SuffixArray; - p->darray = ((struct __pyx_obj_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->ha = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_11SuffixArray_1__cinit__(o, a, k) < 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 (__pyx_pw_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_8_cdec_sa_SuffixArray *p = (struct __pyx_obj_8_cdec_sa_SuffixArray *)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; Py_XDECREF(((PyObject *)p->darray)); Py_XDECREF(((PyObject *)p->sa)); Py_XDECREF(((PyObject *)p->ha)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_SuffixArray(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_SuffixArray(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_SuffixArray *p = (struct __pyx_obj_8_cdec_sa_SuffixArray *)o; + 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; } @@ -56801,21 +56850,21 @@ static int __pyx_tp_traverse_8_cdec_sa_SuffixArray(PyObject *o, visitproc v, voi return 0; } -static int __pyx_tp_clear_8_cdec_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_8_cdec_sa_SuffixArray *p = (struct __pyx_obj_8_cdec_sa_SuffixArray *)o; +static int __pyx_tp_clear_3_sa_SuffixArray(PyObject *o) { + struct __pyx_obj_3_sa_SuffixArray *p = (struct __pyx_obj_3_sa_SuffixArray *)o; PyObject* tmp; tmp = ((PyObject*)p->darray); - p->darray = ((struct __pyx_obj_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->darray = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->ha); - p->ha = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->ha = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_sq_item_8_cdec_sa_SuffixArray(PyObject *o, Py_ssize_t i) { +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); @@ -56823,17 +56872,17 @@ static PyObject *__pyx_sq_item_8_cdec_sa_SuffixArray(PyObject *o, Py_ssize_t i) return r; } -static PyMethodDef __pyx_methods_8_cdec_sa_SuffixArray[] = { - {__Pyx_NAMESTR("getSentId"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_5getSentId, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getSent"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_7getSent, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getSentPos"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_9getSentPos, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_11read_text, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_11SuffixArray_10read_text)}, - {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_13q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_11SuffixArray_12q3sort)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_15write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_17read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_19write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_21write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_8_cdec_sa_11SuffixArray_23lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_3_sa_SuffixArray[] = { + {__Pyx_NAMESTR("getSentId"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_5getSentId, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getSent"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_7getSent, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getSentPos"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_9getSentPos, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_11read_text, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_10read_text)}, + {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_13q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_12q3sort)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_15write_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_17read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_19write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_21write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_23lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -56899,7 +56948,7 @@ static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - __pyx_sq_item_8_cdec_sa_SuffixArray, /*sq_item*/ + __pyx_sq_item_3_sa_SuffixArray, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -56910,7 +56959,7 @@ static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { static PyMappingMethods __pyx_tp_as_mapping_SuffixArray = { 0, /*mp_length*/ - __pyx_pw_8_cdec_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ + __pyx_pw_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -56935,12 +56984,12 @@ static PyBufferProcs __pyx_tp_as_buffer_SuffixArray = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_SuffixArray = { +static PyTypeObject __pyx_type_3_sa_SuffixArray = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.SuffixArray"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_SuffixArray), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.SuffixArray"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_SuffixArray), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_SuffixArray, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_SuffixArray, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -56961,13 +57010,13 @@ static PyTypeObject __pyx_type_8_cdec_sa_SuffixArray = { &__pyx_tp_as_buffer_SuffixArray, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_SuffixArray, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_SuffixArray, /*tp_clear*/ + __pyx_tp_traverse_3_sa_SuffixArray, /*tp_traverse*/ + __pyx_tp_clear_3_sa_SuffixArray, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_SuffixArray, /*tp_methods*/ + __pyx_methods_3_sa_SuffixArray, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -56977,7 +57026,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_SuffixArray = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_SuffixArray, /*tp_new*/ + __pyx_tp_new_3_sa_SuffixArray, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -56991,35 +57040,35 @@ static PyTypeObject __pyx_type_8_cdec_sa_SuffixArray = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_TrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_TrieNode *p; +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; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_TrieNode *)o); + p = ((struct __pyx_obj_3_sa_TrieNode *)o); p->children = Py_None; Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_TrieNode(PyObject *o) { - struct __pyx_obj_8_cdec_sa_TrieNode *p = (struct __pyx_obj_8_cdec_sa_TrieNode *)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; Py_XDECREF(p->children); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_TrieNode(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_TrieNode(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_TrieNode *p = (struct __pyx_obj_8_cdec_sa_TrieNode *)o; + 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; } return 0; } -static int __pyx_tp_clear_8_cdec_sa_TrieNode(PyObject *o) { - struct __pyx_obj_8_cdec_sa_TrieNode *p = (struct __pyx_obj_8_cdec_sa_TrieNode *)o; +static int __pyx_tp_clear_3_sa_TrieNode(PyObject *o) { + struct __pyx_obj_3_sa_TrieNode *p = (struct __pyx_obj_3_sa_TrieNode *)o; PyObject* tmp; tmp = ((PyObject*)p->children); p->children = Py_None; Py_INCREF(Py_None); @@ -57027,25 +57076,25 @@ static int __pyx_tp_clear_8_cdec_sa_TrieNode(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_8_cdec_sa_8TrieNode_children(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_8TrieNode_8children_1__get__(o); +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 int __pyx_setprop_8_cdec_sa_8TrieNode_children(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_8TrieNode_8children_3__set__(o, v); + return __pyx_pw_3_sa_8TrieNode_8children_3__set__(o, v); } else { - return __pyx_pw_8_cdec_sa_8TrieNode_8children_5__del__(o); + return __pyx_pw_3_sa_8TrieNode_8children_5__del__(o); } } -static PyMethodDef __pyx_methods_8_cdec_sa_TrieNode[] = { +static PyMethodDef __pyx_methods_3_sa_TrieNode[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_8_cdec_sa_TrieNode[] = { - {(char *)"children", __pyx_getprop_8_cdec_sa_8TrieNode_children, __pyx_setprop_8_cdec_sa_8TrieNode_children, 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}, {0, 0, 0, 0, 0} }; @@ -57147,12 +57196,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TrieNode = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_TrieNode = { +static PyTypeObject __pyx_type_3_sa_TrieNode = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.TrieNode"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_TrieNode), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.TrieNode"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_TrieNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_TrieNode, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_TrieNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -57173,15 +57222,15 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieNode = { &__pyx_tp_as_buffer_TrieNode, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_TrieNode, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_TrieNode, /*tp_clear*/ + __pyx_tp_traverse_3_sa_TrieNode, /*tp_traverse*/ + __pyx_tp_clear_3_sa_TrieNode, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_TrieNode, /*tp_methods*/ + __pyx_methods_3_sa_TrieNode, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_8_cdec_sa_TrieNode, /*tp_getset*/ + __pyx_getsets_3_sa_TrieNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -57189,7 +57238,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieNode = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_TrieNode, /*tp_new*/ + __pyx_tp_new_3_sa_TrieNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -57203,32 +57252,32 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieNode = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *p; - PyObject *o = __pyx_tp_new_8_cdec_sa_TrieNode(t, a, k); +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); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)o); + 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 (__pyx_pw_8_cdec_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *p = (struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)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; Py_XDECREF(p->phrase); Py_XDECREF(p->phrase_location); Py_XDECREF(p->suffix_link); - __pyx_tp_dealloc_8_cdec_sa_TrieNode(o); + __pyx_tp_dealloc_3_sa_TrieNode(o); } -static int __pyx_tp_traverse_8_cdec_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *p = (struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)o; - e = __pyx_tp_traverse_8_cdec_sa_TrieNode(o, v, a); if (e) return 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; } @@ -57241,10 +57290,10 @@ static int __pyx_tp_traverse_8_cdec_sa_ExtendedTrieNode(PyObject *o, visitproc v return 0; } -static int __pyx_tp_clear_8_cdec_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *p = (struct __pyx_obj_8_cdec_sa_ExtendedTrieNode *)o; +static int __pyx_tp_clear_3_sa_ExtendedTrieNode(PyObject *o) { + struct __pyx_obj_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_3_sa_ExtendedTrieNode *)o; PyObject* tmp; - __pyx_tp_clear_8_cdec_sa_TrieNode(o); + __pyx_tp_clear_3_sa_TrieNode(o); tmp = ((PyObject*)p->phrase); p->phrase = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -57257,53 +57306,53 @@ static int __pyx_tp_clear_8_cdec_sa_ExtendedTrieNode(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_8_cdec_sa_16ExtendedTrieNode_phrase(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_1__get__(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 int __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); } else { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_6phrase_5__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); } } -static PyObject *__pyx_getprop_8_cdec_sa_16ExtendedTrieNode_phrase_location(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_1__get__(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 int __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); } else { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); } } -static PyObject *__pyx_getprop_8_cdec_sa_16ExtendedTrieNode_suffix_link(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_1__get__(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 int __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); } else { - return __pyx_pw_8_cdec_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); } } -static PyMethodDef __pyx_methods_8_cdec_sa_ExtendedTrieNode[] = { +static PyMethodDef __pyx_methods_3_sa_ExtendedTrieNode[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_8_cdec_sa_ExtendedTrieNode[] = { - {(char *)"phrase", __pyx_getprop_8_cdec_sa_16ExtendedTrieNode_phrase, __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_phrase, 0, 0}, - {(char *)"phrase_location", __pyx_getprop_8_cdec_sa_16ExtendedTrieNode_phrase_location, __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_phrase_location, 0, 0}, - {(char *)"suffix_link", __pyx_getprop_8_cdec_sa_16ExtendedTrieNode_suffix_link, __pyx_setprop_8_cdec_sa_16ExtendedTrieNode_suffix_link, 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}, {0, 0, 0, 0, 0} }; @@ -57405,12 +57454,12 @@ static PyBufferProcs __pyx_tp_as_buffer_ExtendedTrieNode = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_ExtendedTrieNode = { +static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.ExtendedTrieNode"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_ExtendedTrieNode), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.ExtendedTrieNode"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_ExtendedTrieNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_ExtendedTrieNode, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_ExtendedTrieNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -57431,15 +57480,15 @@ static PyTypeObject __pyx_type_8_cdec_sa_ExtendedTrieNode = { &__pyx_tp_as_buffer_ExtendedTrieNode, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_ExtendedTrieNode, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_ExtendedTrieNode, /*tp_clear*/ + __pyx_tp_traverse_3_sa_ExtendedTrieNode, /*tp_traverse*/ + __pyx_tp_clear_3_sa_ExtendedTrieNode, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_ExtendedTrieNode, /*tp_methods*/ + __pyx_methods_3_sa_ExtendedTrieNode, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_8_cdec_sa_ExtendedTrieNode, /*tp_getset*/ + __pyx_getsets_3_sa_ExtendedTrieNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -57447,7 +57496,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_ExtendedTrieNode = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_ExtendedTrieNode, /*tp_new*/ + __pyx_tp_new_3_sa_ExtendedTrieNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -57461,35 +57510,35 @@ static PyTypeObject __pyx_type_8_cdec_sa_ExtendedTrieNode = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_TrieTable *p; +static PyObject *__pyx_tp_new_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_TrieTable *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_TrieTable *)o); + p = ((struct __pyx_obj_3_sa_TrieTable *)o); p->root = Py_None; Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_9TrieTable_1__cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_9TrieTable_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_TrieTable(PyObject *o) { - struct __pyx_obj_8_cdec_sa_TrieTable *p = (struct __pyx_obj_8_cdec_sa_TrieTable *)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; Py_XDECREF(p->root); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_TrieTable(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_TrieTable(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_TrieTable *p = (struct __pyx_obj_8_cdec_sa_TrieTable *)o; + 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; } return 0; } -static int __pyx_tp_clear_8_cdec_sa_TrieTable(PyObject *o) { - struct __pyx_obj_8_cdec_sa_TrieTable *p = (struct __pyx_obj_8_cdec_sa_TrieTable *)o; +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); @@ -57497,13 +57546,13 @@ static int __pyx_tp_clear_8_cdec_sa_TrieTable(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_8_cdec_sa_9TrieTable_extended(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_9TrieTable_8extended_1__get__(o); +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_8_cdec_sa_9TrieTable_extended(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_9TrieTable_8extended_3__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_8extended_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -57511,13 +57560,13 @@ static int __pyx_setprop_8_cdec_sa_9TrieTable_extended(PyObject *o, PyObject *v, } } -static PyObject *__pyx_getprop_8_cdec_sa_9TrieTable_count(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_9TrieTable_5count_1__get__(o); +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_8_cdec_sa_9TrieTable_count(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_9TrieTable_5count_3__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_5count_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -57525,27 +57574,27 @@ static int __pyx_setprop_8_cdec_sa_9TrieTable_count(PyObject *o, PyObject *v, vo } } -static PyObject *__pyx_getprop_8_cdec_sa_9TrieTable_root(PyObject *o, void *x) { - return __pyx_pw_8_cdec_sa_9TrieTable_4root_1__get__(o); +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_8_cdec_sa_9TrieTable_root(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_8_cdec_sa_9TrieTable_4root_3__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_4root_3__set__(o, v); } else { - return __pyx_pw_8_cdec_sa_9TrieTable_4root_5__del__(o); + return __pyx_pw_3_sa_9TrieTable_4root_5__del__(o); } } -static PyMethodDef __pyx_methods_8_cdec_sa_TrieTable[] = { +static PyMethodDef __pyx_methods_3_sa_TrieTable[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_8_cdec_sa_TrieTable[] = { - {(char *)"extended", __pyx_getprop_8_cdec_sa_9TrieTable_extended, __pyx_setprop_8_cdec_sa_9TrieTable_extended, 0, 0}, - {(char *)"count", __pyx_getprop_8_cdec_sa_9TrieTable_count, __pyx_setprop_8_cdec_sa_9TrieTable_count, 0, 0}, - {(char *)"root", __pyx_getprop_8_cdec_sa_9TrieTable_root, __pyx_setprop_8_cdec_sa_9TrieTable_root, 0, 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} }; @@ -57647,12 +57696,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TrieTable = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_TrieTable = { +static PyTypeObject __pyx_type_3_sa_TrieTable = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.TrieTable"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_TrieTable), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.TrieTable"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_TrieTable), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_TrieTable, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_TrieTable, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -57673,15 +57722,15 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieTable = { &__pyx_tp_as_buffer_TrieTable, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_TrieTable, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_TrieTable, /*tp_clear*/ + __pyx_tp_traverse_3_sa_TrieTable, /*tp_traverse*/ + __pyx_tp_clear_3_sa_TrieTable, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_TrieTable, /*tp_methods*/ + __pyx_methods_3_sa_TrieTable, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_8_cdec_sa_TrieTable, /*tp_getset*/ + __pyx_getsets_3_sa_TrieTable, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -57689,7 +57738,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieTable = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_TrieTable, /*tp_new*/ + __pyx_tp_new_3_sa_TrieTable, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -57702,46 +57751,46 @@ static PyTypeObject __pyx_type_8_cdec_sa_TrieTable = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_PhraseLocation __pyx_vtable_8_cdec_sa_PhraseLocation; +static struct __pyx_vtabstruct_3_sa_PhraseLocation __pyx_vtable_3_sa_PhraseLocation; -static PyObject *__pyx_tp_new_8_cdec_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_PhraseLocation *p; +static PyObject *__pyx_tp_new_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_PhraseLocation *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_PhraseLocation *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_PhraseLocation; - p->arr = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_14PhraseLocation_1__cinit__(o, a, k) < 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 (__pyx_pw_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_8_cdec_sa_PhraseLocation *p = (struct __pyx_obj_8_cdec_sa_PhraseLocation *)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; Py_XDECREF(((PyObject *)p->arr)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_PhraseLocation *p = (struct __pyx_obj_8_cdec_sa_PhraseLocation *)o; + 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_8_cdec_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_8_cdec_sa_PhraseLocation *p = (struct __pyx_obj_8_cdec_sa_PhraseLocation *)o; +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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->arr = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_PhraseLocation[] = { +static PyMethodDef __pyx_methods_3_sa_PhraseLocation[] = { {0, 0, 0, 0} }; @@ -57843,12 +57892,12 @@ static PyBufferProcs __pyx_tp_as_buffer_PhraseLocation = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_PhraseLocation = { +static PyTypeObject __pyx_type_3_sa_PhraseLocation = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.PhraseLocation"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_PhraseLocation), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.PhraseLocation"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_PhraseLocation), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_PhraseLocation, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_PhraseLocation, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -57869,13 +57918,13 @@ static PyTypeObject __pyx_type_8_cdec_sa_PhraseLocation = { &__pyx_tp_as_buffer_PhraseLocation, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa_PhraseLocation, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_PhraseLocation, /*tp_clear*/ + __pyx_tp_traverse_3_sa_PhraseLocation, /*tp_traverse*/ + __pyx_tp_clear_3_sa_PhraseLocation, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_PhraseLocation, /*tp_methods*/ + __pyx_methods_3_sa_PhraseLocation, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -57885,7 +57934,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_PhraseLocation = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_PhraseLocation, /*tp_new*/ + __pyx_tp_new_3_sa_PhraseLocation, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -57899,44 +57948,44 @@ static PyTypeObject __pyx_type_8_cdec_sa_PhraseLocation = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_Sampler *p; +static PyObject *__pyx_tp_new_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_Sampler *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_Sampler *)o); - p->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_7Sampler_1__cinit__(o, a, k) < 0) { + p = ((struct __pyx_obj_3_sa_Sampler *)o); + p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (__pyx_pw_3_sa_7Sampler_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_Sampler(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Sampler *p = (struct __pyx_obj_8_cdec_sa_Sampler *)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; Py_XDECREF(((PyObject *)p->sa)); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_Sampler(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_Sampler(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_Sampler *p = (struct __pyx_obj_8_cdec_sa_Sampler *)o; + 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; } return 0; } -static int __pyx_tp_clear_8_cdec_sa_Sampler(PyObject *o) { - struct __pyx_obj_8_cdec_sa_Sampler *p = (struct __pyx_obj_8_cdec_sa_Sampler *)o; +static int __pyx_tp_clear_3_sa_Sampler(PyObject *o) { + struct __pyx_obj_3_sa_Sampler *p = (struct __pyx_obj_3_sa_Sampler *)o; PyObject* tmp; tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_Sampler[] = { - {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_8_cdec_sa_7Sampler_3sample, METH_O, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_7Sampler_2sample)}, +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)}, {0, 0, 0, 0} }; @@ -58038,12 +58087,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Sampler = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_Sampler = { +static PyTypeObject __pyx_type_3_sa_Sampler = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.Sampler"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_Sampler), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.Sampler"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_Sampler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_Sampler, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_Sampler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58064,13 +58113,13 @@ static PyTypeObject __pyx_type_8_cdec_sa_Sampler = { &__pyx_tp_as_buffer_Sampler, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|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_8_cdec_sa_Sampler, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_Sampler, /*tp_clear*/ + __pyx_tp_traverse_3_sa_Sampler, /*tp_traverse*/ + __pyx_tp_clear_3_sa_Sampler, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_Sampler, /*tp_methods*/ + __pyx_methods_3_sa_Sampler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58080,7 +58129,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_Sampler = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_Sampler, /*tp_new*/ + __pyx_tp_new_3_sa_Sampler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58093,37 +58142,37 @@ static PyTypeObject __pyx_type_8_cdec_sa_Sampler = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_8_cdec_sa_HieroCachingRuleFactory __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory; +static struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory __pyx_vtable_3_sa_HieroCachingRuleFactory; -static PyObject *__pyx_tp_new_8_cdec_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *p; +static PyObject *__pyx_tp_new_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_3_sa_HieroCachingRuleFactory *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)o); - p->__pyx_vtab = __pyx_vtabptr_8_cdec_sa_HieroCachingRuleFactory; - p->rules = ((struct __pyx_obj_8_cdec_sa_TrieTable *)Py_None); Py_INCREF(Py_None); - p->sampler = ((struct __pyx_obj_8_cdec_sa_Sampler *)Py_None); Py_INCREF(Py_None); + 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->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_8_cdec_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->fda = ((struct __pyx_obj_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->eda = ((struct __pyx_obj_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->alignment = ((struct __pyx_obj_8_cdec_sa_Alignment *)Py_None); Py_INCREF(Py_None); - p->eid2symid = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->fid2symid = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes1 = ((struct __pyx_obj_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0) { + 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); + if (__pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_8_cdec_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)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; Py_XDECREF(((PyObject *)p->rules)); Py_XDECREF(((PyObject *)p->sampler)); Py_XDECREF(p->precomputed_index); @@ -58142,9 +58191,9 @@ static void __pyx_tp_dealloc_8_cdec_sa_HieroCachingRuleFactory(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)o; + 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; } @@ -58193,14 +58242,14 @@ static int __pyx_tp_traverse_8_cdec_sa_HieroCachingRuleFactory(PyObject *o, visi return 0; } -static int __pyx_tp_clear_8_cdec_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)o; +static int __pyx_tp_clear_3_sa_HieroCachingRuleFactory(PyObject *o) { + struct __pyx_obj_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o; PyObject* tmp; tmp = ((PyObject*)p->rules); - p->rules = ((struct __pyx_obj_8_cdec_sa_TrieTable *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_Sampler *)Py_None); Py_INCREF(Py_None); + p->sampler = ((struct __pyx_obj_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->precomputed_index); p->precomputed_index = Py_None; Py_INCREF(Py_None); @@ -58218,44 +58267,44 @@ static int __pyx_tp_clear_8_cdec_sa_HieroCachingRuleFactory(PyObject *o) { p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->fsa); - p->fsa = ((struct __pyx_obj_8_cdec_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_DataArray *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_Alignment *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->findexes1 = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa_HieroCachingRuleFactory[] = { - {__Pyx_NAMESTR("configure"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_3configure, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_23HieroCachingRuleFactory_2configure)}, - {__Pyx_NAMESTR("pattern2phrase"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_5pattern2phrase, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("pattern2phrase_plus"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_7pattern2phrase_plus, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_9precompute, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_precomputed_collocation"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_11get_precomputed_collocation, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("advance"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_13advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_all_nodes_isteps_away"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reachable"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_17reachable, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("shortest"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_19shortest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pw_8_cdec_sa_23HieroCachingRuleFactory_23input, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8_cdec_sa_23HieroCachingRuleFactory_22input)}, +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)}, {0, 0, 0, 0} }; @@ -58357,12 +58406,12 @@ static PyBufferProcs __pyx_tp_as_buffer_HieroCachingRuleFactory = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa_HieroCachingRuleFactory = { +static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.HieroCachingRuleFactory"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.HieroCachingRuleFactory"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa_HieroCachingRuleFactory, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa_HieroCachingRuleFactory, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58383,13 +58432,13 @@ static PyTypeObject __pyx_type_8_cdec_sa_HieroCachingRuleFactory = { &__pyx_tp_as_buffer_HieroCachingRuleFactory, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|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_8_cdec_sa_HieroCachingRuleFactory, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa_HieroCachingRuleFactory, /*tp_clear*/ + __pyx_tp_traverse_3_sa_HieroCachingRuleFactory, /*tp_traverse*/ + __pyx_tp_clear_3_sa_HieroCachingRuleFactory, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa_HieroCachingRuleFactory, /*tp_methods*/ + __pyx_methods_3_sa_HieroCachingRuleFactory, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58399,7 +58448,7 @@ static PyTypeObject __pyx_type_8_cdec_sa_HieroCachingRuleFactory = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa_HieroCachingRuleFactory, /*tp_new*/ + __pyx_tp_new_3_sa_HieroCachingRuleFactory, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58413,11 +58462,11 @@ static PyTypeObject __pyx_type_8_cdec_sa_HieroCachingRuleFactory = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa___pyx_scope_struct__compute_stats(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct__compute_stats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *)o); p->__pyx_v_ngram = 0; p->__pyx_v_ngram_start = 0; p->__pyx_v_ngram_starts = 0; @@ -58427,8 +58476,8 @@ static PyObject *__pyx_tp_new_8_cdec_sa___pyx_scope_struct__compute_stats(PyType return o; } -static void __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct__compute_stats(PyObject *o) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *)o; +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct__compute_stats(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *)o; Py_XDECREF(((PyObject *)p->__pyx_v_ngram)); Py_XDECREF(((PyObject *)p->__pyx_v_ngram_start)); Py_XDECREF(((PyObject *)p->__pyx_v_ngram_starts)); @@ -58438,9 +58487,9 @@ static void __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct__compute_stats(PyObjec (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct__compute_stats(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct__compute_stats(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *)o; + struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *)o; if (p->__pyx_v_ngram) { e = (*v)(p->__pyx_v_ngram, a); if (e) return e; } @@ -58462,31 +58511,31 @@ static int __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct__compute_stats(PyObjec return 0; } -static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct__compute_stats(PyObject *o) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct__compute_stats(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct__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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_run_start = ((struct __pyx_obj_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_8_cdec_sa_LCP *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_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_8_cdec_sa_VEB *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_cdec_sa___pyx_scope_struct__compute_stats[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct__compute_stats[] = { {0, 0, 0, 0} }; @@ -58588,12 +58637,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__compute_stats = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct__compute_stats = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.__pyx_scope_struct__compute_stats"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa___pyx_scope_struct__compute_stats), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct__compute_stats"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct__compute_stats), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct__compute_stats, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct__compute_stats, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58614,13 +58663,204 @@ static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats = { &__pyx_tp_as_buffer___pyx_scope_struct__compute_stats, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct__compute_stats, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa___pyx_scope_struct__compute_stats, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct__compute_stats, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct__compute_stats, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct__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_3_sa___pyx_scope_struct__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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *)o); + p->__pyx_v_self = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_1___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *)o; + Py_XDECREF(((PyObject *)p->__pyx_v_self)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_3_sa___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_3_sa___pyx_scope_struct_1___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__ *)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); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_1___iter__[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1___iter__ = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1___iter__ = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1___iter__ = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1___iter__ = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1___iter__ = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_1___iter__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1___iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_1___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*/ + &__pyx_tp_as_number___pyx_scope_struct_1___iter__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_1___iter__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_1___iter__, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_1___iter__, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_1___iter__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_1___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa___pyx_scope_struct__compute_stats, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_1___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58630,7 +58870,7 @@ static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa___pyx_scope_struct__compute_stats, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_1___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58644,11 +58884,11 @@ static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats = { #endif }; -static PyObject *__pyx_tp_new_8_cdec_sa___pyx_scope_struct_1_input(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_2_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_input *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)o); p->__pyx_v_alignment = 0; p->__pyx_v_als = 0; p->__pyx_v_alslist = 0; @@ -58690,21 +58930,20 @@ static PyObject *__pyx_tp_new_8_cdec_sa___pyx_scope_struct_1_input(PyTypeObject p->__pyx_v_self = 0; p->__pyx_v_spanlen = 0; p->__pyx_v_stop_time = 0; - p->__pyx_v_str_phrase = 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_2 = 0; - p->__pyx_t_3 = 0; + p->__pyx_t_1 = 0; p->__pyx_t_4 = 0; + p->__pyx_t_5 = 0; return o; } -static void __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *)o; +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_input(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)o; Py_XDECREF(p->__pyx_v_alignment); Py_XDECREF(p->__pyx_v_als); Py_XDECREF(p->__pyx_v_alslist); @@ -58746,22 +58985,21 @@ static void __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { Py_XDECREF(((PyObject *)p->__pyx_v_self)); Py_XDECREF(p->__pyx_v_spanlen); Py_XDECREF(p->__pyx_v_stop_time); - Py_XDECREF(p->__pyx_v_str_phrase); Py_XDECREF(p->__pyx_v_suffix_link); Py_XDECREF(p->__pyx_v_suffix_link_xcat_index); Py_XDECREF(p->__pyx_v_word_id); Py_XDECREF(p->__pyx_v_xcat_index); Py_XDECREF(p->__pyx_v_xnode); Py_XDECREF(p->__pyx_v_xroot); - Py_XDECREF(p->__pyx_t_2); - Py_XDECREF(p->__pyx_t_3); + Py_XDECREF(p->__pyx_t_1); Py_XDECREF(p->__pyx_t_4); + Py_XDECREF(p->__pyx_t_5); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_input(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *)o; + struct __pyx_obj_3_sa___pyx_scope_struct_2_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)o; if (p->__pyx_v_alignment) { e = (*v)(p->__pyx_v_alignment, a); if (e) return e; } @@ -58885,9 +59123,6 @@ static int __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o, v if (p->__pyx_v_stop_time) { e = (*v)(p->__pyx_v_stop_time, a); if (e) return e; } - if (p->__pyx_v_str_phrase) { - e = (*v)(p->__pyx_v_str_phrase, a); if (e) return e; - } if (p->__pyx_v_suffix_link) { e = (*v)(p->__pyx_v_suffix_link, a); if (e) return e; } @@ -58906,20 +59141,20 @@ static int __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o, v if (p->__pyx_v_xroot) { e = (*v)(p->__pyx_v_xroot, a); if (e) return e; } - if (p->__pyx_t_2) { - e = (*v)(p->__pyx_t_2, 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_1) { + e = (*v)(p->__pyx_t_1, 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_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { - struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *p = (struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_input(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_input *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_alignment); p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None); @@ -58931,7 +59166,7 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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); @@ -58982,7 +59217,7 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { p->__pyx_v_fwords = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_hiero_phrase); - p->__pyx_v_hiero_phrase = ((struct __pyx_obj_8_cdec_sa_Phrase *)Py_None); Py_INCREF(Py_None); + 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_is_shadow_path); p->__pyx_v_is_shadow_path = Py_None; Py_INCREF(Py_None); @@ -59018,7 +59253,7 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { 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_8_cdec_sa_PhraseLocation *)Py_None); Py_INCREF(Py_None); + 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); @@ -59030,13 +59265,13 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { 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_8_cdec_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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 = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + 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); @@ -59044,9 +59279,6 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { 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_str_phrase); - p->__pyx_v_str_phrase = 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); @@ -59065,23 +59297,23 @@ static int __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input(PyObject *o) { tmp = ((PyObject*)p->__pyx_v_xroot); p->__pyx_v_xroot = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_2); - p->__pyx_t_2 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_3); - p->__pyx_t_3 = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_t_1); + p->__pyx_t_1 = 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_8_cdec_sa___pyx_scope_struct_1_input[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_2_input[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_input = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_input = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59139,7 +59371,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_input = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_input = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_input = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59152,13 +59384,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_input = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1_input = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_2_input = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_input = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_input = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59179,12 +59411,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_input = { #endif }; -static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct_1_input = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_input = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec_sa.__pyx_scope_struct_1_input"), /*tp_name*/ - sizeof(struct __pyx_obj_8_cdec_sa___pyx_scope_struct_1_input), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_2_input"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_input), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_cdec_sa___pyx_scope_struct_1_input, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_input, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59194,24 +59426,24 @@ static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct_1_input = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_1_input, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_1_input, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_1_input, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_2_input, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_2_input, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_2_input, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_1_input, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_2_input, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_cdec_sa___pyx_scope_struct_1_input, /*tp_traverse*/ - __pyx_tp_clear_8_cdec_sa___pyx_scope_struct_1_input, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_2_input, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_2_input, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_cdec_sa___pyx_scope_struct_1_input, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_2_input, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59221,7 +59453,7 @@ static PyTypeObject __pyx_type_8_cdec_sa___pyx_scope_struct_1_input = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_cdec_sa___pyx_scope_struct_1_input, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_2_input, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59242,7 +59474,7 @@ static PyMethodDef __pyx_methods[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("_cdec_sa"), + __Pyx_NAMESTR("_sa"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -59288,7 +59520,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 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_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, @@ -59356,9 +59588,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___cdec_sa, __pyx_k___cdec_sa, sizeof(__pyx_k___cdec_sa), 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__advance, __pyx_k__advance, sizeof(__pyx_k__advance), 0, 0, 1, 1}, {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1}, {&__pyx_n_s__alphabet_size, __pyx_k__alphabet_size, sizeof(__pyx_k__alphabet_size), 0, 0, 1, 1}, @@ -59484,10 +59716,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1}, {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 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__sym_fromstring, __pyx_k__sym_fromstring, sizeof(__pyx_k__sym_fromstring), 0, 0, 1, 1}, - {&__pyx_n_s__sym_isvar, __pyx_k__sym_isvar, sizeof(__pyx_k__sym_isvar), 0, 0, 1, 1}, - {&__pyx_n_s__sym_tostring, __pyx_k__sym_tostring, sizeof(__pyx_k__sym_tostring), 0, 0, 1, 1}, {&__pyx_n_s__terminal, __pyx_k__terminal, sizeof(__pyx_k__terminal), 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}, @@ -59517,8 +59746,8 @@ static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __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_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_cmp = __Pyx_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; @@ -60052,7 +60281,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef float start_time = monitor_cpu() * */ - __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_71); __Pyx_INCREF(((PyObject *)__pyx_kp_s_70)); PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_kp_s_70)); @@ -60066,7 +60295,7 @@ static int __Pyx_InitCachedConstants(void) { * N = len(data) * for i from 0 <= i < N: */ - __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_73); __Pyx_INCREF(((PyObject *)__pyx_kp_s_72)); PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_72)); @@ -60080,7 +60309,7 @@ static int __Pyx_InitCachedConstants(void) { * N = len(queue) * ptr1 = 0 */ - __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_75); __Pyx_INCREF(((PyObject *)__pyx_kp_s_74)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_74)); @@ -60094,7 +60323,7 @@ static int __Pyx_InitCachedConstants(void) { * J2_set.add(combined_pattern) * */ - __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_77); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, __pyx_int_neg_1); @@ -60108,7 +60337,7 @@ static int __Pyx_InitCachedConstants(void) { * IJ_set.add(combined_pattern) * */ - __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_78); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, __pyx_int_neg_1); @@ -60122,7 +60351,7 @@ static int __Pyx_InitCachedConstants(void) { * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 */ - __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_79); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, __pyx_int_neg_1); @@ -60136,7 +60365,7 @@ static int __Pyx_InitCachedConstants(void) { * IJ_set.add(combined_pattern) * */ - __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_80); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, __pyx_int_neg_1); @@ -60150,7 +60379,7 @@ static int __Pyx_InitCachedConstants(void) { * for i from 0 <= i < N: * j = isa.arr[i] */ - __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_91); __Pyx_INCREF(((PyObject *)__pyx_kp_s_90)); PyTuple_SET_ITEM(__pyx_k_tuple_91, 0, ((PyObject *)__pyx_kp_s_90)); @@ -60164,7 +60393,7 @@ static int __Pyx_InitCachedConstants(void) { * for w_i in self.ha: * f.write("%d " % w_i) */ - __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_94); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_14)); @@ -60178,7 +60407,7 @@ static int __Pyx_InitCachedConstants(void) { * * cdef int __search_high(self, int word_id, int offset, int low, int high): */ - __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_95); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_14)); @@ -60192,7 +60421,7 @@ static int __Pyx_InitCachedConstants(void) { * self.darray.write_enhanced_handle(f) * for a_i in self.sa: */ - __pyx_k_tuple_96 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_96 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_96); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, Py_None); @@ -60233,21 +60462,21 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_104)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1005 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1004 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< * # checking whether lookup_required * if lookup_required: */ - __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_120); __Pyx_INCREF(((PyObject *)__pyx_kp_s_119)); PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120)); - /* "_cdec_sa.pyx":9 + /* "_sa.pyx":9 * resource.getrusage(resource.RUSAGE_SELF).ru_stime) * * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< @@ -60265,7 +60494,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132)); __pyx_k_codeobj_133 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_cdec_sa.pyx":15 + /* "_sa.pyx":15 * return open(filename) * * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< @@ -60279,59 +60508,22 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_135)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":91 - * cdef Alphabet ALPHABET = Alphabet() - * - * def sym_tostring(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.tostring(sym) - * - */ - __pyx_k_tuple_137 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_137); - __Pyx_INCREF(((PyObject *)__pyx_n_s__sym)); - PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sym)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__sym)); - PyTuple_SET_ITEM(__pyx_k_tuple_137, 1, ((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137)); - __pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_139, __pyx_n_s__sym_tostring, 91, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":94 - * return ALPHABET.tostring(sym) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104 + * return ALPHABET.setindex(sym, id) * * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<< * return ALPHABET.fromstring(string, terminal) - * */ - __pyx_k_tuple_140 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_140); + __pyx_k_tuple_137 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_137); __Pyx_INCREF(((PyObject *)__pyx_n_s__string)); - PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_n_s__string)); + PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_n_s__string)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__string)); __Pyx_INCREF(((PyObject *)__pyx_n_s__terminal)); - PyTuple_SET_ITEM(__pyx_k_tuple_140, 1, ((PyObject *)__pyx_n_s__terminal)); + PyTuple_SET_ITEM(__pyx_k_tuple_137, 1, ((PyObject *)__pyx_n_s__terminal)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__terminal)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140)); - __pyx_k_codeobj_141 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_139, __pyx_n_s__sym_fromstring, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_141)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":97 - * return ALPHABET.fromstring(string, terminal) - * - * def sym_isvar(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.isvar(sym) - * - */ - __pyx_k_tuple_142 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_142); - __Pyx_INCREF(((PyObject *)__pyx_n_s__sym)); - PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sym)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__sym)); - PyTuple_SET_ITEM(__pyx_k_tuple_142, 1, ((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); - __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_139, __pyx_n_s__sym_isvar, 97, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137)); + __pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_139, __pyx_n_s__sym_fromstring, 104, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -60356,11 +60548,11 @@ static int __Pyx_InitGlobals(void) { } #if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC init_cdec_sa(void); /*proto*/ -PyMODINIT_FUNC init_cdec_sa(void) +PyMODINIT_FUNC init_sa(void); /*proto*/ +PyMODINIT_FUNC init_sa(void) #else -PyMODINIT_FUNC PyInit__cdec_sa(void); /*proto*/ -PyMODINIT_FUNC PyInit__cdec_sa(void) +PyMODINIT_FUNC PyInit__sa(void); /*proto*/ +PyMODINIT_FUNC PyInit__sa(void) #endif { PyObject *__pyx_t_1 = NULL; @@ -60377,7 +60569,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__cdec_sa(void)", 0); + __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;} @@ -60399,7 +60591,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_cdec_sa"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_sa"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -60409,10 +60601,13 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__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 (__pyx_module_is_main__cdec_sa) { + if (__pyx_module_is_main__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 ---*/ @@ -60420,180 +60615,186 @@ PyMODINIT_FUNC PyInit__cdec_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_8_cdec_sa_ALPHABET = ((struct __pyx_obj_8_cdec_sa_Alphabet *)Py_None); Py_INCREF(Py_None); + __pyx_v_3_sa_ALPHABET = ((struct __pyx_obj_3_sa_Alphabet *)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;} /*--- Type init code ---*/ - __pyx_vtabptr_8_cdec_sa_FloatList = &__pyx_vtable_8_cdec_sa_FloatList; - __pyx_vtable_8_cdec_sa_FloatList.set = (void (*)(struct __pyx_obj_8_cdec_sa_FloatList *, int, float))__pyx_f_8_cdec_sa_9FloatList_set; - __pyx_vtable_8_cdec_sa_FloatList.write_handle = (void (*)(struct __pyx_obj_8_cdec_sa_FloatList *, FILE *))__pyx_f_8_cdec_sa_9FloatList_write_handle; - __pyx_vtable_8_cdec_sa_FloatList.read_handle = (void (*)(struct __pyx_obj_8_cdec_sa_FloatList *, FILE *))__pyx_f_8_cdec_sa_9FloatList_read_handle; - if (PyType_Ready(&__pyx_type_8_cdec_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_FloatList.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_FloatList = &__pyx_type_8_cdec_sa_FloatList; - __pyx_vtabptr_8_cdec_sa_IntList = &__pyx_vtable_8_cdec_sa_IntList; - __pyx_vtable_8_cdec_sa_IntList.set = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, int, int))__pyx_f_8_cdec_sa_7IntList_set; - __pyx_vtable_8_cdec_sa_IntList._append = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, int))__pyx_f_8_cdec_sa_7IntList__append; - __pyx_vtable_8_cdec_sa_IntList._extend = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, struct __pyx_obj_8_cdec_sa_IntList *))__pyx_f_8_cdec_sa_7IntList__extend; - __pyx_vtable_8_cdec_sa_IntList._extend_arr = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, int *, int))__pyx_f_8_cdec_sa_7IntList__extend_arr; - __pyx_vtable_8_cdec_sa_IntList._clear = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *))__pyx_f_8_cdec_sa_7IntList__clear; - __pyx_vtable_8_cdec_sa_IntList.write_handle = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, FILE *))__pyx_f_8_cdec_sa_7IntList_write_handle; - __pyx_vtable_8_cdec_sa_IntList.read_handle = (void (*)(struct __pyx_obj_8_cdec_sa_IntList *, FILE *))__pyx_f_8_cdec_sa_7IntList_read_handle; - if (PyType_Ready(&__pyx_type_8_cdec_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_IntList.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_IntList = &__pyx_type_8_cdec_sa_IntList; - __pyx_vtabptr_8_cdec_sa_StringMap = &__pyx_vtable_8_cdec_sa_StringMap; - __pyx_vtable_8_cdec_sa_StringMap.word = (char *(*)(struct __pyx_obj_8_cdec_sa_StringMap *, int))__pyx_f_8_cdec_sa_9StringMap_word; - __pyx_vtable_8_cdec_sa_StringMap.index = (int (*)(struct __pyx_obj_8_cdec_sa_StringMap *, char *))__pyx_f_8_cdec_sa_9StringMap_index; - if (PyType_Ready(&__pyx_type_8_cdec_sa_StringMap) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_StringMap.tp_dict, __pyx_vtabptr_8_cdec_sa_StringMap) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "StringMap", (PyObject *)&__pyx_type_8_cdec_sa_StringMap) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_StringMap = &__pyx_type_8_cdec_sa_StringMap; - __pyx_vtabptr_8_cdec_sa_DataArray = &__pyx_vtable_8_cdec_sa_DataArray; - __pyx_vtable_8_cdec_sa_DataArray.read_handle = (void (*)(struct __pyx_obj_8_cdec_sa_DataArray *, FILE *))__pyx_f_8_cdec_sa_9DataArray_read_handle; - __pyx_vtable_8_cdec_sa_DataArray.write_handle = (void (*)(struct __pyx_obj_8_cdec_sa_DataArray *, FILE *))__pyx_f_8_cdec_sa_9DataArray_write_handle; - if (PyType_Ready(&__pyx_type_8_cdec_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_DataArray.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_DataArray = &__pyx_type_8_cdec_sa_DataArray; - __pyx_vtabptr_8_cdec_sa_Alignment = &__pyx_vtable_8_cdec_sa_Alignment; - __pyx_vtable_8_cdec_sa_Alignment.link = (int (*)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int))__pyx_f_8_cdec_sa_9Alignment_link; - __pyx_vtable_8_cdec_sa_Alignment._unlink = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int *, int *))__pyx_f_8_cdec_sa_9Alignment__unlink; - __pyx_vtable_8_cdec_sa_Alignment._get_sent_links = (int *(*)(struct __pyx_obj_8_cdec_sa_Alignment *, int, int *))__pyx_f_8_cdec_sa_9Alignment__get_sent_links; - if (PyType_Ready(&__pyx_type_8_cdec_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_Alignment.tp_dict, __pyx_vtabptr_8_cdec_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Alignment", (PyObject *)&__pyx_type_8_cdec_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Alignment = &__pyx_type_8_cdec_sa_Alignment; - __pyx_vtabptr_8_cdec_sa_BiLex = &__pyx_vtable_8_cdec_sa_BiLex; - __pyx_vtable_8_cdec_sa_BiLex.compute_from_data = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, struct __pyx_obj_8_cdec_sa_SuffixArray *, struct __pyx_obj_8_cdec_sa_DataArray *, struct __pyx_obj_8_cdec_sa_Alignment *))__pyx_f_8_cdec_sa_5BiLex_compute_from_data; - __pyx_vtable_8_cdec_sa_BiLex._add_node = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, struct __pyx_t_8_cdec_sa__node *, int *, float, int *))__pyx_f_8_cdec_sa_5BiLex__add_node; - __pyx_vtable_8_cdec_sa_BiLex.write_wordlist = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, PyObject *, FILE *))__pyx_f_8_cdec_sa_5BiLex_write_wordlist; - __pyx_vtable_8_cdec_sa_BiLex.read_wordlist = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, PyObject *, PyObject *, FILE *))__pyx_f_8_cdec_sa_5BiLex_read_wordlist; - __pyx_vtable_8_cdec_sa_BiLex.swap = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, int, int))__pyx_f_8_cdec_sa_5BiLex_swap; - __pyx_vtable_8_cdec_sa_BiLex.qsort = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_BiLex *, int, int, PyObject *))__pyx_f_8_cdec_sa_5BiLex_qsort; - if (PyType_Ready(&__pyx_type_8_cdec_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_BiLex.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_BiLex = &__pyx_type_8_cdec_sa_BiLex; - if (PyType_Ready(&__pyx_type_8_cdec_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_8_cdec_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_BitSetIterator = &__pyx_type_8_cdec_sa_BitSetIterator; - if (PyType_Ready(&__pyx_type_8_cdec_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_8_cdec_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_BitSet = &__pyx_type_8_cdec_sa_BitSet; - if (PyType_Ready(&__pyx_type_8_cdec_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_8_cdec_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_VEBIterator = &__pyx_type_8_cdec_sa_VEBIterator; - __pyx_vtabptr_8_cdec_sa_VEB = &__pyx_vtable_8_cdec_sa_VEB; - __pyx_vtable_8_cdec_sa_VEB._findsucc = (int (*)(struct __pyx_obj_8_cdec_sa_VEB *, int))__pyx_f_8_cdec_sa_3VEB__findsucc; - __pyx_vtable_8_cdec_sa_VEB._insert = (int (*)(struct __pyx_obj_8_cdec_sa_VEB *, int))__pyx_f_8_cdec_sa_3VEB__insert; - __pyx_vtable_8_cdec_sa_VEB._first = (int (*)(struct __pyx_obj_8_cdec_sa_VEB *))__pyx_f_8_cdec_sa_3VEB__first; - if (PyType_Ready(&__pyx_type_8_cdec_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_VEB.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_VEB = &__pyx_type_8_cdec_sa_VEB; - if (PyType_Ready(&__pyx_type_8_cdec_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_8_cdec_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_LCP = &__pyx_type_8_cdec_sa_LCP; - __pyx_vtabptr_8_cdec_sa_Alphabet = &__pyx_vtable_8_cdec_sa_Alphabet; - __pyx_vtable_8_cdec_sa_Alphabet.isvar = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_isvar; - __pyx_vtable_8_cdec_sa_Alphabet.isword = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_isword; - __pyx_vtable_8_cdec_sa_Alphabet.getindex = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_getindex; - __pyx_vtable_8_cdec_sa_Alphabet.setindex = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int, int))__pyx_f_8_cdec_sa_8Alphabet_setindex; - __pyx_vtable_8_cdec_sa_Alphabet.clearindex = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_clearindex; - __pyx_vtable_8_cdec_sa_Alphabet.match = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int, int))__pyx_f_8_cdec_sa_8Alphabet_match; - __pyx_vtable_8_cdec_sa_Alphabet.tocat = (char *(*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_tocat; - __pyx_vtable_8_cdec_sa_Alphabet.fromcat = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, char *))__pyx_f_8_cdec_sa_8Alphabet_fromcat; - __pyx_vtable_8_cdec_sa_Alphabet.tostring = (char *(*)(struct __pyx_obj_8_cdec_sa_Alphabet *, int))__pyx_f_8_cdec_sa_8Alphabet_tostring; - __pyx_vtable_8_cdec_sa_Alphabet.fromstring = (int (*)(struct __pyx_obj_8_cdec_sa_Alphabet *, char *, int))__pyx_f_8_cdec_sa_8Alphabet_fromstring; - if (PyType_Ready(&__pyx_type_8_cdec_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_Alphabet.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Alphabet = &__pyx_type_8_cdec_sa_Alphabet; - __pyx_vtabptr_8_cdec_sa_Phrase = &__pyx_vtable_8_cdec_sa_Phrase; - __pyx_vtable_8_cdec_sa_Phrase.chunkpos = (int (*)(struct __pyx_obj_8_cdec_sa_Phrase *, int))__pyx_f_8_cdec_sa_6Phrase_chunkpos; - __pyx_vtable_8_cdec_sa_Phrase.chunklen = (int (*)(struct __pyx_obj_8_cdec_sa_Phrase *, int))__pyx_f_8_cdec_sa_6Phrase_chunklen; - if (PyType_Ready(&__pyx_type_8_cdec_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_Phrase.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Phrase = &__pyx_type_8_cdec_sa_Phrase; - if (PyType_Ready(&__pyx_type_8_cdec_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_8_cdec_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Rule = &__pyx_type_8_cdec_sa_Rule; - __pyx_vtabptr_8_cdec_sa_TrieMap = &__pyx_vtable_8_cdec_sa_TrieMap; - __pyx_vtable_8_cdec_sa_TrieMap._insert = (struct __pyx_t_8_cdec_sa__Trie_Node *(*)(struct __pyx_obj_8_cdec_sa_TrieMap *, int *, int))__pyx_f_8_cdec_sa_7TrieMap__insert; - __pyx_vtable_8_cdec_sa_TrieMap._contains = (struct __pyx_t_8_cdec_sa__Trie_Node *(*)(struct __pyx_obj_8_cdec_sa_TrieMap *, int *, int))__pyx_f_8_cdec_sa_7TrieMap__contains; - if (PyType_Ready(&__pyx_type_8_cdec_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_TrieMap.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_TrieMap = &__pyx_type_8_cdec_sa_TrieMap; - __pyx_vtabptr_8_cdec_sa_Precomputation = &__pyx_vtable_8_cdec_sa_Precomputation; - __pyx_vtable_8_cdec_sa_Precomputation.read_map = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_Precomputation *, FILE *))__pyx_f_8_cdec_sa_14Precomputation_read_map; - __pyx_vtable_8_cdec_sa_Precomputation.write_map = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_Precomputation *, PyObject *, FILE *))__pyx_f_8_cdec_sa_14Precomputation_write_map; - if (PyType_Ready(&__pyx_type_8_cdec_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_Precomputation.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Precomputation = &__pyx_type_8_cdec_sa_Precomputation; - __pyx_vtabptr_8_cdec_sa_SuffixArray = &__pyx_vtable_8_cdec_sa_SuffixArray; - __pyx_vtable_8_cdec_sa_SuffixArray.__pyx___search_high = (int (*)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int))__pyx_f_8_cdec_sa_11SuffixArray___search_high; - __pyx_vtable_8_cdec_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int))__pyx_f_8_cdec_sa_11SuffixArray___search_low; - __pyx_vtable_8_cdec_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int, int))__pyx_f_8_cdec_sa_11SuffixArray___get_range; - __pyx_vtable_8_cdec_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_SuffixArray *, int, int, int, int))__pyx_f_8_cdec_sa_11SuffixArray___lookup_helper; - if (PyType_Ready(&__pyx_type_8_cdec_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_SuffixArray.tp_dict, __pyx_vtabptr_8_cdec_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_8_cdec_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_SuffixArray = &__pyx_type_8_cdec_sa_SuffixArray; - if (PyType_Ready(&__pyx_type_8_cdec_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_8_cdec_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_TrieNode = &__pyx_type_8_cdec_sa_TrieNode; - __pyx_type_8_cdec_sa_ExtendedTrieNode.tp_base = __pyx_ptype_8_cdec_sa_TrieNode; - if (PyType_Ready(&__pyx_type_8_cdec_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_8_cdec_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_ExtendedTrieNode = &__pyx_type_8_cdec_sa_ExtendedTrieNode; - if (PyType_Ready(&__pyx_type_8_cdec_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_8_cdec_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_TrieTable = &__pyx_type_8_cdec_sa_TrieTable; - __pyx_vtabptr_8_cdec_sa_PhraseLocation = &__pyx_vtable_8_cdec_sa_PhraseLocation; - __pyx_vtable_8_cdec_sa_PhraseLocation.contains = (int (*)(struct __pyx_obj_8_cdec_sa_PhraseLocation *, int))__pyx_f_8_cdec_sa_14PhraseLocation_contains; - if (PyType_Ready(&__pyx_type_8_cdec_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_PhraseLocation.tp_dict, __pyx_vtabptr_8_cdec_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PhraseLocation", (PyObject *)&__pyx_type_8_cdec_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_PhraseLocation = &__pyx_type_8_cdec_sa_PhraseLocation; - if (PyType_Ready(&__pyx_type_8_cdec_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_8_cdec_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_Sampler = &__pyx_type_8_cdec_sa_Sampler; - __pyx_vtabptr_8_cdec_sa_HieroCachingRuleFactory = &__pyx_vtable_8_cdec_sa_HieroCachingRuleFactory; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.set_idmap = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_DataArray *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_set_idmap; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.baeza_yates_helper = (int *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_baeza_yates_helper; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.compare_matchings_set = (long (*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_8_cdec_sa_Matching *, int, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings_set; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.compare_matchings = (long (*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_t_8_cdec_sa_Matching *, struct __pyx_t_8_cdec_sa_Matching *, int, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_compare_matchings; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.merge_helper = (int *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_merge_helper; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.sort_phrase_loc = (void (*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_IntList *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, struct __pyx_obj_8_cdec_sa_Phrase *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_sort_phrase_loc; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.intersect_helper = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, struct __pyx_obj_8_cdec_sa_PhraseLocation *, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect_helper; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.loc2str = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_PhraseLocation *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_loc2str; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.intersect = (struct __pyx_obj_8_cdec_sa_PhraseLocation *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_8_cdec_sa_Phrase *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_intersect; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.find_fixpoint = (int (*)(struct __pyx_obj_8_cdec_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_8_cdec_sa_23HieroCachingRuleFactory_find_fixpoint; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.find_projection = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_find_projection; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.int_arr_extend = (int *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int *, int *, int *, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_int_arr_extend; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.extract_phrases = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract_phrases; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.create_alignments = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, int *, int, PyObject *, PyObject *))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_create_alignments; - __pyx_vtable_8_cdec_sa_HieroCachingRuleFactory.extract = (PyObject *(*)(struct __pyx_obj_8_cdec_sa_HieroCachingRuleFactory *, struct __pyx_obj_8_cdec_sa_Phrase *, struct __pyx_t_8_cdec_sa_Matching *, int *, int))__pyx_f_8_cdec_sa_23HieroCachingRuleFactory_extract; - if (PyType_Ready(&__pyx_type_8_cdec_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_cdec_sa_HieroCachingRuleFactory.tp_dict, __pyx_vtabptr_8_cdec_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HieroCachingRuleFactory", (PyObject *)&__pyx_type_8_cdec_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa_HieroCachingRuleFactory = &__pyx_type_8_cdec_sa_HieroCachingRuleFactory; - if (PyType_Ready(&__pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa___pyx_scope_struct__compute_stats = &__pyx_type_8_cdec_sa___pyx_scope_struct__compute_stats; - if (PyType_Ready(&__pyx_type_8_cdec_sa___pyx_scope_struct_1_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_cdec_sa___pyx_scope_struct_1_input = &__pyx_type_8_cdec_sa___pyx_scope_struct_1_input; + __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_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; + __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; + __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; + __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; + __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; + __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 = 8; __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 = 8; __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 = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_Alignment = &__pyx_type_3_sa_Alignment; + __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; + 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_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_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_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_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_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; + __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[12]; __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[12]; __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[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_TrieMap = &__pyx_type_3_sa_TrieMap; + __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[12]; __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[12]; __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[12]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_Precomputation = &__pyx_type_3_sa_Precomputation; + __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[13]; __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[13]; __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[13]; __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_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __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 = 18; __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 = 24; __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_ExtendedTrieNode = &__pyx_type_3_sa_ExtendedTrieNode; + if (PyType_Ready(&__pyx_type_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 35; __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 = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_TrieTable = &__pyx_type_3_sa_TrieTable; + __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 = 56; __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 = 56; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_PhraseLocation = &__pyx_type_3_sa_PhraseLocation; + if (PyType_Ready(&__pyx_type_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa_Sampler = &__pyx_type_3_sa_Sampler; + __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 = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int *, int, PyObject *, PyObject *))__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 = 201; __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 = 201; __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 = 201; __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__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__compute_stats = &__pyx_type_3_sa___pyx_scope_struct__compute_stats; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_1___iter__ = &__pyx_type_3_sa___pyx_scope_struct_1___iter__; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_2_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_2_input = &__pyx_type_3_sa___pyx_scope_struct_2_input; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "_cdec_sa.pyx":1 + /* "_sa.pyx":1 * import logging # <<<<<<<<<<<<<< * import resource * import gzip @@ -60603,7 +60804,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) if (PyObject_SetAttr(__pyx_m, __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.pyx":2 + /* "_sa.pyx":2 * import logging * import resource # <<<<<<<<<<<<<< * import gzip @@ -60614,7 +60815,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) if (PyObject_SetAttr(__pyx_m, __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.pyx":3 + /* "_sa.pyx":3 * import logging * import resource * import gzip # <<<<<<<<<<<<<< @@ -60626,19 +60827,19 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) if (PyObject_SetAttr(__pyx_m, __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.pyx":9 + /* "_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_8_cdec_sa_1gzip_or_text, NULL, __pyx_n_s___cdec_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_3_sa_1gzip_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_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __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.pyx":15 + /* "_sa.pyx":15 * return open(filename) * * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< @@ -60676,7 +60877,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * cdef int MIN_BOTTOM_BITS = 5 * cdef int LOWER_MASK[32] */ - __pyx_v_8_cdec_sa_MIN_BOTTOM_SIZE = 32; + __pyx_v_3_sa_MIN_BOTTOM_SIZE = 32; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":18 * @@ -60685,7 +60886,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * cdef int LOWER_MASK[32] * */ - __pyx_v_8_cdec_sa_MIN_BOTTOM_BITS = 5; + __pyx_v_3_sa_MIN_BOTTOM_BITS = 5; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":28 * LOWER_MASK[i] = mask @@ -60694,7 +60895,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * * cdef struct _BitSet: */ - __pyx_f_8_cdec_sa__init_lower_mask(); + __pyx_f_3_sa__init_lower_mask(); /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":4 * from libc.stdlib cimport malloc, realloc, strtol @@ -60703,7 +60904,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 * */ - __pyx_v_8_cdec_sa_INDEX_SHIFT = 3; + __pyx_v_3_sa_INDEX_SHIFT = 3; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":5 * @@ -60712,57 +60913,32 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * * cdef class Alphabet: */ - __pyx_v_8_cdec_sa_INDEX_MASK = ((1 << __pyx_v_8_cdec_sa_INDEX_SHIFT) - 1); + __pyx_v_3_sa_INDEX_MASK = ((1 << __pyx_v_3_sa_INDEX_SHIFT) - 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":87 * return self.terminals.index(s) * * cdef Alphabet ALPHABET = Alphabet() # <<<<<<<<<<<<<< * - * def sym_tostring(int sym): + * cdef char* sym_tostring(int sym): */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_cdec_sa_Alphabet)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Alphabet)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(((PyObject *)__pyx_v_8_cdec_sa_ALPHABET)); - __Pyx_DECREF(((PyObject *)__pyx_v_8_cdec_sa_ALPHABET)); + __Pyx_XGOTREF(((PyObject *)__pyx_v_3_sa_ALPHABET)); + __Pyx_DECREF(((PyObject *)__pyx_v_3_sa_ALPHABET)); __Pyx_GIVEREF(__pyx_t_1); - __pyx_v_8_cdec_sa_ALPHABET = ((struct __pyx_obj_8_cdec_sa_Alphabet *)__pyx_t_1); + __pyx_v_3_sa_ALPHABET = ((struct __pyx_obj_3_sa_Alphabet *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":91 - * cdef Alphabet ALPHABET = Alphabet() - * - * def sym_tostring(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.tostring(sym) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8_cdec_sa_3sym_tostring, NULL, __pyx_n_s___cdec_sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sym_tostring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":94 - * return ALPHABET.tostring(sym) + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104 + * return ALPHABET.setindex(sym, id) * * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<< * return ALPHABET.fromstring(string, terminal) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8_cdec_sa_5sym_fromstring, NULL, __pyx_n_s___cdec_sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sym_fromstring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":97 - * return ALPHABET.fromstring(string, terminal) - * - * def sym_isvar(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.isvar(sym) - * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8_cdec_sa_7sym_isvar, NULL, __pyx_n_s___cdec_sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_3sym_fromstring, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sym_isvar, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sym_fromstring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __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":5 @@ -60784,7 +60960,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * cdef int MERGE = 1 * cdef int BAEZA_YATES = 2 */ - __pyx_v_8_cdec_sa_PRECOMPUTE = 0; + __pyx_v_3_sa_PRECOMPUTE = 0; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":12 * @@ -60793,7 +60969,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * cdef int BAEZA_YATES = 2 * */ - __pyx_v_8_cdec_sa_MERGE = 1; + __pyx_v_3_sa_MERGE = 1; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":13 * cdef int PRECOMPUTE = 0 @@ -60802,7 +60978,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) * * # NOTE: was encoded as a non-terminal in the previous version */ - __pyx_v_8_cdec_sa_BAEZA_YATES = 2; + __pyx_v_3_sa_BAEZA_YATES = 2; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":16 * @@ -60817,9 +60993,9 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_144)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_144)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_144)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_140)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_140)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_140)); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -60829,7 +61005,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_8_cdec_sa_EPSILON = __pyx_t_4; + __pyx_v_3_sa_EPSILON = __pyx_t_4; /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":39 * cdef public int count @@ -60844,7 +61020,7 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_cdec_sa.pyx":1 + /* "_sa.pyx":1 * import logging # <<<<<<<<<<<<<< * import resource * import gzip @@ -60859,10 +61035,10 @@ PyMODINIT_FUNC PyInit__cdec_sa(void) __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init _cdec_sa", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init _sa", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _cdec_sa"); + PyErr_SetString(PyExc_ImportError, "init _sa"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -61015,7 +61191,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -61192,6 +61368,11 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( { 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))) @@ -61207,6 +61388,7 @@ 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 @@ -61219,10 +61401,9 @@ invalid_keyword: return 0; } - - static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; @@ -61231,19 +61412,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) 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 - *type = local_type; - *value = local_value; - *tb = local_tb; 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; @@ -61251,10 +61440,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ + 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; @@ -61279,23 +61471,40 @@ static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { return r; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" PY_FORMAT_SIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else if (PyErr_Occurred()) { +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; @@ -61304,12 +61513,25 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { } } 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 double __Pyx__PyObject_AsDouble(PyObject* obj) { PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { return PyFloat_AsDouble(obj); } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { @@ -61326,6 +61548,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { 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); @@ -61359,8 +61582,158 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +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 = PyObject_CallMethodObjArgs(iterable, method_name, NULL); + 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 int __Pyx_div_int(int a, int b) { @@ -61371,6 +61744,7 @@ static CYTHON_INLINE int __Pyx_div_int(int a, int b) { } 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; @@ -61378,8 +61752,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, 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; @@ -61391,6 +61769,9 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *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, long level) { @@ -61862,8 +62243,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +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); @@ -61883,6 +62264,7 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, 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; @@ -61890,6 +62272,10 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, 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; @@ -61899,9 +62285,70 @@ 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_GetAttrString(ev, "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) -{ +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; @@ -61913,14 +62360,18 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) Py_XDECREF(exc_traceback); } static CYTHON_INLINE -PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) -{ - PyObject *retval; - if (unlikely(self->is_running)) { +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); - return NULL; + 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, @@ -61933,81 +62384,240 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) PyErr_SetNone(PyExc_StopIteration); return NULL; } - if (value) - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); - else + 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); - else + 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 PyObject *__Pyx_Generator_Next(PyObject *self) -{ - return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None); +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 = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, value); } -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) -{ - return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, 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_GetAttrString(yf, "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 *generator = (__pyx_GeneratorObject *) self; - PyObject *retval; +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); + PyErr_SetNone(PyExc_StopIteration); #else - PyErr_SetNone(PyExc_GeneratorExit); + PyErr_SetNone(PyExc_GeneratorExit); #endif - retval = __Pyx_Generator_SendEx(generator, NULL); + retval = __Pyx_Generator_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } -#if PY_VERSION_HEX < 0x02050000 - if (PyErr_ExceptionMatches(PyExc_StopIteration)) -#else - if (PyErr_ExceptionMatches(PyExc_StopIteration) - || PyErr_ExceptionMatches(PyExc_GeneratorExit)) + 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)) { - PyErr_Clear(); /* ignore these errors */ + 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 *generator = (__pyx_GeneratorObject *) self; +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_GetAttrString(yf, "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(generator, NULL); + return __Pyx_Generator_SendEx(gen, NULL); } -static int -__Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) -{ +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 void -__Pyx_Generator_dealloc(PyObject *self) -{ +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) @@ -62019,16 +62629,10 @@ __Pyx_Generator_dealloc(PyObject *self) return; /* resurrected. :( */ } PyObject_GC_UnTrack(self); - Py_CLEAR(gen->closure); - Py_CLEAR(gen->classobj); - Py_CLEAR(gen->exc_type); - Py_CLEAR(gen->exc_value); - Py_CLEAR(gen->exc_traceback); + __Pyx_Generator_clear(self); PyObject_GC_Del(gen); } -static void -__Pyx_Generator_del(PyObject *self) -{ +static void __Pyx_Generator_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; @@ -62057,11 +62661,13 @@ __Pyx_Generator_del(PyObject *self) _Py_NewReference(self); self->ob_refcnt = refcnt; } +#if CYTHON_COMPILING_FOR_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 @@ -62069,13 +62675,17 @@ __Pyx_Generator_del(PyObject *self) * undone. */ #ifdef COUNT_ALLOCS - --self->ob_type->tp_frees; - --self->ob_type->tp_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_INT, +#endif offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL}, @@ -62087,7 +62697,7 @@ static PyMethodDef __pyx_Generator_methods[] = { {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_GeneratorType = { +static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("generator"), /*tp_name*/ sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ @@ -62108,7 +62718,7 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr, /*tp_getattro*/ + 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ @@ -62117,7 +62727,7 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ - PyObject_SelfIter, /*tp_iter*/ + 0, /*tp_iter*/ (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ __pyx_Generator_methods, /*tp_methods*/ __pyx_Generator_memberlist, /*tp_members*/ @@ -62142,12 +62752,10 @@ static PyTypeObject __pyx_GeneratorType = { 0, /*tp_version_tag*/ #endif }; -static -__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure) -{ +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { __pyx_GeneratorObject *gen = - PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType); + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); if (gen == NULL) return NULL; gen->body = body; @@ -62156,6 +62764,7 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, 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; @@ -62163,9 +62772,14 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, PyObject_GC_Track(gen); return gen; } -static int __pyx_Generator_init(void) -{ - return PyType_Ready(&__pyx_GeneratorType); +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) { @@ -62187,6 +62801,42 @@ static int __Pyx_check_binary_version(void) { 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_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); diff --git a/python/src/sa/_sa.pxd b/python/src/sa/_sa.pxd new file mode 100644 index 00000000..d390bfc5 --- /dev/null +++ b/python/src/sa/_sa.pxd @@ -0,0 +1,17 @@ +cdef class Phrase: + cdef int *syms + cdef int n, *varpos, n_vars + cdef public int chunkpos(self, int k) + cdef public int chunklen(self, int k) + +cdef class Rule: + cdef public int lhs + cdef readonly Phrase f, e + cdef float *cscores + cdef int n_scores + cdef public word_alignments + +cdef char* sym_tostring(int sym) +cdef char* sym_tocat(int sym) +cdef int sym_isvar(int sym) +cdef int sym_getindex(int sym) diff --git a/python/src/sa/_cdec_sa.pyx b/python/src/sa/_sa.pyx index 710f8cb4..710f8cb4 100644 --- a/python/src/sa/_cdec_sa.pyx +++ b/python/src/sa/_sa.pyx diff --git a/python/src/sa/rule.pxi b/python/src/sa/rule.pxi index 9c34f66d..bf1a83c6 100644 --- a/python/src/sa/rule.pxi +++ b/python/src/sa/rule.pxi @@ -2,8 +2,6 @@ from libc.stdlib cimport malloc, calloc, realloc, free, strtof, strtol from libc.string cimport strsep, strcpy, strlen cdef class Phrase: - cdef int *syms - cdef int n, *varpos, n_vars def __cinit__(self, words): cdef int i, j, n, n_vars @@ -12,14 +10,14 @@ cdef class Phrase: self.syms = <int *>malloc(n*sizeof(int)) for i from 0 <= i < n: self.syms[i] = words[i] - if ALPHABET.isvar(self.syms[i]): + if sym_isvar(self.syms[i]): n_vars += 1 self.n = n self.n_vars = n_vars self.varpos = <int *>malloc(n_vars*sizeof(int)) j = 0 for i from 0 <= i < n: - if ALPHABET.isvar(self.syms[i]): + if sym_isvar(self.syms[i]): self.varpos[j] = i j = j + 1 @@ -32,7 +30,7 @@ cdef class Phrase: cdef int i, s for i from 0 <= i < self.n: s = self.syms[i] - strs.append(ALPHABET.tostring(s)) + strs.append(sym_tostring(s)) return " ".join(strs) def handle(self): @@ -44,8 +42,8 @@ cdef class Phrase: j = 0 for j from 0 <= j < self.n: s = self.syms[j] - if ALPHABET.isvar(s): - s = ALPHABET.setindex(s,i) + if sym_isvar(s): + s = sym_setindex(s,i) i = i + 1 norm.append(s) return tuple(norm) @@ -58,10 +56,10 @@ cdef class Phrase: j = 0 for j from 0 <= j < self.n: s = self.syms[j] - if ALPHABET.isvar(s): - s = ALPHABET.setindex(s,i) + if sym_isvar(s): + s = sym_setindex(s,i) i = i + 1 - norm.append(ALPHABET.tostring(s)) + norm.append(sym_tostring(s)) return " ".join(norm) def arity(self): @@ -142,33 +140,30 @@ cdef class Phrase: def __iter__(self): cdef int i - l = [] for i from 0 <= i < self.n: - l.append(self.syms[i]) - return iter(l) + yield self.syms[i] def subst(self, start, children): cdef int i for i from 0 <= i < self.n: - if ALPHABET.isvar(self.syms[i]): - start = start + children[ALPHABET.getindex(self.syms[i])-1] + if sym_isvar(self.syms[i]): + start = start + children[sym_getindex(self.syms[i])-1] else: start = start + (self.syms[i],) return start + + property words: + def __get__(self): + return [sym_tostring(w) for w in self if not sym_isvar(w)] cdef class Rule: - cdef public int lhs - cdef readonly Phrase f, e - cdef float *cscores - cdef int n_scores - cdef public word_alignments def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): cdef int i, n cdef char *rest - if not ALPHABET.isvar(lhs): + if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) self.lhs = lhs @@ -214,7 +209,7 @@ cdef class Rule: scorestrs = [] for i from 0 <= i < self.n_scores: scorestrs.append(str(self.cscores[i])) - fields = [ALPHABET.tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] + fields = [sym_tostring(self.lhs), str(self.f), str(self.e), " ".join(scorestrs)] if self.word_alignments is not None: alignstr = [] for i from 0 <= i < len(self.word_alignments): diff --git a/python/src/sa/rulefactory.pxi b/python/src/sa/rulefactory.pxi index 24bb680f..1c8d25a4 100644 --- a/python/src/sa/rulefactory.pxi +++ b/python/src/sa/rulefactory.pxi @@ -975,7 +975,6 @@ cdef class HieroCachingRuleFactory: continue phrase = prefix + (word_id,) - str_phrase = map(sym_tostring, phrase) hiero_phrase = Phrase(phrase) arity = hiero_phrase.arity() @@ -1019,7 +1018,7 @@ cdef class HieroCachingRuleFactory: else: # Suffix array search phrase_location = node.phrase_location - sa_range = self.fsa.lookup(str_phrase[-1], len(str_phrase)-1, phrase_location.sa_low, phrase_location.sa_high) + 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: diff --git a/python/src/sa/sym.pxi b/python/src/sa/sym.pxi index 3fd6c5a7..4b41886f 100644 --- a/python/src/sa/sym.pxi +++ b/python/src/sa/sym.pxi @@ -53,14 +53,12 @@ cdef class Alphabet: if self.isvar(sym): 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) else: self.id2sym[sym] = "[%s]" % self.tocat(sym) return self.id2sym[sym] - else: return self.terminals.word(sym) @@ -88,14 +86,20 @@ cdef class Alphabet: cdef Alphabet ALPHABET = Alphabet() -def sym_tostring(int sym): +cdef char* sym_tostring(int sym): return ALPHABET.tostring(sym) -def sym_fromstring(bytes string, bint terminal): - return ALPHABET.fromstring(string, terminal) +cdef char* sym_tocat(int sym): + return ALPHABET.tocat(sym) -def sym_isvar(int sym): +cdef int sym_isvar(int sym): return ALPHABET.isvar(sym) +cdef int sym_getindex(int sym): + return ALPHABET.getindex(sym) + cdef int sym_setindex(int sym, int id): return ALPHABET.setindex(sym, id) + +def sym_fromstring(bytes string, bint terminal): + return ALPHABET.fromstring(string, terminal) diff --git a/python/src/utils.pxd b/python/src/utils.pxd index f4da686b..a1a4799b 100644 --- a/python/src/utils.pxd +++ b/python/src/utils.pxd @@ -17,7 +17,9 @@ cdef extern from "utils/logval.h": cdef cppclass LogVal[T]: double as_float() - double log(LogVal[double]&) + ctypedef LogVal[double] prob_t + + double log(prob_t&) cdef extern from "utils/wordid.h": ctypedef int WordID @@ -33,7 +35,6 @@ cdef extern from "utils/sparse_vector.h": const_iterator(FastSparseVector[T]&, bint is_end) pair[unsigned, T]* ptr "operator->" () const_iterator& operator++() - bint operator==(const_iterator&) bint operator!=(const_iterator&) FastSparseVector() FastSparseVector(FastSparseVector[T]&) diff --git a/python/src/vectors.pxi b/python/src/vectors.pxi index cd1c2598..989a6a7c 100644 --- a/python/src/vectors.pxi +++ b/python/src/vectors.pxi @@ -1,7 +1,16 @@ from cython.operator cimport preincrement as pinc cdef class DenseVector: - cdef vector[weight_t]* vector # Not owned by DenseVector + cdef vector[weight_t]* vector + cdef bint owned # if True, do not manage memory + + def __init__(self): + self.vector = new vector[weight_t]() + self.owned = False + + def __dealloc__(self): + if not self.owned: + del self.vector def __len__(self): return self.vector.size() @@ -28,7 +37,7 @@ cdef class DenseVector: return other.dot(self) def tosparse(self): - cdef SparseVector sparse = SparseVector() + cdef SparseVector sparse = SparseVector.__new__(SparseVector) sparse.vector = new FastSparseVector[weight_t]() InitSparseVector(self.vector[0], sparse.vector) return sparse @@ -36,6 +45,9 @@ cdef class DenseVector: cdef class SparseVector: cdef FastSparseVector[weight_t]* vector + def __init__(self): + self.vector = new FastSparseVector[weight_t]() + def __dealloc__(self): del self.vector @@ -83,7 +95,7 @@ cdef class SparseVector: return self.vector.nonzero(FDConvert(fname)) def __neg__(self): - cdef SparseVector result = SparseVector() + cdef SparseVector result = SparseVector.__new__(SparseVector) result.vector = new FastSparseVector[weight_t](self.vector[0]) result.vector[0] *= -1.0 return result @@ -105,12 +117,12 @@ cdef class SparseVector: return self def __add__(SparseVector x, SparseVector y): - cdef SparseVector result = SparseVector() + cdef SparseVector result = SparseVector.__new__(SparseVector) result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) return result def __sub__(SparseVector x, SparseVector y): - cdef SparseVector result = SparseVector() + cdef SparseVector result = SparseVector.__new__(SparseVector) result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) return result @@ -119,7 +131,7 @@ cdef class SparseVector: cdef float scalar if isinstance(x, SparseVector): vector, scalar = x, y else: vector, scalar = y, x - cdef SparseVector result = SparseVector() + cdef SparseVector result = SparseVector.__new__(SparseVector) result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) return result @@ -128,6 +140,6 @@ cdef class SparseVector: cdef float scalar if isinstance(x, SparseVector): vector, scalar = x, y else: vector, scalar = y, x - cdef SparseVector result = SparseVector() + cdef SparseVector result = SparseVector.__new__(SparseVector) result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) return result |