/* Generated by Cython 0.29.35 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "extra_compile_args": [
            "--std=c++0x"
        ],
        "include_dirs": [
            "/usr/include/colibri-core",
            "/usr/local/include/colibri-core"
        ],
        "language": "c++",
        "libraries": [
            "colibricore",
            "bz2"
        ],
        "library_dirs": [
            "/usr/lib",
            "/usr/local/lib"
        ],
        "name": "colibricore",
        "sources": [
            "colibricore_wrapper.pyx",
            "unordered_set.pxd",
            "unordered_map.pxd",
            "colibricore_classes.pxd"
        ]
    },
    "module_name": "colibricore"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_35"
#define CYTHON_HEX_VERSION 0x001D23F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PY_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 0
  #elif !defined(CYTHON_FAST_THREAD_STATE)
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if PY_VERSION_HEX >= 0x030B00A1
    static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
        PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
        const char *fn_cstr=NULL;
        const char *name_cstr=NULL;
        PyCodeObject* co=NULL;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        if (!(kwds=PyDict_New())) goto end;
        if (!(argcount=PyLong_FromLong(a))) goto end;
        if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
        if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
        if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
        if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
        if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
        if (!(nlocals=PyLong_FromLong(l))) goto end;
        if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
        if (!(stacksize=PyLong_FromLong(s))) goto end;
        if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
        if (!(flags=PyLong_FromLong(f))) goto end;
        if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
        if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
        if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
        if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
        if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
        if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
        if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
        Py_XDECREF((PyObject*)co);
        co = (PyCodeObject*)call_result;
        call_result = NULL;
        if (0) {
            cleanup_code_too:
            Py_XDECREF((PyObject*)co);
            co = NULL;
        }
        end:
        Py_XDECREF(kwds);
        Py_XDECREF(argcount);
        Py_XDECREF(posonlyargcount);
        Py_XDECREF(kwonlyargcount);
        Py_XDECREF(nlocals);
        Py_XDECREF(stacksize);
        Py_XDECREF(replace);
        Py_XDECREF(call_result);
        Py_XDECREF(empty);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return co;
    }
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #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_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_USE_MATH_DEFINES)
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__colibricore
#define __PYX_HAVE_API__colibricore
/* Early includes */
#include <string.h>
#include <string>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <vector>
#include <utility>

    #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
    // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stdint.h>
#include <iostream>
#include "pattern.h"
#include "datatypes.h"
#include "patternstore.h"
#include "classdecoder.h"
#include "classencoder.h"
#include "patternmodel.h"
#include "alignmodel.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "stringsource",
  "colibricore_wrapper.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_11colibricore_ClassEncoder;
struct __pyx_obj_11colibricore_ClassDecoder;
struct __pyx_obj_11colibricore_Pattern;
struct __pyx_obj_11colibricore_IndexedData;
struct __pyx_obj_11colibricore_PatternSet;
struct __pyx_obj_11colibricore_PatternDict_int32;
struct __pyx_obj_11colibricore_SmallPatternDict_int32;
struct __pyx_obj_11colibricore_TinyPatternDict_int32;
struct __pyx_obj_11colibricore_PatternDict_int;
struct __pyx_obj_11colibricore_PatternDict_float;
struct __pyx_obj_11colibricore_AlignedPatternDict_int32;
struct __pyx_obj_11colibricore_IndexedPatternModel;
struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel;
struct __pyx_obj_11colibricore_PatternSetModel;
struct __pyx_obj_11colibricore_UnindexedPatternModel;
struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel;
struct __pyx_obj_11colibricore_PatternModelOptions;
struct __pyx_obj_11colibricore_IndexedCorpus;
struct __pyx_obj_11colibricore_PatternVector;
struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float;
struct __pyx_obj_11colibricore_PatternAlignmentModel_float;
struct __pyx_obj_11colibricore_BasicPatternAlignmentModel;
struct __pyx_obj_11colibricore___pyx_scope_struct____iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux;
struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts;
struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps;
struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams;
struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_8_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_10_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_12_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_14_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_16_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_18_children;
struct __pyx_obj_11colibricore___pyx_scope_struct_19_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex;
struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence;
struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram;
struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter;
struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_26_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren;
struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents;
struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours;
struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours;
struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent;
struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates;
struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances;
struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex;
struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence;
struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram;
struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter;
struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_43_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren;
struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents;
struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours;
struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours;
struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent;
struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates;
struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances;
struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc;
struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex;
struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence;
struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram;
struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter;
struct __pyx_obj_11colibricore___pyx_scope_struct_60_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex;
struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence;
struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram;
struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter;
struct __pyx_obj_11colibricore___pyx_scope_struct_66_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_68_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern;
struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences;
struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_72_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_75_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples;
struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__;
struct __pyx_obj_11colibricore___pyx_scope_struct_78_items;
struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs;
struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train;
struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune;
struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train;
struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune;
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train;
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune;
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add;
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train;
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune;
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add;
struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind;

/* "colibricore_wrapper.pyx":1380
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */
struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train {
  int __pyx_n;
  PyObject *constrainmodel;
};

/* "colibricore_wrapper.pyx":1480
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */
struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune {
  int __pyx_n;
  int n;
};

/* "colibricore_wrapper.pyx":2206
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */
struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train {
  int __pyx_n;
  PyObject *constrainmodel;
};

/* "colibricore_wrapper.pyx":2306
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */
struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune {
  int __pyx_n;
  int n;
};

/* "colibricore_wrapper.pyx":3133
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train {
  int __pyx_n;
  PyObject *constrainmodel;
};

/* "colibricore_wrapper.pyx":3233
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune {
  int __pyx_n;
  int n;
};

/* "colibricore_wrapper.pyx":3355
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */
struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add {
  int __pyx_n;
  int count;
};

/* "colibricore_wrapper.pyx":3630
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train {
  int __pyx_n;
  PyObject *constrainmodel;
};

/* "colibricore_wrapper.pyx":3730
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune {
  int __pyx_n;
  int n;
};

/* "colibricore_wrapper.pyx":3852
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */
struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add {
  int __pyx_n;
  int count;
};

/* "colibricore_wrapper.pyx":3996
 * 
 * 
 *     cdef bind(self, cIndexedCorpus * d, unload=False):             # <<<<<<<<<<<<<<
 *         if self.data != NULL and self.unload:
 *             del self.data
 */
struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind {
  int __pyx_n;
  PyObject *unload;
};

/* "colibricore_wrapper.pyx":40
 *     FLEXGRAM=3
 * 
 * cdef class ClassEncoder:             # <<<<<<<<<<<<<<
 *     """The class encoder allows patterns to be built from their string representation. Load in a class file and invoke the ``buildpattern()`` method"""
 * 
 */
struct __pyx_obj_11colibricore_ClassEncoder {
  PyObject_HEAD
  ClassEncoder data;
  PyObject *_filename;
  std::unordered_map<std::string,unsigned int>  freqlist;
  int minlength;
  int maxlength;
};


/* "colibricore_wrapper.pyx":127
 * 
 * 
 * cdef class ClassDecoder:             # <<<<<<<<<<<<<<
 *     """The Class Decoder allows Patterns to be decoded back to their string representation. An instance of ClassDecoder is passed to Pattern.tostring()"""
 * 
 */
struct __pyx_obj_11colibricore_ClassDecoder {
  PyObject_HEAD
  ClassDecoder data;
  PyObject *_filename;
};


/* "colibricore_wrapper.pyx":164
 *     return pattern
 * 
 * cdef class Pattern:             # <<<<<<<<<<<<<<
 *     """The Pattern class contains an ngram, skipgram or flexgram, and allows a wide variety of actions to be performed on it. It is stored in a memory-efficient fashion and facilitating fast operation and comparison. Use ClassEncoder.buildpattern to build a pattern."""
 * 
 */
struct __pyx_obj_11colibricore_Pattern {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_Pattern *__pyx_vtab;
  Pattern cpattern;
};


/* "colibricore_wrapper.pyx":470
 * 
 * 
 * cdef class IndexedData:             # <<<<<<<<<<<<<<
 *     """IndexedData is essentially a set of indexes in the form of (sentence,token) tuples, sentence is generally 1-indexed, token is always 0-indexed. It is used by Indexed Pattern Models to keep track of exact occurrences of all the patterns. Use len() to if you're merely interested in the number of occurrences, rather than their exact wherabouts."""
 * 
 */
struct __pyx_obj_11colibricore_IndexedData {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_IndexedData *__pyx_vtab;
  IndexedData data;
};


/* "colibricore_wrapper.pyx":507
 * 
 * 
 * cdef class PatternSet:             # <<<<<<<<<<<<<<
 *     """This is a simple low-level set that contains Pattern instances"""
 *     cdef cPatternSet[uint] data
 */
struct __pyx_obj_11colibricore_PatternSet {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternSet *__pyx_vtab;
  PatternSet<unsigned int>  data;
  PatternSet<unsigned int> ::iterator it;
  PatternSet<unsigned int> ::iterator it_end;
};


/* "colibricore_wrapper.pyx":562
 * 
 * 
 * cdef class PatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */
struct __pyx_obj_11colibricore_PatternDict_int32 {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternDict_int32 *__pyx_vtab;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  data;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator it_end;
  uint32_t value;
};


/* "colibricore_wrapper.pyx":643
 * 
 * 
 * cdef class SmallPatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a Small version taht allows at most 65536 patterns."""
 * 
 */
struct __pyx_obj_11colibricore_SmallPatternDict_int32 {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_SmallPatternDict_int32 *__pyx_vtab;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t>  data;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator it_end;
  uint32_t value;
};


/* "colibricore_wrapper.pyx":723
 * 
 * 
 * cdef class TinyPatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a tiny version that allow only up to 256 patterns."""
 * 
 */
struct __pyx_obj_11colibricore_TinyPatternDict_int32 {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_TinyPatternDict_int32 *__pyx_vtab;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t>  data;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator it_end;
  uint32_t value;
};


/* "colibricore_wrapper.pyx":802
 *         self.data = newdata
 * 
 * cdef class PatternDict_int: #maps Patterns to uint64             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */
struct __pyx_obj_11colibricore_PatternDict_int {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternDict_int *__pyx_vtab;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t>  data;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator it;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator it_end;
  int value;
};


/* "colibricore_wrapper.pyx":878
 *         self.data[pattern.cpattern] = v
 * 
 * cdef class PatternDict_float: #maps Patterns to float             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and float (double) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */
struct __pyx_obj_11colibricore_PatternDict_float {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternDict_float *__pyx_vtab;
  PatternMap<float,BaseValueHandler<float> ,uint32_t>  data;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator it;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator it_end;
  float value;
};


/* "colibricore_wrapper.pyx":955
 * 
 * 
 * cdef class AlignedPatternDict_int32: #maps Patterns to Patterns to uint32 (nested dicts)             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */
struct __pyx_obj_11colibricore_AlignedPatternDict_int32 {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *__pyx_vtab;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  data;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator it;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator it_end;
};


/* "colibricore_wrapper.pyx":1115
 * 
 * 
 * cdef class IndexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Indexed Pattern Model. Implemented using a hash map (dictionary)"""
 * 
 */
struct __pyx_obj_11colibricore_IndexedPatternModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *__pyx_vtab;
  IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> >  data;
  PatternModel<IndexedData,IndexedDataHandler,PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator it;
  PyObject *corpus;
};


/* "colibricore_wrapper.pyx":1941
 *         return self.data.computeflexgrams_fromcooc(threshold)
 * 
 * cdef class HashOrderedIndexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Indexed Pattern Model. Implemented using an ordered map"""
 * 
 */
struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *__pyx_vtab;
  IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> >  data;
  PatternModel<IndexedData,IndexedDataHandler,HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator it;
  PyObject *corpus;
};


/* "colibricore_wrapper.pyx":2767
 *         return self.data.computeflexgrams_fromcooc(threshold)
 * 
 * cdef class PatternSetModel:             # <<<<<<<<<<<<<<
 *     cdef cPatternSetModel data
 * 
 */
struct __pyx_obj_11colibricore_PatternSetModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternSetModel *__pyx_vtab;
  PatternSetModel data;
};


/* "colibricore_wrapper.pyx":2869
 *     self.data.write(encode(filename))
 * 
 * cdef class UnindexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Unindexed Pattern Model, less flexible and powerful than its indexed counterpart, but smaller memory footprint"""
 *     cdef cPatternModel[uint32_t,cBaseValueHandler[uint32_t],cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint64_t]] data
 */
struct __pyx_obj_11colibricore_UnindexedPatternModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *__pyx_vtab;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> >  data;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator it;
  PyObject *corpus;
};


/* "colibricore_wrapper.pyx":3366
 * 
 * 
 * cdef class OrderedUnindexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Unindexed Pattern Model, implemented using an ordered map, less flexible and powerful than its indexed counterpart, but smaller memory footprint"""
 *     cdef cPatternModel[uint32_t,cBaseValueHandler[uint32_t],cHashOrderedPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint64_t]] data
 */
struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *__pyx_vtab;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> >  data;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator it;
  PyObject *corpus;
};


/* "colibricore_wrapper.pyx":3862
 *         self.data[pattern.cpattern] = self.data[pattern.cpattern] + count
 * 
 * cdef class PatternModelOptions:             # <<<<<<<<<<<<<<
 *     """Options for Pattern model, you can get and set the following attributes:
 * 
 */
struct __pyx_obj_11colibricore_PatternModelOptions {
  PyObject_HEAD
  PatternModelOptions coptions;
};


/* "colibricore_wrapper.pyx":3978
 *             raise KeyError
 * 
 * cdef class IndexedCorpus:             # <<<<<<<<<<<<<<
 *     """An indexed version of a corpus, reads an entire corpus (colibri.dat file) in memory"""
 *     cdef cIndexedCorpus * data
 */
struct __pyx_obj_11colibricore_IndexedCorpus {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_IndexedCorpus *__pyx_vtab;
  IndexedCorpus *data;
  PyObject *_filename;
  bool unload;
  PyObject *frommodel;
};


/* "colibricore_wrapper.pyx":4142
 *         return self.data.sentencelength(sentence)
 * 
 * cdef class PatternVector:             # <<<<<<<<<<<<<<
 *     cdef cPatternVector data
 * 
 */
struct __pyx_obj_11colibricore_PatternVector {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternVector *__pyx_vtab;
  PatternVector data;
};


/* "colibricore_wrapper.pyx":4172
 *             inc(it)
 * 
 * cdef class PatternFeatureVectorMap_float:             # <<<<<<<<<<<<<<
 *     cdef cPatternFeatureVectorMap[double] data
 *     cdef cPatternFeatureVectorMap[double].iterator it
 */
struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *__pyx_vtab;
  PatternFeatureVectorMap<double>  data;
  PatternFeatureVectorMap<double> ::iterator it;
};


/* "colibricore_wrapper.pyx":4244
 * 
 * 
 * cdef class PatternAlignmentModel_float:             # <<<<<<<<<<<<<<
 *     """Pattern Alignment Model, maps patterns to pattern to score vectors (float)"""
 *     cdef cPatternAlignmentModel[double] data
 */
struct __pyx_obj_11colibricore_PatternAlignmentModel_float {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *__pyx_vtab;
  PatternAlignmentModel<double>  data;
  PatternAlignmentModel<double> ::iterator it;
};


/* "colibricore_wrapper.pyx":4473
 * 
 * 
 * cdef class BasicPatternAlignmentModel:             # <<<<<<<<<<<<<<
 *     """Pattern Alignment Model, maps patterns to pattern to score vectors (float)"""
 *     cdef cBasicPatternAlignmentModel data
 */
struct __pyx_obj_11colibricore_BasicPatternAlignmentModel {
  PyObject_HEAD
  struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel *__pyx_vtab;
  BasicPatternAlignmentModel data;
  BasicPatternAlignmentModel::iterator it;
  BasicPatternAlignmentModel::iterator it_end;
};


/* "colibricore_wrapper.pyx":299
 *             return newpattern
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all words/tokens in this pattern"""
 *         for i in range(0, len(self)):
 */
struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ {
  PyObject_HEAD
  Py_ssize_t __pyx_v_i;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_self;
  Py_ssize_t __pyx_t_0;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
};


/* "colibricore_wrapper.pyx":368
 *             return self._ngrams_aux(n)
 * 
 *     def _ngrams_aux(self,int n):             # <<<<<<<<<<<<<<
 *         cdef vector[cPattern] result
 *         self.cpattern.ngrams(result, n)
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux {
  PyObject_HEAD
  Pattern __pyx_v_cngram;
  std::vector<Pattern> ::iterator __pyx_v_it;
  std::vector<Pattern> ::iterator __pyx_v_it_end;
  int __pyx_v_n;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_ngram;
  std::vector<Pattern>  __pyx_v_result;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":381
 *             inc(it)
 * 
 *     def parts(self):             # <<<<<<<<<<<<<<
 *         """Generating iterating over the consecutive non-gappy parts in a skipgram of flexgram
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts {
  PyObject_HEAD
  Pattern __pyx_v_cngram;
  std::vector<Pattern> ::iterator __pyx_v_it;
  std::vector<Pattern> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_ngram;
  std::vector<Pattern>  __pyx_v_result;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":398
 *             inc(it)
 * 
 *     def gaps(self):             # <<<<<<<<<<<<<<
 *         """Generator iterating over the gaps in a skipgram or flexgram, return a tuple (begin,length) for each. For flexgrams, the minimum length (1) is always returned.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps {
  PyObject_HEAD
  std::vector<std::pair<int,int> > ::iterator __pyx_v_it;
  std::vector<std::pair<int,int> > ::iterator __pyx_v_it_end;
  std::pair<int,int>  __pyx_v_p;
  std::vector<std::pair<int,int> >  __pyx_v_result;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":423
 *         return newpattern
 * 
 *     def subngrams(self,int minn=1,int maxn=99):             # <<<<<<<<<<<<<<
 *         """Generator iterating over all ngrams of all sizes that are enclosed within this pattern. Despite the name, this may also return skipgrams!
 *         :param minn: minimum length (default 1)
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams {
  PyObject_HEAD
  int __pyx_v_maxn;
  int __pyx_v_minn;
  long __pyx_v_n;
  PyObject *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_self;
  long __pyx_t_0;
  long __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
};


/* "colibricore_wrapper.pyx":486
 *         return self.data.has(ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all (sentence,token) tuples in the set"""
 *         cdef cIndexReference ref
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ {
  PyObject_HEAD
  IndexedData::iterator __pyx_v_it;
  IndexedData::iterator __pyx_v_it_end;
  IndexReference __pyx_v_ref;
  struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":536
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternSet<unsigned int> ::iterator __pyx_v_it;
  PatternSet<unsigned int> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":585
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":607
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_8_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self;
  uint32_t __pyx_v_value;
};


/* "colibricore_wrapper.pyx":666
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":688
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_10_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self;
  uint32_t __pyx_v_value;
};


/* "colibricore_wrapper.pyx":746
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":768
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_12_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self;
  uint32_t __pyx_v_value;
};


/* "colibricore_wrapper.pyx":825
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":847
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_14_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":901
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":923
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_16_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self;
  PyObject *__pyx_v_value;
};


/* "colibricore_wrapper.pyx":1000
 *             return self.has(item)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead, to iterate over the children for a specific pattern, use children()"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":1013
 * 
 * 
 *     def children(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_18_children {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it2;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it2_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":1028
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all pattern pairs and their values in the dictionary. Yields (pattern1,pattern2,value) tuples"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_19_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it2;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it2end;
  AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2;
  struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self;
  int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1281
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":1496
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_indexreference;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
  int __pyx_v_token;
};


/* "colibricore_wrapper.pyx":1520
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  std::pair<IndexReference,PatternPointer>  __pyx_v_p;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  std::vector<std::pair<IndexReference,PatternPointer> > ::iterator __pyx_v_resit;
  std::vector<std::pair<IndexReference,PatternPointer> >  __pyx_v_results;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
};


/* "colibricore_wrapper.pyx":1542
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram {
  PyObject_HEAD
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  std::map<unsigned int,unsigned int>  __pyx_v_hist;
  std::map<unsigned int,unsigned int> ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":1561
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter {
  PyObject_HEAD
  int __pyx_v_category;
  unsigned long __pyx_v_count;
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":1610
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":1621
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_26_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedData __pyx_v_cvalue;
  IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  struct __pyx_obj_11colibricore_IndexedData *__pyx_v_value;
};


/* "colibricore_wrapper.pyx":1683
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1710
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1736
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_cutoff;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1762
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_cutoff;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1788
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1809
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1832
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1855
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1881
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":1907
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2107
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":2322
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_indexreference;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
  int __pyx_v_token;
};


/* "colibricore_wrapper.pyx":2346
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  std::pair<IndexReference,PatternPointer>  __pyx_v_p;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  std::vector<std::pair<IndexReference,PatternPointer> > ::iterator __pyx_v_resit;
  std::vector<std::pair<IndexReference,PatternPointer> >  __pyx_v_results;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
};


/* "colibricore_wrapper.pyx":2368
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram {
  PyObject_HEAD
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  std::map<unsigned int,unsigned int>  __pyx_v_hist;
  std::map<unsigned int,unsigned int> ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":2387
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter {
  PyObject_HEAD
  int __pyx_v_category;
  unsigned long __pyx_v_count;
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":2436
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":2447
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_43_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedData __pyx_v_cvalue;
  IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  struct __pyx_obj_11colibricore_IndexedData *__pyx_v_value;
};


/* "colibricore_wrapper.pyx":2509
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2536
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2562
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_cutoff;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2588
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_cutoff;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2614
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2635
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2658
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2681
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2707
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2733
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc {
  PyObject_HEAD
  int __pyx_v_category;
  Pattern __pyx_v_cpattern;
  int __pyx_v_occurrencethreshold;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  t_relationmap __pyx_v_relations;
  t_relationmap_iterator __pyx_v_relit;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self;
  int __pyx_v_size;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":2793
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternSetModel::iterator __pyx_v_it;
  PatternSetModel::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":3034
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":3249
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_indexreference;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
  int __pyx_v_token;
};


/* "colibricore_wrapper.pyx":3273
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  std::pair<IndexReference,PatternPointer>  __pyx_v_p;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  std::vector<std::pair<IndexReference,PatternPointer> > ::iterator __pyx_v_resit;
  std::vector<std::pair<IndexReference,PatternPointer> >  __pyx_v_results;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
};


/* "colibricore_wrapper.pyx":3295
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram {
  PyObject_HEAD
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  std::map<unsigned int,unsigned int>  __pyx_v_hist;
  std::map<unsigned int,unsigned int> ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":3314
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter {
  PyObject_HEAD
  int __pyx_v_category;
  unsigned long __pyx_v_count;
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":3342
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_60_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":3531
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":3746
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_indexreference;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
  int __pyx_v_token;
};


/* "colibricore_wrapper.pyx":3770
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  std::pair<IndexReference,PatternPointer>  __pyx_v_p;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  std::vector<std::pair<IndexReference,PatternPointer> > ::iterator __pyx_v_resit;
  std::vector<std::pair<IndexReference,PatternPointer> >  __pyx_v_results;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
  int __pyx_v_sentence;
};


/* "colibricore_wrapper.pyx":3792
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram {
  PyObject_HEAD
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  std::map<unsigned int,unsigned int>  __pyx_v_hist;
  std::map<unsigned int,unsigned int> ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":3811
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter {
  PyObject_HEAD
  int __pyx_v_category;
  unsigned long __pyx_v_count;
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_size;
  unsigned int __pyx_v_threshold;
};


/* "colibricore_wrapper.pyx":3839
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_66_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self;
  unsigned int __pyx_v_value;
};


/* "colibricore_wrapper.pyx":4046
 *         return self.has(indexreference)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples"""
 *         cdef cIndexedCorpus.iterator it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ {
  PyObject_HEAD
  IndexedCorpus::iterator __pyx_v_endit;
  IndexedCorpus::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4072
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes and their unigram patterns. Yields ((sentence,tokenoffset), unigrampattern) tuples"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_68_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  IndexedCorpus::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4085
 *             inc(it)
 * 
 *     def findpattern(self, Pattern pattern, int sentence = 0, bool instantiate = False):             # <<<<<<<<<<<<<<
 *         """Generator over the indexes in the corpus where this pattern is found. Note that this is much slower than using the forward index on an IndexedPatternModel!!!
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_foundpattern;
  bool __pyx_v_instantiate;
  std::vector<std::pair<IndexReference,PatternPointer> > ::iterator __pyx_v_it;
  std::vector<std::pair<IndexReference,PatternPointer> >  __pyx_v_matches;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  IndexReference __pyx_v_ref;
  struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self;
  int __pyx_v_sentence;
};


/* "colibricore_wrapper.pyx":4132
 *         return pattern
 * 
 *     def sentences(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all sentences, returning each as a pattern"""
 *         cdef int sentencecount = self.data.sentences()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences {
  PyObject_HEAD
  long __pyx_v_i;
  struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self;
  int __pyx_v_sentencecount;
  long __pyx_t_0;
  long __pyx_t_1;
  long __pyx_t_2;
};


/* "colibricore_wrapper.pyx":4163
 *         self.data.insert(pattern.cpattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternVector.iterator it_end = self.data.end()
 *         cdef cPatternVector.iterator it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ {
  PyObject_HEAD
  PatternVector::iterator __pyx_v_it;
  PatternVector::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4219
 *         self.setdata(pattern, value)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_72_items {
  PyObject_HEAD
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it;
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self;
  PatternFeatureVector<double>  *__pyx_v_v;
};


/* "colibricore_wrapper.pyx":4230
 *             inc(it)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ {
  PyObject_HEAD
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it;
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self;
  PatternFeatureVector<double>  *__pyx_v_v;
};


/* "colibricore_wrapper.pyx":4335
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternAlignmentModel<double> ::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4415
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternFeatureVectorMaps in this model"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_75_items {
  PyObject_HEAD
  PatternFeatureVectorMap<double>  __pyx_v_cmap;
  Pattern __pyx_v_cpattern;
  PatternAlignmentModel<double> ::iterator __pyx_v_it;
  PatternAlignmentModel<double> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_pmap;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4431
 *             inc(it)
 * 
 *     def triples(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern, feature triples"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples {
  PyObject_HEAD
  PatternFeatureVectorMap<double>  __pyx_v_cmap;
  Pattern __pyx_v_cpattern;
  PatternFeatureVector<double>  *__pyx_v_cvec;
  PatternAlignmentModel<double> ::iterator __pyx_v_it;
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it2;
  PatternFeatureVectorMap<double> ::iterator __pyx_v_it2_end;
  PatternAlignmentModel<double> ::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_sourcepattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_targetpattern;
};


/* "colibricore_wrapper.pyx":4565
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  BasicPatternAlignmentModel::iterator __pyx_v_it;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4634
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_78_items {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  PatternVector __pyx_v_cvec;
  BasicPatternAlignmentModel::iterator __pyx_v_it;
  BasicPatternAlignmentModel::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern;
  struct __pyx_obj_11colibricore_PatternVector *__pyx_v_pvec;
  struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self;
};


/* "colibricore_wrapper.pyx":4649
 *             inc(it)
 * 
 *     def pairs(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern pairs"""
 *         it = self.data.begin()
 */
struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs {
  PyObject_HEAD
  Pattern __pyx_v_cpattern;
  Pattern __pyx_v_ctargetpattern;
  PatternVector __pyx_v_cvec;
  BasicPatternAlignmentModel::iterator __pyx_v_it;
  PatternVector::iterator __pyx_v_it2;
  PatternVector::iterator __pyx_v_it2_end;
  BasicPatternAlignmentModel::iterator __pyx_v_it_end;
  struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_sourcepattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_targetpattern;
};



/* "colibricore_wrapper.pyx":164
 *     return pattern
 * 
 * cdef class Pattern:             # <<<<<<<<<<<<<<
 *     """The Pattern class contains an ngram, skipgram or flexgram, and allows a wide variety of actions to be performed on it. It is stored in a memory-efficient fashion and facilitating fast operation and comparison. Use ClassEncoder.buildpattern to build a pattern."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_Pattern {
  Pattern (*getcpattern)(struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*bind)(struct __pyx_obj_11colibricore_Pattern *, Pattern &);
  struct __pyx_obj_11colibricore_Pattern *(*add)(struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *);
};
static struct __pyx_vtabstruct_11colibricore_Pattern *__pyx_vtabptr_11colibricore_Pattern;


/* "colibricore_wrapper.pyx":470
 * 
 * 
 * cdef class IndexedData:             # <<<<<<<<<<<<<<
 *     """IndexedData is essentially a set of indexes in the form of (sentence,token) tuples, sentence is generally 1-indexed, token is always 0-indexed. It is used by Indexed Pattern Models to keep track of exact occurrences of all the patterns. Use len() to if you're merely interested in the number of occurrences, rather than their exact wherabouts."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_IndexedData {
  PyObject *(*bind)(struct __pyx_obj_11colibricore_IndexedData *, IndexedData);
};
static struct __pyx_vtabstruct_11colibricore_IndexedData *__pyx_vtabptr_11colibricore_IndexedData;


/* "colibricore_wrapper.pyx":507
 * 
 * 
 * cdef class PatternSet:             # <<<<<<<<<<<<<<
 *     """This is a simple low-level set that contains Pattern instances"""
 *     cdef cPatternSet[uint] data
 */

struct __pyx_vtabstruct_11colibricore_PatternSet {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternSet *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_PatternSet *__pyx_vtabptr_11colibricore_PatternSet;


/* "colibricore_wrapper.pyx":562
 * 
 * 
 * cdef class PatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_PatternDict_int32 {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*bind)(struct __pyx_obj_11colibricore_PatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  &);
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_int32 *__pyx_vtabptr_11colibricore_PatternDict_int32;


/* "colibricore_wrapper.pyx":643
 * 
 * 
 * cdef class SmallPatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a Small version taht allows at most 65536 patterns."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_SmallPatternDict_int32 {
  PyObject *(*has)(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*bind)(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t>  &);
};
static struct __pyx_vtabstruct_11colibricore_SmallPatternDict_int32 *__pyx_vtabptr_11colibricore_SmallPatternDict_int32;


/* "colibricore_wrapper.pyx":723
 * 
 * 
 * cdef class TinyPatternDict_int32: #maps Patterns to uint32             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a tiny version that allow only up to 256 patterns."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_TinyPatternDict_int32 {
  PyObject *(*has)(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*bind)(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t>  &);
};
static struct __pyx_vtabstruct_11colibricore_TinyPatternDict_int32 *__pyx_vtabptr_11colibricore_TinyPatternDict_int32;


/* "colibricore_wrapper.pyx":802
 *         self.data = newdata
 * 
 * cdef class PatternDict_int: #maps Patterns to uint64             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_PatternDict_int {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternDict_int *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_int *__pyx_vtabptr_11colibricore_PatternDict_int;


/* "colibricore_wrapper.pyx":878
 *         self.data[pattern.cpattern] = v
 * 
 * cdef class PatternDict_float: #maps Patterns to float             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and float (double) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_PatternDict_float {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternDict_float *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_float *__pyx_vtabptr_11colibricore_PatternDict_float;


/* "colibricore_wrapper.pyx":955
 * 
 * 
 * cdef class AlignedPatternDict_int32: #maps Patterns to Patterns to uint32 (nested dicts)             # <<<<<<<<<<<<<<
 *     """This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead."""
 * 
 */

struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 {
  PyObject *(*has)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*haspair)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *(*getmap)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*getpair)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*setpair)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, uint32_t, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *__pyx_vtabptr_11colibricore_AlignedPatternDict_int32;


/* "colibricore_wrapper.pyx":1115
 * 
 * 
 * cdef class IndexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Indexed Pattern Model. Implemented using a hash map (dictionary)"""
 * 
 */

struct __pyx_vtabstruct_11colibricore_IndexedPatternModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*loadconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbysetmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*write)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*printmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
  PyObject *(*train)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train *__pyx_optional_args);
  PyObject *(*train_filtered)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_IndexedPatternModel *);
  PyObject *(*trainconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbypatternsetmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyalignmodel)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch);
  PyObject *(*report)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*printhistogram)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*prune)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune *__pyx_optional_args);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*add)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*outputrelations)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *__pyx_vtabptr_11colibricore_IndexedPatternModel;


/* "colibricore_wrapper.pyx":1941
 *         return self.data.computeflexgrams_fromcooc(threshold)
 * 
 * cdef class HashOrderedIndexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Indexed Pattern Model. Implemented using an ordered map"""
 * 
 */

struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*loadconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbysetmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*write)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*printmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
  PyObject *(*train)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train *__pyx_optional_args);
  PyObject *(*train_filtered)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *);
  PyObject *(*trainconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbypatternsetmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyalignmodel)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch);
  PyObject *(*report)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*printhistogram)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*prune)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune *__pyx_optional_args);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*add)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*outputrelations)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *__pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel;


/* "colibricore_wrapper.pyx":2767
 *         return self.data.computeflexgrams_fromcooc(threshold)
 * 
 * cdef class PatternSetModel:             # <<<<<<<<<<<<<<
 *     cdef cPatternSetModel data
 * 
 */

struct __pyx_vtabstruct_11colibricore_PatternSetModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternSetModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_PatternSetModel *);
};
static struct __pyx_vtabstruct_11colibricore_PatternSetModel *__pyx_vtabptr_11colibricore_PatternSetModel;


/* "colibricore_wrapper.pyx":2869
 *     self.data.write(encode(filename))
 * 
 * cdef class UnindexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Unindexed Pattern Model, less flexible and powerful than its indexed counterpart, but smaller memory footprint"""
 *     cdef cPatternModel[uint32_t,cBaseValueHandler[uint32_t],cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint64_t]] data
 */

struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*loadconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbysetmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*write)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*printmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
  PyObject *(*train)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train *__pyx_optional_args);
  PyObject *(*train_filtered)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_UnindexedPatternModel *);
  PyObject *(*trainconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbypatternsetmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyalignmodel)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch);
  PyObject *(*report)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*printhistogram)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*prune)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune *__pyx_optional_args);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*add)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add *__pyx_optional_args);
};
static struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *__pyx_vtabptr_11colibricore_UnindexedPatternModel;


/* "colibricore_wrapper.pyx":3366
 * 
 * 
 * cdef class OrderedUnindexedPatternModel:             # <<<<<<<<<<<<<<
 *     """Unindexed Pattern Model, implemented using an ordered map, less flexible and powerful than its indexed counterpart, but smaller memory footprint"""
 *     cdef cPatternModel[uint32_t,cBaseValueHandler[uint32_t],cHashOrderedPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint64_t]] data
 */

struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*loadconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*loadconstrainedbysetmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*write)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*printmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch);
  PyObject *(*train)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train *__pyx_optional_args);
  PyObject *(*train_filtered)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *);
  PyObject *(*trainconstrainedbyindexedmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyunindexedmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbypatternsetmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch);
  PyObject *(*trainconstrainedbyalignmodel)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch);
  PyObject *(*report)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*printhistogram)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int __pyx_skip_dispatch);
  PyObject *(*prune)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune *__pyx_optional_args);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
  PyObject *(*add)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add *__pyx_optional_args);
};
static struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *__pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel;


/* "colibricore_wrapper.pyx":3978
 *             raise KeyError
 * 
 * cdef class IndexedCorpus:             # <<<<<<<<<<<<<<
 *     """An indexed version of a corpus, reads an entire corpus (colibri.dat file) in memory"""
 *     cdef cIndexedCorpus * data
 */

struct __pyx_vtabstruct_11colibricore_IndexedCorpus {
  PyObject *(*bind)(struct __pyx_obj_11colibricore_IndexedCorpus *, IndexedCorpus *, struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind *__pyx_optional_args);
  PyObject *(*has)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *);
  PyObject *(*get)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *);
  PyObject *(*getslice)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_11colibricore_IndexedCorpus *__pyx_vtabptr_11colibricore_IndexedCorpus;


/* "colibricore_wrapper.pyx":4142
 *         return self.data.sentencelength(sentence)
 * 
 * cdef class PatternVector:             # <<<<<<<<<<<<<<
 *     cdef cPatternVector data
 * 
 */

struct __pyx_vtabstruct_11colibricore_PatternVector {
  PyObject *(*bind)(struct __pyx_obj_11colibricore_PatternVector *, PatternVector &);
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternVector *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*append)(struct __pyx_obj_11colibricore_PatternVector *, struct __pyx_obj_11colibricore_Pattern *);
};
static struct __pyx_vtabstruct_11colibricore_PatternVector *__pyx_vtabptr_11colibricore_PatternVector;


/* "colibricore_wrapper.pyx":4172
 *             inc(it)
 * 
 * cdef class PatternFeatureVectorMap_float:             # <<<<<<<<<<<<<<
 *     cdef cPatternFeatureVectorMap[double] data
 *     cdef cPatternFeatureVectorMap[double].iterator it
 */

struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float {
  PyObject *(*bind)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, PatternFeatureVectorMap<double>  &);
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*setdata)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *__pyx_vtabptr_11colibricore_PatternFeatureVectorMap_float;


/* "colibricore_wrapper.pyx":4244
 * 
 * 
 * cdef class PatternAlignmentModel_float:             # <<<<<<<<<<<<<<
 *     """Pattern Alignment Model, maps patterns to pattern to score vectors (float)"""
 *     cdef cPatternAlignmentModel[double] data
 */

struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float {
  PyObject *(*has)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*hastuple)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*write)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, PyObject *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*getfeatures)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, PatternFeatureVector<double>  *);
  PyObject *(*getdatatuple)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*add)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *__pyx_vtabptr_11colibricore_PatternAlignmentModel_float;


/* "colibricore_wrapper.pyx":4473
 * 
 * 
 * cdef class BasicPatternAlignmentModel:             # <<<<<<<<<<<<<<
 *     """Pattern Alignment Model, maps patterns to pattern to score vectors (float)"""
 *     cdef cBasicPatternAlignmentModel data
 */

struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel {
  PyObject *(*has)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*hastuple)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*write)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, PyObject *, int __pyx_skip_dispatch);
  PatternModelInterface *(*getinterface)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *);
  PyObject *(*getdata)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *);
  PyObject *(*add)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel *__pyx_vtabptr_11colibricore_BasicPatternAlignmentModel;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if CYTHON_FAST_PYCALL
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif // CYTHON_FAST_PYCALL
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.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);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* IncludeCppStringH.proto */
#include <string>

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* decode_cpp_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string(
         std::string cppstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    return __Pyx_decode_c_bytes(
        cppstring.data(), cppstring.size(), start, stop, encoding, errors, decode_func);
}

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
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);

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* None.proto */
#include <new>

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* CppExceptionConversion.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::bad_typeid& 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

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static Pattern __pyx_f_11colibricore_7Pattern_getcpattern(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_7Pattern_bind(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, Pattern &__pyx_v_cpattern); /* proto*/
static struct __pyx_obj_11colibricore_Pattern *__pyx_f_11colibricore_7Pattern_add(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other); /* proto*/
static PyObject *__pyx_f_11colibricore_11IndexedData_bind(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, IndexedData __pyx_v_cdata); /* proto*/
static PyObject *__pyx_f_11colibricore_10PatternSet_has(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_17PatternDict_int32_has(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_17PatternDict_int32_bind(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  &__pyx_v_newdata); /* proto*/
static PyObject *__pyx_f_11colibricore_22SmallPatternDict_int32_has(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_22SmallPatternDict_int32_bind(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t>  &__pyx_v_newdata); /* proto*/
static PyObject *__pyx_f_11colibricore_21TinyPatternDict_int32_has(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21TinyPatternDict_int32_bind(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t>  &__pyx_v_newdata); /* proto*/
static PyObject *__pyx_f_11colibricore_15PatternDict_int_has(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_17PatternDict_float_has(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_has(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_haspair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch); /* proto*/
static PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *__pyx_f_11colibricore_24AlignedPatternDict_int32_getmap(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_getpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_setpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, uint32_t __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_has(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_write(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_printmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_train(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_19IndexedPatternModel_getinterface(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_report(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_prune(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_getdata(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_add(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_outputrelations(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_has(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_write(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getinterface(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_report(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_prune(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getdata(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_add(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_outputrelations(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_15PatternSetModel_has(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_15PatternSetModel_getinterface(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_has(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_write(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_printmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_train(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_21UnindexedPatternModel_getinterface(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_report(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_prune(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_getdata(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_add(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_has(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_write(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getinterface(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_report(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_prune(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getdata(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_add(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_13IndexedCorpus_bind(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, IndexedCorpus *__pyx_v_d, struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_11colibricore_13IndexedCorpus_has(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item); /* proto*/
static PyObject *__pyx_f_11colibricore_13IndexedCorpus_get(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item); /* proto*/
static PyObject *__pyx_f_11colibricore_13IndexedCorpus_getslice(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop); /* proto*/
static PyObject *__pyx_f_11colibricore_13PatternVector_bind(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, PatternVector &__pyx_v_cvec); /* proto*/
static PyObject *__pyx_f_11colibricore_13PatternVector_has(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_13PatternVector_append(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_bind(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PatternFeatureVectorMap<double>  &__pyx_v_cmap); /* proto*/
static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_has(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_getdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_setdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_features, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_has(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_hastuple(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_write(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_27PatternAlignmentModel_float_getinterface(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getdata(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getfeatures(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PatternFeatureVector<double>  *__pyx_v_cvec); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getdatatuple(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_add(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, PyObject *__pyx_v_l, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_has(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_hastuple(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_write(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static PatternModelInterface *__pyx_f_11colibricore_26BasicPatternAlignmentModel_getinterface(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_getdata(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_add(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch); /* proto*/

/* Module declarations from 'libc.string' */

/* Module declarations from 'libcpp.string' */

/* Module declarations from 'libcpp' */

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'libcpp.utility' */

/* Module declarations from 'libcpp.set' */

/* Module declarations from 'libcpp.map' */

/* Module declarations from 'unordered_map' */

/* Module declarations from 'unordered_set' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'colibricore_classes' */

/* Module declarations from 'colibricore' */
static PyTypeObject *__pyx_ptype_11colibricore_ClassEncoder = 0;
static PyTypeObject *__pyx_ptype_11colibricore_ClassDecoder = 0;
static PyTypeObject *__pyx_ptype_11colibricore_Pattern = 0;
static PyTypeObject *__pyx_ptype_11colibricore_IndexedData = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternSet = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternDict_int32 = 0;
static PyTypeObject *__pyx_ptype_11colibricore_SmallPatternDict_int32 = 0;
static PyTypeObject *__pyx_ptype_11colibricore_TinyPatternDict_int32 = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternDict_int = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternDict_float = 0;
static PyTypeObject *__pyx_ptype_11colibricore_AlignedPatternDict_int32 = 0;
static PyTypeObject *__pyx_ptype_11colibricore_IndexedPatternModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore_HashOrderedIndexedPatternModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternSetModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore_UnindexedPatternModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore_OrderedUnindexedPatternModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternModelOptions = 0;
static PyTypeObject *__pyx_ptype_11colibricore_IndexedCorpus = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternVector = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternFeatureVectorMap_float = 0;
static PyTypeObject *__pyx_ptype_11colibricore_PatternAlignmentModel_float = 0;
static PyTypeObject *__pyx_ptype_11colibricore_BasicPatternAlignmentModel = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_1__ngrams_aux = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_2_parts = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_3_gaps = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_4_subngrams = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_5___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_6___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_8_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_9___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_10_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_11___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_12_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_13___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_14_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_15___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_16_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_17___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_18_children = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_19_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_20___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_21_getreverseindex = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_23_histogram = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_24_filter = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_25___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_26_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_27_getsubchildren = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_28_getsubparents = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_29_getleftneighbours = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_30_getrightneighbours = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_31_getskipcontent = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_32_gettemplates = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_33_getinstances = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_34_getcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_35_getleftcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_36_getrightcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_37___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_38_getreverseindex = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_40_histogram = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_41_filter = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_42___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_43_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_44_getsubchildren = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_45_getsubparents = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_46_getleftneighbours = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_47_getrightneighbours = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_48_getskipcontent = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_49_gettemplates = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_50_getinstances = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_51_getcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_52_getleftcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_53_getrightcooc = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_54___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_55___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_56_getreverseindex = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_58_histogram = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_59_filter = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_60_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_61___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_62_getreverseindex = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_64_histogram = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_65_filter = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_66_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_67___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_68_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_69_findpattern = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_70_sentences = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_71___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_72_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_73___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_74___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_75_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_76_triples = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_77___iter__ = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_78_items = 0;
static PyTypeObject *__pyx_ptype_11colibricore___pyx_scope_struct_79_pairs = 0;
static PyObject *__pyx_f_11colibricore_write(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector<unsigned int>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &); /*proto*/
#define __Pyx_MODULE_NAME "colibricore"
extern int __pyx_module_is_main_colibricore;
int __pyx_module_is_main_colibricore = 0;

/* Implementation of 'colibricore' */
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_all;
static const char __pyx_k_[] = "";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_cap[] = "cap";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_has[] = "has";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_File[] = "File ";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_gaps[] = "gaps";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_load[] = "load";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_maxn[] = "maxn";
static const char __pyx_k_minn[] = "minn";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_text[] = "text";
static const char __pyx_k_DEBUG[] = "DEBUG";
static const char __pyx_k_NGRAM[] = "NGRAM";
static const char __pyx_k_QUIET[] = "QUIET";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_pairs[] = "pairs";
static const char __pyx_k_parts[] = "parts";
static const char __pyx_k_prune[] = "prune";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_train[] = "train";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_amount[] = "amount";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_concat[] = "concat";
static const char __pyx_k_cutoff[] = "cutoff";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_exists[] = "exists";
static const char __pyx_k_filter[] = "filter";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_ngrams[] = "ngrams";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_report[] = "report";
static const char __pyx_k_Counter[] = "Counter";
static const char __pyx_k_DORESET[] = "DORESET";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_Pattern[] = "Pattern";
static const char __pyx_k_bindunk[] = "bindunk";
static const char __pyx_k_decoder[] = "decoder";
static const char __pyx_k_getcooc[] = "getcooc";
static const char __pyx_k_getdata[] = "getdata";
static const char __pyx_k_getpair[] = "getpair";
static const char __pyx_k_haspair[] = "haspair";
static const char __pyx_k_indices[] = "indices";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_os_path[] = "os.path";
static const char __pyx_k_pattern[] = "pattern";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_setdata[] = "setdata";
static const char __pyx_k_setpair[] = "setpair";
static const char __pyx_k_triples[] = "triples";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_Category[] = "Category";
static const char __pyx_k_FLEXGRAM[] = "FLEXGRAM";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_MAXSKIPS[] = "MAXSKIPS";
static const char __pyx_k_SKIPGRAM[] = "SKIPGRAM";
static const char __pyx_k_bindflex[] = "bindflex";
static const char __pyx_k_bindskip[] = "bindskip";
static const char __pyx_k_bytesize[] = "bytesize";
static const char __pyx_k_category[] = "category";
static const char __pyx_k_children[] = "children";
static const char __pyx_k_cpattern[] = "cpattern";
static const char __pyx_k_features[] = "features";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_pattern2[] = "pattern2";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_sentence[] = "sentence";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_MAXLENGTH[] = "MAXLENGTH";
static const char __pyx_k_MINLENGTH[] = "MINLENGTH";
static const char __pyx_k_MINTOKENS[] = "MINTOKENS";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_filterset[] = "filterset";
static const char __pyx_k_histogram[] = "histogram";
static const char __pyx_k_maxlength[] = "maxlength";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_minlength[] = "minlength";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_sentences[] = "sentences";
static const char __pyx_k_subngrams[] = "subngrams";
static const char __pyx_k_threshold[] = "threshold";
static const char __pyx_k_PatternSet[] = "PatternSet";
static const char __pyx_k_UNKPATTERN[] = "UNKPATTERN";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_addunknown[] = "addunknown";
static const char __pyx_k_ngrams_aux[] = "_ngrams_aux";
static const char __pyx_k_printmodel[] = "printmodel";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_sourcefile[] = "sourcefile";
static const char __pyx_k_targetfile[] = "targetfile";
static const char __pyx_k_DOSKIPGRAMS[] = "DOSKIPGRAMS";
static const char __pyx_k_FLEXPATTERN[] = "FLEXPATTERN";
static const char __pyx_k_IndexedData[] = "IndexedData";
static const char __pyx_k_SKIPPATTERN[] = "SKIPPATTERN";
static const char __pyx_k_colibricore[] = "colibricore";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_findpattern[] = "findpattern";
static const char __pyx_k_getinstance[] = "getinstance";
static const char __pyx_k_getleftcooc[] = "getleftcooc";
static const char __pyx_k_getsentence[] = "getsentence";
static const char __pyx_k_instantiate[] = "instantiate";
static const char __pyx_k_ClassDecoder[] = "ClassDecoder";
static const char __pyx_k_ClassEncoder[] = "ClassEncoder";
static const char __pyx_k_MINSKIPTYPES[] = "MINSKIPTYPES";
static const char __pyx_k_No_such_file[] = "No such file: ";
static const char __pyx_k_Pattern_gaps[] = "Pattern.gaps";
static const char __pyx_k_allowunknown[] = "allowunknown";
static const char __pyx_k_bindboundary[] = "bindboundary";
static const char __pyx_k_getdatatuple[] = "getdatatuple";
static const char __pyx_k_getinstances[] = "getinstances";
static const char __pyx_k_getrightcooc[] = "getrightcooc";
static const char __pyx_k_gettemplates[] = "gettemplates";
static const char __pyx_k_reverseindex[] = "reverseindex";
static const char __pyx_k_IndexedCorpus[] = "IndexedCorpus";
static const char __pyx_k_PRUNESUBSUMED[] = "PRUNESUBSUMED";
static const char __pyx_k_PatternVector[] = "PatternVector";
static const char __pyx_k_Pattern_parts[] = "Pattern.parts";
static const char __pyx_k_getsubparents[] = "getsubparents";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_DOREMOVENGRAMS[] = "DOREMOVENGRAMS";
static const char __pyx_k_DOREVERSEINDEX[] = "DOREVERSEINDEX";
static const char __pyx_k_Expected_tuple[] = "Expected tuple";
static const char __pyx_k_Pattern___iter[] = "Pattern.__iter__";
static const char __pyx_k_autoaddunknown[] = "autoaddunknown";
static const char __pyx_k_constrainmodel[] = "constrainmodel";
static const char __pyx_k_does_not_exist[] = " does not exist";
static const char __pyx_k_getskipcontent[] = "getskipcontent";
static const char __pyx_k_getsubchildren[] = "getsubchildren";
static const char __pyx_k_ignorenewlines[] = "ignorenewlines";
static const char __pyx_k_printhistogram[] = "printhistogram";
static const char __pyx_k_train_filtered[] = "train_filtered";
static const char __pyx_k_BOUNDARYPATTERN[] = "BOUNDARYPATTERN";
static const char __pyx_k_PatternDict_int[] = "PatternDict_int";
static const char __pyx_k_PatternSetModel[] = "PatternSetModel";
static const char __pyx_k_getreverseindex[] = "getreverseindex";
static const char __pyx_k_outputrelations[] = "outputrelations";
static const char __pyx_k_patternfromfile[] = "patternfromfile";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_DOPATTERNPERLINE[] = "DOPATTERNPERLINE";
static const char __pyx_k_PRUNENONSUBSUMED[] = "PRUNENONSUBSUMED";
static const char __pyx_k_Pattern_Category[] = "Pattern Category";
static const char __pyx_k_loadreverseindex[] = "loadreverseindex";
static const char __pyx_k_DOREMOVEFLEXGRAMS[] = "DOREMOVEFLEXGRAMS";
static const char __pyx_k_DOREMOVESKIPGRAMS[] = "DOREMOVESKIPGRAMS";
static const char __pyx_k_FileNotFoundError[] = "FileNotFoundError";
static const char __pyx_k_PatternDict_float[] = "PatternDict_float";
static const char __pyx_k_PatternDict_int32[] = "PatternDict_int32";
static const char __pyx_k_PatternSet___iter[] = "PatternSet.__iter__";
static const char __pyx_k_Pattern_subngrams[] = "Pattern.subngrams";
static const char __pyx_k_getleftneighbours[] = "getleftneighbours";
static const char __pyx_k_IndexedData___iter[] = "IndexedData.__iter__";
static const char __pyx_k_MINTOKENS_UNIGRAMS[] = "MINTOKENS_UNIGRAMS";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_getrightneighbours[] = "getrightneighbours";
static const char __pyx_k_IndexedCorpus_items[] = "IndexedCorpus.items";
static const char __pyx_k_IndexedPatternModel[] = "IndexedPatternModel";
static const char __pyx_k_MINTOKENS_SKIPGRAMS[] = "MINTOKENS_SKIPGRAMS";
static const char __pyx_k_PatternModelOptions[] = "PatternModelOptions";
static const char __pyx_k_Pattern__ngrams_aux[] = "Pattern._ngrams_aux";
static const char __pyx_k_occurrencethreshold[] = "occurrencethreshold";
static const char __pyx_k_IndexedCorpus___iter[] = "IndexedCorpus.__iter__";
static const char __pyx_k_PatternVector___iter[] = "PatternVector.__iter__";
static const char __pyx_k_PatternDict_int_items[] = "PatternDict_int.items";
static const char __pyx_k_TinyPatternDict_int32[] = "TinyPatternDict_int32";
static const char __pyx_k_UnindexedPatternModel[] = "UnindexedPatternModel";
static const char __pyx_k_DOSKIPGRAMS_EXHAUSTIVE[] = "DOSKIPGRAMS_EXHAUSTIVE";
static const char __pyx_k_PatternDict_int___iter[] = "PatternDict_int.__iter__";
static const char __pyx_k_PatternSetModel___iter[] = "PatternSetModel.__iter__";
static const char __pyx_k_SmallPatternDict_int32[] = "SmallPatternDict_int32";
static const char __pyx_k_IndexedCorpus_sentences[] = "IndexedCorpus.sentences";
static const char __pyx_k_No_reverse_index_loaded[] = "No reverse index loaded";
static const char __pyx_k_PatternDict_float_items[] = "PatternDict_float.items";
static const char __pyx_k_PatternDict_int32_items[] = "PatternDict_int32.items";
static const char __pyx_k_colibricore_wrapper_pyx[] = "colibricore_wrapper.pyx";
static const char __pyx_k_AlignedPatternDict_int32[] = "AlignedPatternDict_int32";
static const char __pyx_k_PatternDict_float___iter[] = "PatternDict_float.__iter__";
static const char __pyx_k_PatternDict_int32___iter[] = "PatternDict_int32.__iter__";
static const char __pyx_k_IndexedCorpus_findpattern[] = "IndexedCorpus.findpattern";
static const char __pyx_k_IndexedPatternModel_items[] = "IndexedPatternModel.items";
static const char __pyx_k_loadconstrainedbysetmodel[] = "loadconstrainedbysetmodel";
static const char __pyx_k_BasicPatternAlignmentModel[] = "BasicPatternAlignmentModel";
static const char __pyx_k_IndexedPatternModel___iter[] = "IndexedPatternModel.__iter__";
static const char __pyx_k_IndexedPatternModel_filter[] = "IndexedPatternModel.filter";
static const char __pyx_k_getreverseindex_bysentence[] = "getreverseindex_bysentence";
static const char __pyx_k_IndexedPatternModel_getcooc[] = "IndexedPatternModel.getcooc";
static const char __pyx_k_PatternAlignmentModel_float[] = "PatternAlignmentModel_float";
static const char __pyx_k_TinyPatternDict_int32_items[] = "TinyPatternDict_int32.items";
static const char __pyx_k_UnindexedPatternModel_items[] = "UnindexedPatternModel.items";
static const char __pyx_k_Expected_instance_of_Pattern[] = "Expected instance of Pattern";
static const char __pyx_k_Key_must_be_Pattern_instance[] = "Key must be Pattern instance";
static const char __pyx_k_OrderedUnindexedPatternModel[] = "OrderedUnindexedPatternModel";
static const char __pyx_k_SmallPatternDict_int32_items[] = "SmallPatternDict_int32.items";
static const char __pyx_k_TinyPatternDict_int32___iter[] = "TinyPatternDict_int32.__iter__";
static const char __pyx_k_UnindexedPatternModel___iter[] = "UnindexedPatternModel.__iter__";
static const char __pyx_k_UnindexedPatternModel_filter[] = "UnindexedPatternModel.filter";
static const char __pyx_k_trainconstrainedbyalignmodel[] = "trainconstrainedbyalignmodel";
static const char __pyx_k_IndexedPatternModel_histogram[] = "IndexedPatternModel.histogram";
static const char __pyx_k_PatternFeatureVectorMap_float[] = "PatternFeatureVectorMap_float.__iter__";
static const char __pyx_k_SmallPatternDict_int32___iter[] = "SmallPatternDict_int32.__iter__";
static const char __pyx_k_loadconstrainedbyindexedmodel[] = "loadconstrainedbyindexedmodel";
static const char __pyx_k_AlignedPatternDict_int32_items[] = "AlignedPatternDict_int32.items";
static const char __pyx_k_Expected_two_tuple_of_Patterns[] = "Expected two-tuple of Patterns";
static const char __pyx_k_HashOrderedIndexedPatternModel[] = "HashOrderedIndexedPatternModel.__iter__";
static const char __pyx_k_trainconstrainedbyindexedmodel[] = "trainconstrainedbyindexedmodel";
static const char __pyx_k_AlignedPatternDict_int32___iter[] = "AlignedPatternDict_int32.__iter__";
static const char __pyx_k_Expected_instance_of_Pattern_or[] = "Expected instance of Pattern or two-tuple of Patterns";
static const char __pyx_k_Expected_list_with_instances_of[] = "Expected list with instances of float";
static const char __pyx_k_Expected_tuple_for_end_of_slice[] = "Expected tuple for end of slice";
static const char __pyx_k_IndexedPatternModel_getleftcooc[] = "IndexedPatternModel.getleftcooc";
static const char __pyx_k_Invalid_type_for_constrainmodel[] = "Invalid type for constrainmodel";
static const char __pyx_k_PatternFeatureVectorMap_float_2[] = "PatternFeatureVectorMap_float";
static const char __pyx_k_UnindexedPatternModel_histogram[] = "UnindexedPatternModel.histogram";
static const char __pyx_k_loadconstrainedbyunindexedmodel[] = "loadconstrainedbyunindexedmodel";
static const char __pyx_k_AlignedPatternDict_int32_childre[] = "AlignedPatternDict_int32.children";
static const char __pyx_k_Argument_must_be_Pattern_instanc[] = "Argument must be Pattern instance";
static const char __pyx_k_BasicPatternAlignmentModel___ite[] = "BasicPatternAlignmentModel.__iter__";
static const char __pyx_k_BasicPatternAlignmentModel_items[] = "BasicPatternAlignmentModel.items";
static const char __pyx_k_BasicPatternAlignmentModel_pairs[] = "BasicPatternAlignmentModel.pairs";
static const char __pyx_k_Expected_tuple_for_start_of_slic[] = "Expected tuple for start of slice";
static const char __pyx_k_HashOrderedIndexedPatternModel_2[] = "HashOrderedIndexedPatternModel";
static const char __pyx_k_HashOrderedIndexedPatternModel_f[] = "HashOrderedIndexedPatternModel.filter";
static const char __pyx_k_HashOrderedIndexedPatternModel_g[] = "HashOrderedIndexedPatternModel.getreverseindex";
static const char __pyx_k_HashOrderedIndexedPatternModel_h[] = "HashOrderedIndexedPatternModel.histogram";
static const char __pyx_k_HashOrderedIndexedPatternModel_i[] = "HashOrderedIndexedPatternModel.items";
static const char __pyx_k_IndexedPatternModel_getinstances[] = "IndexedPatternModel.getinstances";
static const char __pyx_k_IndexedPatternModel_getleftneigh[] = "IndexedPatternModel.getleftneighbours";
static const char __pyx_k_IndexedPatternModel_getreversein[] = "IndexedPatternModel.getreverseindex";
static const char __pyx_k_IndexedPatternModel_getrightcooc[] = "IndexedPatternModel.getrightcooc";
static const char __pyx_k_IndexedPatternModel_getrightneig[] = "IndexedPatternModel.getrightneighbours";
static const char __pyx_k_IndexedPatternModel_getskipconte[] = "IndexedPatternModel.getskipcontent";
static const char __pyx_k_IndexedPatternModel_getsubchildr[] = "IndexedPatternModel.getsubchildren";
static const char __pyx_k_IndexedPatternModel_getsubparent[] = "IndexedPatternModel.getsubparents";
static const char __pyx_k_IndexedPatternModel_gettemplates[] = "IndexedPatternModel.gettemplates";
static const char __pyx_k_Item_should_be_a_2_tuple_sentenc[] = "Item should be a 2-tuple (sentence,token)";
static const char __pyx_k_No_filename_or_reverseindex_spec[] = "No filename or reverseindex specified!";
static const char __pyx_k_No_reverseindex_was_specified_bu[] = "No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction";
static const char __pyx_k_No_reversindex_was_specified_but[] = "No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction";
static const char __pyx_k_OrderedUnindexedPatternModel___i[] = "OrderedUnindexedPatternModel.__iter__";
static const char __pyx_k_OrderedUnindexedPatternModel_fil[] = "OrderedUnindexedPatternModel.filter";
static const char __pyx_k_OrderedUnindexedPatternModel_get[] = "OrderedUnindexedPatternModel.getreverseindex";
static const char __pyx_k_OrderedUnindexedPatternModel_his[] = "OrderedUnindexedPatternModel.histogram";
static const char __pyx_k_OrderedUnindexedPatternModel_ite[] = "OrderedUnindexedPatternModel.items";
static const char __pyx_k_PatternAlignmentModel_float___it[] = "PatternAlignmentModel_float.__iter__";
static const char __pyx_k_PatternAlignmentModel_float_item[] = "PatternAlignmentModel_float.items";
static const char __pyx_k_PatternAlignmentModel_float_trip[] = "PatternAlignmentModel_float.triples";
static const char __pyx_k_PatternFeatureVectorMap_float_it[] = "PatternFeatureVectorMap_float.items";
static const char __pyx_k_Slices_only_supported_within_the[] = "Slices only supported within the same sentence";
static const char __pyx_k_UnindexedPatternModel_getreverse[] = "UnindexedPatternModel.getreverseindex";
static const char __pyx_k_Value_must_be_tuple_containing_f[] = "Value must be tuple containing floats";
static const char __pyx_k_self_coptions_cannot_be_converte[] = "self.coptions cannot be converted to a Python object for pickling";
static const char __pyx_k_self_cpattern_cannot_be_converte[] = "self.cpattern cannot be converted to a Python object for pickling";
static const char __pyx_k_self_data_cannot_be_converted_to[] = "self.data cannot be converted to a Python object for pickling";
static const char __pyx_k_self_data_self_it_cannot_be_conv[] = "self.data,self.it cannot be converted to a Python object for pickling";
static const char __pyx_k_self_data_self_it_self_it_end_ca[] = "self.data,self.it,self.it_end cannot be converted to a Python object for pickling";
static const char __pyx_k_trainconstrainedbypatternsetmode[] = "trainconstrainedbypatternsetmodel";
static const char __pyx_k_trainconstrainedbyunindexedmodel[] = "trainconstrainedbyunindexedmodel";
static const char __pyx_k_Expected_instance_of_Pattern_or_2[] = "Expected instance of Pattern or 2-tuple of Patterns";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_2[] = "HashOrderedIndexedPatternModel.getreverseindex_bysentence";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_3[] = "HashOrderedIndexedPatternModel.getsubchildren";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_4[] = "HashOrderedIndexedPatternModel.getsubparents";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_5[] = "HashOrderedIndexedPatternModel.getleftneighbours";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_6[] = "HashOrderedIndexedPatternModel.getrightneighbours";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_7[] = "HashOrderedIndexedPatternModel.getskipcontent";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_8[] = "HashOrderedIndexedPatternModel.gettemplates";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_9[] = "HashOrderedIndexedPatternModel.getinstances";
static const char __pyx_k_IndexedPatternModel_getreversein_2[] = "IndexedPatternModel.getreverseindex_bysentence";
static const char __pyx_k_OrderedUnindexedPatternModel_get_2[] = "OrderedUnindexedPatternModel.getreverseindex_bysentence";
static const char __pyx_k_UnindexedPatternModel_getreverse_2[] = "UnindexedPatternModel.getreverseindex_bysentence";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_10[] = "HashOrderedIndexedPatternModel.getcooc";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_11[] = "HashOrderedIndexedPatternModel.getleftcooc";
static const char __pyx_k_HashOrderedIndexedPatternModel_g_12[] = "HashOrderedIndexedPatternModel.getrightcooc";
static PyObject *__pyx_kp_u_;
static PyObject *__pyx_n_s_AlignedPatternDict_int32;
static PyObject *__pyx_n_s_AlignedPatternDict_int32___iter;
static PyObject *__pyx_n_s_AlignedPatternDict_int32_childre;
static PyObject *__pyx_n_s_AlignedPatternDict_int32_items;
static PyObject *__pyx_kp_u_Argument_must_be_Pattern_instanc;
static PyObject *__pyx_n_s_BOUNDARYPATTERN;
static PyObject *__pyx_n_s_BasicPatternAlignmentModel;
static PyObject *__pyx_n_s_BasicPatternAlignmentModel___ite;
static PyObject *__pyx_n_s_BasicPatternAlignmentModel_items;
static PyObject *__pyx_n_s_BasicPatternAlignmentModel_pairs;
static PyObject *__pyx_n_s_Category;
static PyObject *__pyx_n_s_ClassDecoder;
static PyObject *__pyx_n_s_ClassEncoder;
static PyObject *__pyx_n_s_Counter;
static PyObject *__pyx_n_u_DEBUG;
static PyObject *__pyx_n_u_DOPATTERNPERLINE;
static PyObject *__pyx_n_u_DOREMOVEFLEXGRAMS;
static PyObject *__pyx_n_u_DOREMOVENGRAMS;
static PyObject *__pyx_n_u_DOREMOVESKIPGRAMS;
static PyObject *__pyx_n_u_DORESET;
static PyObject *__pyx_n_u_DOREVERSEINDEX;
static PyObject *__pyx_n_s_DOSKIPGRAMS;
static PyObject *__pyx_n_u_DOSKIPGRAMS;
static PyObject *__pyx_n_u_DOSKIPGRAMS_EXHAUSTIVE;
static PyObject *__pyx_kp_u_Expected_instance_of_Pattern;
static PyObject *__pyx_kp_u_Expected_instance_of_Pattern_or;
static PyObject *__pyx_kp_u_Expected_instance_of_Pattern_or_2;
static PyObject *__pyx_kp_u_Expected_list_with_instances_of;
static PyObject *__pyx_kp_u_Expected_tuple;
static PyObject *__pyx_kp_u_Expected_tuple_for_end_of_slice;
static PyObject *__pyx_kp_u_Expected_tuple_for_start_of_slic;
static PyObject *__pyx_kp_u_Expected_two_tuple_of_Patterns;
static PyObject *__pyx_n_s_FLEXGRAM;
static PyObject *__pyx_n_s_FLEXPATTERN;
static PyObject *__pyx_kp_u_File;
static PyObject *__pyx_n_s_FileNotFoundError;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_2;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_f;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_10;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_11;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_12;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_2;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_3;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_4;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_5;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_6;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_7;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_8;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_g_9;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_h;
static PyObject *__pyx_n_s_HashOrderedIndexedPatternModel_i;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_n_s_IndexedCorpus;
static PyObject *__pyx_n_s_IndexedCorpus___iter;
static PyObject *__pyx_n_s_IndexedCorpus_findpattern;
static PyObject *__pyx_n_s_IndexedCorpus_items;
static PyObject *__pyx_n_s_IndexedCorpus_sentences;
static PyObject *__pyx_n_s_IndexedData;
static PyObject *__pyx_n_s_IndexedData___iter;
static PyObject *__pyx_n_s_IndexedPatternModel;
static PyObject *__pyx_n_s_IndexedPatternModel___iter;
static PyObject *__pyx_n_s_IndexedPatternModel_filter;
static PyObject *__pyx_n_s_IndexedPatternModel_getcooc;
static PyObject *__pyx_n_s_IndexedPatternModel_getinstances;
static PyObject *__pyx_n_s_IndexedPatternModel_getleftcooc;
static PyObject *__pyx_n_s_IndexedPatternModel_getleftneigh;
static PyObject *__pyx_n_s_IndexedPatternModel_getreversein;
static PyObject *__pyx_n_s_IndexedPatternModel_getreversein_2;
static PyObject *__pyx_n_s_IndexedPatternModel_getrightcooc;
static PyObject *__pyx_n_s_IndexedPatternModel_getrightneig;
static PyObject *__pyx_n_s_IndexedPatternModel_getskipconte;
static PyObject *__pyx_n_s_IndexedPatternModel_getsubchildr;
static PyObject *__pyx_n_s_IndexedPatternModel_getsubparent;
static PyObject *__pyx_n_s_IndexedPatternModel_gettemplates;
static PyObject *__pyx_n_s_IndexedPatternModel_histogram;
static PyObject *__pyx_n_s_IndexedPatternModel_items;
static PyObject *__pyx_kp_u_Invalid_type_for_constrainmodel;
static PyObject *__pyx_kp_u_Item_should_be_a_2_tuple_sentenc;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_u_Key_must_be_Pattern_instance;
static PyObject *__pyx_n_u_MAXLENGTH;
static PyObject *__pyx_n_u_MAXSKIPS;
static PyObject *__pyx_n_u_MINLENGTH;
static PyObject *__pyx_n_u_MINSKIPTYPES;
static PyObject *__pyx_n_u_MINTOKENS;
static PyObject *__pyx_n_u_MINTOKENS_SKIPGRAMS;
static PyObject *__pyx_n_u_MINTOKENS_UNIGRAMS;
static PyObject *__pyx_n_s_NGRAM;
static PyObject *__pyx_kp_u_No_filename_or_reverseindex_spec;
static PyObject *__pyx_kp_u_No_reverse_index_loaded;
static PyObject *__pyx_kp_u_No_reverseindex_was_specified_bu;
static PyObject *__pyx_kp_u_No_reversindex_was_specified_but;
static PyObject *__pyx_kp_u_No_such_file;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel___i;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel_fil;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel_get;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel_get_2;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel_his;
static PyObject *__pyx_n_s_OrderedUnindexedPatternModel_ite;
static PyObject *__pyx_n_u_PRUNENONSUBSUMED;
static PyObject *__pyx_n_u_PRUNESUBSUMED;
static PyObject *__pyx_n_s_Pattern;
static PyObject *__pyx_n_s_PatternAlignmentModel_float;
static PyObject *__pyx_n_s_PatternAlignmentModel_float___it;
static PyObject *__pyx_n_s_PatternAlignmentModel_float_item;
static PyObject *__pyx_n_s_PatternAlignmentModel_float_trip;
static PyObject *__pyx_n_s_PatternDict_float;
static PyObject *__pyx_n_s_PatternDict_float___iter;
static PyObject *__pyx_n_s_PatternDict_float_items;
static PyObject *__pyx_n_s_PatternDict_int;
static PyObject *__pyx_n_s_PatternDict_int32;
static PyObject *__pyx_n_s_PatternDict_int32___iter;
static PyObject *__pyx_n_s_PatternDict_int32_items;
static PyObject *__pyx_n_s_PatternDict_int___iter;
static PyObject *__pyx_n_s_PatternDict_int_items;
static PyObject *__pyx_n_s_PatternFeatureVectorMap_float;
static PyObject *__pyx_n_s_PatternFeatureVectorMap_float_2;
static PyObject *__pyx_n_s_PatternFeatureVectorMap_float_it;
static PyObject *__pyx_n_s_PatternModelOptions;
static PyObject *__pyx_n_s_PatternSet;
static PyObject *__pyx_n_s_PatternSetModel;
static PyObject *__pyx_n_s_PatternSetModel___iter;
static PyObject *__pyx_n_s_PatternSet___iter;
static PyObject *__pyx_n_s_PatternVector;
static PyObject *__pyx_n_s_PatternVector___iter;
static PyObject *__pyx_kp_s_Pattern_Category;
static PyObject *__pyx_n_s_Pattern___iter;
static PyObject *__pyx_n_s_Pattern__ngrams_aux;
static PyObject *__pyx_n_s_Pattern_gaps;
static PyObject *__pyx_n_s_Pattern_parts;
static PyObject *__pyx_n_s_Pattern_subngrams;
static PyObject *__pyx_n_u_QUIET;
static PyObject *__pyx_n_s_SKIPGRAM;
static PyObject *__pyx_n_s_SKIPPATTERN;
static PyObject *__pyx_kp_u_Slices_only_supported_within_the;
static PyObject *__pyx_n_s_SmallPatternDict_int32;
static PyObject *__pyx_n_s_SmallPatternDict_int32___iter;
static PyObject *__pyx_n_s_SmallPatternDict_int32_items;
static PyObject *__pyx_n_s_TinyPatternDict_int32;
static PyObject *__pyx_n_s_TinyPatternDict_int32___iter;
static PyObject *__pyx_n_s_TinyPatternDict_int32_items;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UNKPATTERN;
static PyObject *__pyx_n_s_UnindexedPatternModel;
static PyObject *__pyx_n_s_UnindexedPatternModel___iter;
static PyObject *__pyx_n_s_UnindexedPatternModel_filter;
static PyObject *__pyx_n_s_UnindexedPatternModel_getreverse;
static PyObject *__pyx_n_s_UnindexedPatternModel_getreverse_2;
static PyObject *__pyx_n_s_UnindexedPatternModel_histogram;
static PyObject *__pyx_n_s_UnindexedPatternModel_items;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_u_Value_must_be_tuple_containing_f;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_addunknown;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_allowunknown;
static PyObject *__pyx_n_s_amount;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_autoaddunknown;
static PyObject *__pyx_n_s_bindboundary;
static PyObject *__pyx_n_s_bindflex;
static PyObject *__pyx_n_s_bindskip;
static PyObject *__pyx_n_s_bindunk;
static PyObject *__pyx_n_s_bytesize;
static PyObject *__pyx_n_s_cap;
static PyObject *__pyx_n_s_category;
static PyObject *__pyx_n_s_children;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_colibricore;
static PyObject *__pyx_kp_s_colibricore_wrapper_pyx;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_concat;
static PyObject *__pyx_n_s_constrainmodel;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_cpattern;
static PyObject *__pyx_n_s_cutoff;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_decoder;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_kp_u_does_not_exist;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_exists;
static PyObject *__pyx_n_s_features;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_filter;
static PyObject *__pyx_n_s_filterset;
static PyObject *__pyx_n_s_findpattern;
static PyObject *__pyx_n_s_gaps;
static PyObject *__pyx_n_s_getcooc;
static PyObject *__pyx_n_s_getdata;
static PyObject *__pyx_n_s_getdatatuple;
static PyObject *__pyx_n_s_getinstance;
static PyObject *__pyx_n_s_getinstances;
static PyObject *__pyx_n_s_getleftcooc;
static PyObject *__pyx_n_s_getleftneighbours;
static PyObject *__pyx_n_s_getpair;
static PyObject *__pyx_n_s_getreverseindex;
static PyObject *__pyx_n_s_getreverseindex_bysentence;
static PyObject *__pyx_n_s_getrightcooc;
static PyObject *__pyx_n_s_getrightneighbours;
static PyObject *__pyx_n_s_getsentence;
static PyObject *__pyx_n_s_getskipcontent;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_getsubchildren;
static PyObject *__pyx_n_s_getsubparents;
static PyObject *__pyx_n_s_gettemplates;
static PyObject *__pyx_n_s_has;
static PyObject *__pyx_n_s_haspair;
static PyObject *__pyx_n_s_histogram;
static PyObject *__pyx_n_s_ignorenewlines;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_instantiate;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_load;
static PyObject *__pyx_n_s_loadconstrainedbyindexedmodel;
static PyObject *__pyx_n_s_loadconstrainedbysetmodel;
static PyObject *__pyx_n_s_loadconstrainedbyunindexedmodel;
static PyObject *__pyx_n_s_loadreverseindex;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_maxlength;
static PyObject *__pyx_n_s_maxn;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_minlength;
static PyObject *__pyx_n_s_minn;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_ngrams;
static PyObject *__pyx_n_s_ngrams_aux;
static PyObject *__pyx_n_s_occurrencethreshold;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_os_path;
static PyObject *__pyx_n_s_outputrelations;
static PyObject *__pyx_n_s_pairs;
static PyObject *__pyx_n_s_parts;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_pattern;
static PyObject *__pyx_n_s_pattern2;
static PyObject *__pyx_n_s_patternfromfile;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_printhistogram;
static PyObject *__pyx_n_s_printmodel;
static PyObject *__pyx_n_s_prune;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_report;
static PyObject *__pyx_n_s_reverseindex;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_kp_s_self_coptions_cannot_be_converte;
static PyObject *__pyx_kp_s_self_cpattern_cannot_be_converte;
static PyObject *__pyx_kp_s_self_data_cannot_be_converted_to;
static PyObject *__pyx_kp_s_self_data_self_it_cannot_be_conv;
static PyObject *__pyx_kp_s_self_data_self_it_self_it_end_ca;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_sentence;
static PyObject *__pyx_n_s_sentences;
static PyObject *__pyx_n_s_setdata;
static PyObject *__pyx_n_s_setpair;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sourcefile;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_subngrams;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_targetfile;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_text;
static PyObject *__pyx_n_s_threshold;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_train;
static PyObject *__pyx_n_s_train_filtered;
static PyObject *__pyx_n_s_trainconstrainedbyalignmodel;
static PyObject *__pyx_n_s_trainconstrainedbyindexedmodel;
static PyObject *__pyx_n_s_trainconstrainedbypatternsetmode;
static PyObject *__pyx_n_s_trainconstrainedbyunindexedmodel;
static PyObject *__pyx_n_s_triples;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_kp_u_utf_8;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_pf_11colibricore_encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static int __pyx_pf_11colibricore_12ClassEncoder___init__(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_v_minlength, int __pyx_v_maxlength); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_2filename(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_12ClassEncoder_4__len__(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_6buildpattern(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_text, bool __pyx_v_allowunknown, bool __pyx_v_autoaddunknown); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_8processcorpus(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_10buildclasses(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_12build(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_14encodefile(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_sourcefile, PyObject *__pyx_v_targetfile, bool __pyx_v_allowunknown, bool __pyx_v_addunknown, bool __pyx_v_append, bool __pyx_v_ignorenewlines); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_16save(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassEncoder_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_12ClassDecoder___init__(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_12ClassDecoder_2__len__(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassDecoder_4decodefile(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassDecoder_6filename(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassDecoder_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_12ClassDecoder_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_11colibricore_2patternfromfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_bindunk(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_2bindskip(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_4bindflex(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_6bindboundary(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_8tostring(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_10unknown(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_7Pattern_12__contains__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_7Pattern_14__bool__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_7Pattern_16__len__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_18__copy__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_20__deepcopy__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_22concat(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_24__add__(PyObject *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_26__getitem__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_28__iter__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_31bytesize(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_33skipcount(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_35category(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static Py_hash_t __pyx_pf_11colibricore_7Pattern_37__hash__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_39__richcmp__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_41reverse(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_43ngrams(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_n, int __pyx_v_maxn); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_45_ngrams_aux(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_48parts(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_51gaps(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_54toflexgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_56subngrams(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_minn, int __pyx_v_maxn); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_59tolist(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_61__bytes__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_63__getstate__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_65__setstate__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, PyObject *__pyx_v_byterep); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_67isgap(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_index); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_69isskipgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_71isflexgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_73instanceof(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_skipgram); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_75__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_Pattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_7Pattern_77__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_11IndexedData___contains__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_11colibricore_11IndexedData_2__iter__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_11IndexedData_5__len__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_11IndexedData_7__bool__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_11IndexedData_9__int__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_11IndexedData_11__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_11IndexedData_13__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_10PatternSet___bool__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_10PatternSet_2__len__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_10PatternSet_4has(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_10PatternSet_6__contains__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_10PatternSet_8__iter__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_10PatternSet_11add(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_10PatternSet_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_10PatternSet_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_int32___bool__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_17PatternDict_int32_2__len__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_4has(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_13items(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_16read(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_18write(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_22SmallPatternDict_int32___bool__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_22SmallPatternDict_int32_2__len__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_4has(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_22SmallPatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_13items(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_16read(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_18write(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_11colibricore_22SmallPatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_21TinyPatternDict_int32___bool__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_21TinyPatternDict_int32_2__len__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_4has(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_21TinyPatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_13items(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_16read(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_18write(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_11colibricore_21TinyPatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_15PatternDict_int___bool__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_15PatternDict_int_2__len__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_4has(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_15PatternDict_int_6__contains__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_8__iter__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_13items(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_16read(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_18write(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_11colibricore_15PatternDict_int_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_v); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternDict_int_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_float___bool__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_17PatternDict_float_2__len__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_4has(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_float_6__contains__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_8__iter__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_13items(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_16read(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_18write(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_11colibricore_17PatternDict_float_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, float __pyx_v_v); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_17PatternDict_float_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_24AlignedPatternDict_int32___len__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_2childcount(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_4has(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_6haspair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto */
static int __pyx_pf_11colibricore_24AlignedPatternDict_int32_8__contains__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_10__iter__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_13children(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_16items(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_19getpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_21setpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, uint32_t __pyx_v_value); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_23__getitem__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_pf_11colibricore_24AlignedPatternDict_int32_25__setitem__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_27read(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_29write(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_31__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_33__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_19IndexedPatternModel___len__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_19IndexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_4types(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_6tokens(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_8minlength(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_12type(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_14version(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_20coverage(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_22frequency(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static int __pyx_pf_11colibricore_19IndexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_19IndexedPatternModel_39__init__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_41load(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_51read(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_53write(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_57train(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_69report(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_73prune(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_83histogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_86top(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_88filter(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_93getdata(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_95add(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_97__iter__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_100items(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_103covered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_105outputrelations(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_107getsubchildren(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_110getsubparents(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_113getleftneighbours(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_116getrightneighbours(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_119getskipcontent(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_122gettemplates(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_125getinstances(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_128getcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_131getleftcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_134getrightcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_137computeflexgrams_fromskipgrams(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_139computeflexgrams_fromcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, double __pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_141__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_143__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel___len__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_4types(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_6tokens(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_8minlength(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_12type(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_14version(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_20coverage(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_22frequency(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_39__init__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_41load(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_51read(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_53write(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_57train(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_69report(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_73prune(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_83histogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_86top(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_88filter(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_93getdata(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_95add(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_97__iter__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_100items(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_103covered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_105outputrelations(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_107getsubchildren(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_110getsubparents(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_113getleftneighbours(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_116getrightneighbours(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_119getskipcontent(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_122gettemplates(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_125getinstances(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_128getcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_131getleftcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_134getrightcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_137computeflexgrams_fromskipgrams(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_139computeflexgrams_fromcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, double __pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_141__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_143__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_15PatternSetModel___bool__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_15PatternSetModel_2__len__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_4has(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_15PatternSetModel_6__contains__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_8__iter__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_11add(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static int __pyx_pf_11colibricore_15PatternSetModel_13__init__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_15load(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_17read(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_19write(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_21__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_15PatternSetModel_23__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_11colibricore_4write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_21UnindexedPatternModel___len__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_21UnindexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_4types(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_6tokens(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_8minlength(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_12type(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_14version(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_20coverage(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_22frequency(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static int __pyx_pf_11colibricore_21UnindexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_21UnindexedPatternModel_39__init__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_41load(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_51read(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_53write(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_57train(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_69report(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_73prune(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_83histogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_86top(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_88filter(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_93getdata(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_95items(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_98add(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_count); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_100__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_102__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_28OrderedUnindexedPatternModel___len__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_4types(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_6tokens(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_8minlength(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_12type(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_14version(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_20coverage(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_22frequency(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n); /* proto */
static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_39__init__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_41load(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_51read(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_53write(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_57train(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_69report(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_73prune(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_83histogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_86top(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_88filter(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_93getdata(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_95items(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_98add(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_count); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_100__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_102__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_19PatternModelOptions___init__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_11colibricore_19PatternModelOptions_2__setattr__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_4__getattr__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11colibricore_13IndexedCorpus___init__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static void __pyx_pf_11colibricore_13IndexedCorpus_2__dealloc__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_4filename(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_13IndexedCorpus_6__len__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_13IndexedCorpus_8__contains__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_indexreference); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_10__iter__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_13__getitem__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_15items(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_18findpattern(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_sentence, bool __pyx_v_instantiate); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_21getinstance(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_23sentencecount(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_25getsentence(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, int __pyx_v_i); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_27sentences(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_30sentencelength(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, int __pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_13PatternVector___len__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_13PatternVector_2__bool__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_13PatternVector_4__contains__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_13PatternVector_6__iter__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13PatternVector_9__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_13PatternVector_11__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_29PatternFeatureVectorMap_float___len__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_2__bool__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_4__contains__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_6__getitem__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_8setdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_features); /* proto */
static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_10__setitem__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_12items(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_15__iter__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_27PatternAlignmentModel_float___len__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_2__bool__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_4types(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_6tokens(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_8minlength(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_10maxlength(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_12type(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_14version(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_16__contains__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_18__getitem__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_20__iter__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_23__init__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_25load(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_27read(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_29write(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_31items(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_34triples(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_37add(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, PyObject *__pyx_v_l); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static Py_ssize_t __pyx_pf_11colibricore_26BasicPatternAlignmentModel___len__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_2__bool__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_4types(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_6tokens(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_8minlength(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_10maxlength(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_12type(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_14version(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_16__contains__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_18__getitem__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_20__iter__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_23__init__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_25load(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_27read(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_29write(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_31items(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_34pairs(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_37add(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_11colibricore_ClassEncoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_ClassDecoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_Pattern(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_IndexedData(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternDict_int32(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_SmallPatternDict_int32(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_TinyPatternDict_int32(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternDict_int(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternDict_float(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_AlignedPatternDict_int32(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_IndexedPatternModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_HashOrderedIndexedPatternModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternSetModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_UnindexedPatternModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_OrderedUnindexedPatternModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternModelOptions(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_IndexedCorpus(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternFeatureVectorMap_float(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_PatternAlignmentModel_float(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore_BasicPatternAlignmentModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_1__ngrams_aux(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_2_parts(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_3_gaps(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_4_subngrams(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_5___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_6___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_8_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_9___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_10_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_11___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_12_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_13___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_14_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_15___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_16_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_17___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_18_children(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_19_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_20___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_21_getreverseindex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_23_histogram(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_24_filter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_25___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_26_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_27_getsubchildren(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_28_getsubparents(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_29_getleftneighbours(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_30_getrightneighbours(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_31_getskipcontent(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_32_gettemplates(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_33_getinstances(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_34_getcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_35_getleftcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_36_getrightcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_37___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_38_getreverseindex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_40_histogram(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_41_filter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_42___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_43_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_44_getsubchildren(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_45_getsubparents(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_46_getleftneighbours(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_47_getrightneighbours(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_48_getskipcontent(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_49_gettemplates(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_50_getinstances(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_51_getcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_52_getleftcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_53_getrightcooc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_54___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_55___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_56_getreverseindex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_58_histogram(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_59_filter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_60_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_61___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_62_getreverseindex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_64_histogram(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_65_filter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_66_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_67___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_68_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_69_findpattern(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_70_sentences(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_71___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_72_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_73___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_74___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_75_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_76_triples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_77___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_78_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_79_pairs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__67;
/* Late includes */

/* "colibricore_wrapper.pyx":30
 * 
 * 
 * def encode(s):             # <<<<<<<<<<<<<<
 *     return s.encode('utf-8')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_1encode(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static PyMethodDef __pyx_mdef_11colibricore_1encode = {"encode", (PyCFunction)__pyx_pw_11colibricore_1encode, METH_O, 0};
static PyObject *__pyx_pw_11colibricore_1encode(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encode (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_encode(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encode", 0);

  /* "colibricore_wrapper.pyx":31
 * 
 * def encode(s):
 *     return s.encode('utf-8')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":30
 * 
 * 
 * def encode(s):             # <<<<<<<<<<<<<<
 *     return s.encode('utf-8')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":49
 *     cdef int maxlength
 * 
 *     def __init__(self, str filename=None, int minlength=0, int maxlength=0):             # <<<<<<<<<<<<<<
 *         self.minlength = minlength
 *         self.maxlength = maxlength
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_12ClassEncoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11colibricore_12ClassEncoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_v_minlength;
  int __pyx_v_maxlength;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_minlength,&__pyx_n_s_maxlength,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject*)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minlength);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlength);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 49, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_minlength = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_minlength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L3_error)
    } else {
      __pyx_v_minlength = ((int)0);
    }
    if (values[2]) {
      __pyx_v_maxlength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_maxlength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L3_error)
    } else {
      __pyx_v_maxlength = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 49, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.ClassEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 49, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder___init__(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), __pyx_v_filename, __pyx_v_minlength, __pyx_v_maxlength);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_12ClassEncoder___init__(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_v_minlength, int __pyx_v_maxlength) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":50
 * 
 *     def __init__(self, str filename=None, int minlength=0, int maxlength=0):
 *         self.minlength = minlength             # <<<<<<<<<<<<<<
 *         self.maxlength = maxlength
 *         if filename:
 */
  __pyx_v_self->minlength = __pyx_v_minlength;

  /* "colibricore_wrapper.pyx":51
 *     def __init__(self, str filename=None, int minlength=0, int maxlength=0):
 *         self.minlength = minlength
 *         self.maxlength = maxlength             # <<<<<<<<<<<<<<
 *         if filename:
 *             self._filename = filename
 */
  __pyx_v_self->maxlength = __pyx_v_maxlength;

  /* "colibricore_wrapper.pyx":52
 *         self.minlength = minlength
 *         self.maxlength = maxlength
 *         if filename:             # <<<<<<<<<<<<<<
 *             self._filename = filename
 *             if os.path.exists(filename):
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":53
 *         self.maxlength = maxlength
 *         if filename:
 *             self._filename = filename             # <<<<<<<<<<<<<<
 *             if os.path.exists(filename):
 *                 self.data.load(encode(filename), minlength, maxlength)
 */
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_v_filename;

    /* "colibricore_wrapper.pyx":54
 *         if filename:
 *             self._filename = filename
 *             if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 self.data.load(encode(filename), minlength, maxlength)
 *             else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(__pyx_t_1)) {

      /* "colibricore_wrapper.pyx":55
 *             self._filename = filename
 *             if os.path.exists(filename):
 *                 self.data.load(encode(filename), minlength, maxlength)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise FileNotFoundError("File " + filename + " does not exist")
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->data.load(__pyx_t_5, __pyx_v_minlength, __pyx_v_maxlength);

      /* "colibricore_wrapper.pyx":54
 *         if filename:
 *             self._filename = filename
 *             if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 self.data.load(encode(filename), minlength, maxlength)
 *             else:
 */
      goto __pyx_L4;
    }

    /* "colibricore_wrapper.pyx":57
 *                 self.data.load(encode(filename), minlength, maxlength)
 *             else:
 *                 raise FileNotFoundError("File " + filename + " does not exist")             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = ""
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_File, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_kp_u_does_not_exist); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 57, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "colibricore_wrapper.pyx":52
 *         self.minlength = minlength
 *         self.maxlength = maxlength
 *         if filename:             # <<<<<<<<<<<<<<
 *             self._filename = filename
 *             if os.path.exists(filename):
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":59
 *                 raise FileNotFoundError("File " + filename + " does not exist")
 *         else:
 *             self._filename = ""             # <<<<<<<<<<<<<<
 * 
 *     def filename(self):
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_GIVEREF(__pyx_kp_u_);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_kp_u_;
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":49
 *     cdef int maxlength
 * 
 *     def __init__(self, str filename=None, int minlength=0, int maxlength=0):             # <<<<<<<<<<<<<<
 *         self.minlength = minlength
 *         self.maxlength = maxlength
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.ClassEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":61
 *             self._filename = ""
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_3filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_3filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_2filename(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_2filename(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename", 0);

  /* "colibricore_wrapper.pyx":62
 * 
 *     def filename(self):
 *         return self._filename             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":61
 *             self._filename = ""
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":64
 *         return self._filename
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of classes"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_12ClassEncoder_5__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_4__len__[] = "Returns the total number of classes";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_12ClassEncoder_4__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_12ClassEncoder_5__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_4__len__(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_12ClassEncoder_4__len__(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":66
 *     def __len__(self):
 *         """Returns the total number of classes"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def buildpattern(self, str text, bool allowunknown=True, bool autoaddunknown=False):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":64
 *         return self._filename
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of classes"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":68
 *         return self.data.size()
 * 
 *     def buildpattern(self, str text, bool allowunknown=True, bool autoaddunknown=False):             # <<<<<<<<<<<<<<
 *         """Builds a pattern: converts a string representation into a Pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_7buildpattern(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_6buildpattern[] = "Builds a pattern: converts a string representation into a Pattern\n\n        :param text: The actual text of the pattern\n        :type text: str\n        :param allowunknown: Encode unknown classes as 'unknown', a single class for all, rather than failing with an exception if a word type is unseen (bool, default=False)\n        :type allowunknown: bool\n        :param autoaddunknown: Automatically add unknown classes to the model (bool, default=False)\n        :type autoaddunknown: bool\n        :rtype: Pattern\n        ";
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_7buildpattern(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  bool __pyx_v_allowunknown;
  bool __pyx_v_autoaddunknown;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("buildpattern (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_allowunknown,&__pyx_n_s_autoaddunknown,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allowunknown);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_autoaddunknown);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "buildpattern") < 0)) __PYX_ERR(1, 68, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_allowunknown = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_allowunknown == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 68, __pyx_L3_error)
    } else {
      __pyx_v_allowunknown = ((bool)1);
    }
    if (values[2]) {
      __pyx_v_autoaddunknown = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_autoaddunknown == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 68, __pyx_L3_error)
    } else {
      __pyx_v_autoaddunknown = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("buildpattern", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 68, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.ClassEncoder.buildpattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(1, 68, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_6buildpattern(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), __pyx_v_text, __pyx_v_allowunknown, __pyx_v_autoaddunknown);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_6buildpattern(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_text, bool __pyx_v_allowunknown, bool __pyx_v_autoaddunknown) {
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  Pattern __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("buildpattern", 0);

  /* "colibricore_wrapper.pyx":80
 *         """
 * 
 *         cdef cPattern cpattern = self.data.buildpattern(encode(text), allowunknown, autoaddunknown)             # <<<<<<<<<<<<<<
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_text) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_text);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_t_5 = __pyx_v_self->data.buildpattern(__pyx_t_4, __pyx_v_allowunknown, __pyx_v_autoaddunknown);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(1, 80, __pyx_L1_error)
  }
  __pyx_v_cpattern = __pyx_t_5;

  /* "colibricore_wrapper.pyx":81
 * 
 *         cdef cPattern cpattern = self.data.buildpattern(encode(text), allowunknown, autoaddunknown)
 *         pattern = Pattern()             # <<<<<<<<<<<<<<
 *         pattern.bind(cpattern)
 *         return pattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":82
 *         cdef cPattern cpattern = self.data.buildpattern(encode(text), allowunknown, autoaddunknown)
 *         pattern = Pattern()
 *         pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *         return pattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_pattern->__pyx_vtab)->bind(__pyx_v_pattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":83
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 *         return pattern             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
  __pyx_r = ((PyObject *)__pyx_v_pattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":68
 *         return self.data.size()
 * 
 *     def buildpattern(self, str text, bool allowunknown=True, bool autoaddunknown=False):             # <<<<<<<<<<<<<<
 *         """Builds a pattern: converts a string representation into a Pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.ClassEncoder.buildpattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":86
 * 
 * 
 *     def processcorpus(self, str filename): #build a class from this dataset             # <<<<<<<<<<<<<<
 *         """Process a corpus, call buildclasses() when finished with all corpora"""
 *         if os.path.exists(filename):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_9processcorpus(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_8processcorpus[] = "Process a corpus, call buildclasses() when finished with all corpora";
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_9processcorpus(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("processcorpus (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 86, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_8processcorpus(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_8processcorpus(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("processcorpus", 0);

  /* "colibricore_wrapper.pyx":88
 *     def processcorpus(self, str filename): #build a class from this dataset
 *         """Process a corpus, call buildclasses() when finished with all corpora"""
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.processcorpus(encode(filename), self.freqlist)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "colibricore_wrapper.pyx":89
 *         """Process a corpus, call buildclasses() when finished with all corpora"""
 *         if os.path.exists(filename):
 *             self.data.processcorpus(encode(filename), self.freqlist)             # <<<<<<<<<<<<<<
 * 
 *     def buildclasses(self):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.processcorpus(__pyx_t_5, __pyx_v_self->freqlist);

    /* "colibricore_wrapper.pyx":88
 *     def processcorpus(self, str filename): #build a class from this dataset
 *         """Process a corpus, call buildclasses() when finished with all corpora"""
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.processcorpus(encode(filename), self.freqlist)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":86
 * 
 * 
 *     def processcorpus(self, str filename): #build a class from this dataset             # <<<<<<<<<<<<<<
 *         """Process a corpus, call buildclasses() when finished with all corpora"""
 *         if os.path.exists(filename):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.ClassEncoder.processcorpus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":91
 *             self.data.processcorpus(encode(filename), self.freqlist)
 * 
 *     def buildclasses(self):             # <<<<<<<<<<<<<<
 *         """Build classes, call after processing all corpora with processcorpus()"""
 *         self.data.buildclasses(self.freqlist)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_11buildclasses(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_10buildclasses[] = "Build classes, call after processing all corpora with processcorpus()";
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_11buildclasses(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("buildclasses (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_10buildclasses(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_10buildclasses(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("buildclasses", 0);

  /* "colibricore_wrapper.pyx":93
 *     def buildclasses(self):
 *         """Build classes, call after processing all corpora with processcorpus()"""
 *         self.data.buildclasses(self.freqlist)             # <<<<<<<<<<<<<<
 * 
 *     def build(self, str filename): #build a class from this dataset
 */
  __pyx_v_self->data.buildclasses(__pyx_v_self->freqlist, NULL);

  /* "colibricore_wrapper.pyx":91
 *             self.data.processcorpus(encode(filename), self.freqlist)
 * 
 *     def buildclasses(self):             # <<<<<<<<<<<<<<
 *         """Build classes, call after processing all corpora with processcorpus()"""
 *         self.data.buildclasses(self.freqlist)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":95
 *         self.data.buildclasses(self.freqlist)
 * 
 *     def build(self, str filename): #build a class from this dataset             # <<<<<<<<<<<<<<
 *         """Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()"""
 *         if os.path.exists(filename):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_13build(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_12build[] = "Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()";
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_13build(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 95, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_12build(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_12build(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build", 0);

  /* "colibricore_wrapper.pyx":97
 *     def build(self, str filename): #build a class from this dataset
 *         """Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()"""
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.build(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":98
 *         """Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()"""
 *         if os.path.exists(filename):
 *             self.data.build(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise FileNotFoundError("File " + filename + " does not exist")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 98, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.build(__pyx_t_5, NULL);

    /* "colibricore_wrapper.pyx":97
 *     def build(self, str filename): #build a class from this dataset
 *         """Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()"""
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.build(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":100
 *             self.data.build(encode(filename))
 *         else:
 *             raise FileNotFoundError("File " + filename + " does not exist")             # <<<<<<<<<<<<<<
 * 
 *     def encodefile(self, str sourcefile, str targetfile, bool allowunknown=True, bool addunknown=False, bool append=False, bool ignorenewlines=False): #apply the encoder to a file
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_File, __pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_does_not_exist); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 100, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":95
 *         self.data.buildclasses(self.freqlist)
 * 
 *     def build(self, str filename): #build a class from this dataset             # <<<<<<<<<<<<<<
 *         """Builds a class encoder from a plain-text corpus (utf-8). Equivalent to a call to processcorpus() followed by buildclasses()"""
 *         if os.path.exists(filename):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.ClassEncoder.build", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":102
 *             raise FileNotFoundError("File " + filename + " does not exist")
 * 
 *     def encodefile(self, str sourcefile, str targetfile, bool allowunknown=True, bool addunknown=False, bool append=False, bool ignorenewlines=False): #apply the encoder to a file             # <<<<<<<<<<<<<<
 *         """Encodes the specified sourcefile according to the classer (as targetfile)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_15encodefile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_12ClassEncoder_14encodefile[] = "Encodes the specified sourcefile according to the classer (as targetfile)\n\n        :param sourcefile: Source filename\n        :type sourcefile: str\n        :param targetfile: Target filename\n        :type sourcefile: str\n        :param allowunknown: Encode unknown classes as 'unknown', a single class for all, rather than failing with an exception if a word type is unseen (bool, default=False)\n        :type allowunknown: bool\n        :param addunknown: Add unknown classes to the class encoder (bool, default=False)\n        :type addunknown: bool\n        :param append: Append to file (bool, default=False)\n        :type append: bool\n        ";
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_15encodefile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sourcefile = 0;
  PyObject *__pyx_v_targetfile = 0;
  bool __pyx_v_allowunknown;
  bool __pyx_v_addunknown;
  bool __pyx_v_append;
  bool __pyx_v_ignorenewlines;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encodefile (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sourcefile,&__pyx_n_s_targetfile,&__pyx_n_s_allowunknown,&__pyx_n_s_addunknown,&__pyx_n_s_append,&__pyx_n_s_ignorenewlines,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sourcefile)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_targetfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("encodefile", 0, 2, 6, 1); __PYX_ERR(1, 102, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allowunknown);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addunknown);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_append);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignorenewlines);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encodefile") < 0)) __PYX_ERR(1, 102, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sourcefile = ((PyObject*)values[0]);
    __pyx_v_targetfile = ((PyObject*)values[1]);
    if (values[2]) {
      __pyx_v_allowunknown = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_allowunknown == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 102, __pyx_L3_error)
    } else {
      __pyx_v_allowunknown = ((bool)1);
    }
    if (values[3]) {
      __pyx_v_addunknown = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_addunknown == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 102, __pyx_L3_error)
    } else {
      __pyx_v_addunknown = ((bool)0);
    }
    if (values[4]) {
      __pyx_v_append = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_append == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 102, __pyx_L3_error)
    } else {
      __pyx_v_append = ((bool)0);
    }
    if (values[5]) {
      __pyx_v_ignorenewlines = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_ignorenewlines == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 102, __pyx_L3_error)
    } else {
      __pyx_v_ignorenewlines = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("encodefile", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.ClassEncoder.encodefile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sourcefile), (&PyUnicode_Type), 1, "sourcefile", 1))) __PYX_ERR(1, 102, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_targetfile), (&PyUnicode_Type), 1, "targetfile", 1))) __PYX_ERR(1, 102, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_14encodefile(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), __pyx_v_sourcefile, __pyx_v_targetfile, __pyx_v_allowunknown, __pyx_v_addunknown, __pyx_v_append, __pyx_v_ignorenewlines);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_14encodefile(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_sourcefile, PyObject *__pyx_v_targetfile, bool __pyx_v_allowunknown, bool __pyx_v_addunknown, bool __pyx_v_append, bool __pyx_v_ignorenewlines) {
  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;
  std::string __pyx_t_5;
  std::string __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encodefile", 0);

  /* "colibricore_wrapper.pyx":116
 *         :type append: bool
 *         """
 *         if os.path.exists(sourcefile):             # <<<<<<<<<<<<<<
 *             self.data.encodefile(encode(sourcefile), encode(targetfile),allowunknown, addunknown, append, ignorenewlines, True)
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_sourcefile) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sourcefile);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":117
 *         """
 *         if os.path.exists(sourcefile):
 *             self.data.encodefile(encode(sourcefile), encode(targetfile),allowunknown, addunknown, append, ignorenewlines, True)             # <<<<<<<<<<<<<<
 *         else:
 *             raise FileNotFoundError("File " + sourcefile + " does not exist")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_sourcefile) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sourcefile);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_targetfile) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_targetfile);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 117, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.encodefile(__pyx_t_5, __pyx_t_6, __pyx_v_allowunknown, __pyx_v_addunknown, __pyx_v_append, __pyx_v_ignorenewlines, 1);

    /* "colibricore_wrapper.pyx":116
 *         :type append: bool
 *         """
 *         if os.path.exists(sourcefile):             # <<<<<<<<<<<<<<
 *             self.data.encodefile(encode(sourcefile), encode(targetfile),allowunknown, addunknown, append, ignorenewlines, True)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":119
 *             self.data.encodefile(encode(sourcefile), encode(targetfile),allowunknown, addunknown, append, ignorenewlines, True)
 *         else:
 *             raise FileNotFoundError("File " + sourcefile + " does not exist")             # <<<<<<<<<<<<<<
 * 
 *     def save(self, str filename):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_File, __pyx_v_sourcefile); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_does_not_exist); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 119, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":102
 *             raise FileNotFoundError("File " + filename + " does not exist")
 * 
 *     def encodefile(self, str sourcefile, str targetfile, bool allowunknown=True, bool addunknown=False, bool append=False, bool ignorenewlines=False): #apply the encoder to a file             # <<<<<<<<<<<<<<
 *         """Encodes the specified sourcefile according to the classer (as targetfile)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.ClassEncoder.encodefile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":121
 *             raise FileNotFoundError("File " + sourcefile + " does not exist")
 * 
 *     def save(self, str filename):             # <<<<<<<<<<<<<<
 *         if not self.filename:
 *             self.filename = filename
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_17save(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_17save(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("save (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 121, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_16save(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_16save(struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  std::string __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("save", 0);

  /* "colibricore_wrapper.pyx":122
 * 
 *     def save(self, str filename):
 *         if not self.filename:             # <<<<<<<<<<<<<<
 *             self.filename = filename
 *         self.data.save(encode(filename))
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "colibricore_wrapper.pyx":123
 *     def save(self, str filename):
 *         if not self.filename:
 *             self.filename = filename             # <<<<<<<<<<<<<<
 *         self.data.save(encode(filename))
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename, __pyx_v_filename) < 0) __PYX_ERR(1, 123, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":122
 * 
 *     def save(self, str filename):
 *         if not self.filename:             # <<<<<<<<<<<<<<
 *             self.filename = filename
 *         self.data.save(encode(filename))
 */
  }

  /* "colibricore_wrapper.pyx":124
 *         if not self.filename:
 *             self.filename = filename
 *         self.data.save(encode(filename))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.save(__pyx_t_6);

  /* "colibricore_wrapper.pyx":121
 *             raise FileNotFoundError("File " + sourcefile + " does not exist")
 * 
 *     def save(self, str filename):             # <<<<<<<<<<<<<<
 *         if not self.filename:
 *             self.filename = filename
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.ClassEncoder.save", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_18__reduce_cython__(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.ClassEncoder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassEncoder_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassEncoder_20__setstate_cython__(((struct __pyx_obj_11colibricore_ClassEncoder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassEncoder_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.ClassEncoder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":133
 *     cdef str _filename
 * 
 *     def __init__(self, str filename=None):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self._filename = filename
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_12ClassDecoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11colibricore_12ClassDecoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject*)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.ClassDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 133, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder___init__(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_12ClassDecoder___init__(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":134
 * 
 *     def __init__(self, str filename=None):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self._filename = filename
 *             if os.path.exists(filename):
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":135
 *     def __init__(self, str filename=None):
 *         if filename:
 *             self._filename = filename             # <<<<<<<<<<<<<<
 *             if os.path.exists(filename):
 *                 self.data.load(encode(filename))
 */
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_v_filename;

    /* "colibricore_wrapper.pyx":136
 *         if filename:
 *             self._filename = filename
 *             if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 self.data.load(encode(filename))
 *             else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(__pyx_t_1)) {

      /* "colibricore_wrapper.pyx":137
 *             self._filename = filename
 *             if os.path.exists(filename):
 *                 self.data.load(encode(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise FileNotFoundError("No such file: " + filename)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 137, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->data.load(__pyx_t_5);

      /* "colibricore_wrapper.pyx":136
 *         if filename:
 *             self._filename = filename
 *             if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 self.data.load(encode(filename))
 *             else:
 */
      goto __pyx_L4;
    }

    /* "colibricore_wrapper.pyx":139
 *                 self.data.load(encode(filename))
 *             else:
 *                 raise FileNotFoundError("No such file: " + filename)             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = ""
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_No_such_file, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(1, 139, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "colibricore_wrapper.pyx":134
 * 
 *     def __init__(self, str filename=None):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self._filename = filename
 *             if os.path.exists(filename):
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":141
 *                 raise FileNotFoundError("No such file: " + filename)
 *         else:
 *             self._filename = ""             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_GIVEREF(__pyx_kp_u_);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_kp_u_;
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":133
 *     cdef str _filename
 * 
 *     def __init__(self, str filename=None):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self._filename = filename
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.ClassDecoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":143
 *             self._filename = ""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of classes"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_12ClassDecoder_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_12ClassDecoder_2__len__[] = "Returns the total number of classes";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_12ClassDecoder_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_12ClassDecoder_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder_2__len__(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_12ClassDecoder_2__len__(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":145
 *     def __len__(self):
 *         """Returns the total number of classes"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":143
 *             self._filename = ""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of classes"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":148
 * 
 * 
 *     def decodefile(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_5decodefile(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_5decodefile(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decodefile (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 148, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder_4decodefile(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassDecoder_4decodefile(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decodefile", 0);

  /* "colibricore_wrapper.pyx":149
 * 
 *     def decodefile(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 149, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":150
 *     def decodefile(self, str filename):
 *         if os.path.exists(filename):
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)             # <<<<<<<<<<<<<<
 *         else:
 *             raise FileNotFoundError("File " + filename + " does not exist")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 150, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->data.decodefiletostring(__pyx_t_5, NULL), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":149
 * 
 *     def decodefile(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":152
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)
 *         else:
 *             raise FileNotFoundError("File " + filename + " does not exist")             # <<<<<<<<<<<<<<
 * 
 *     def filename(self):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u_File, __pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_does_not_exist); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 152, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":148
 * 
 * 
 *     def decodefile(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             return self.data.decodefiletostring(encode(filename)).decode('utf-8') #bytes to str (python3)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.ClassDecoder.decodefile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":154
 *             raise FileNotFoundError("File " + filename + " does not exist")
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_7filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_7filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder_6filename(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassDecoder_6filename(struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename", 0);

  /* "colibricore_wrapper.pyx":155
 * 
 *     def filename(self):
 *         return self._filename             # <<<<<<<<<<<<<<
 * 
 * def patternfromfile(str filename):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":154
 *             raise FileNotFoundError("File " + filename + " does not exist")
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder_8__reduce_cython__(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassDecoder_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.ClassDecoder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_12ClassDecoder_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_12ClassDecoder_10__setstate_cython__(((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_12ClassDecoder_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.ClassDecoder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":157
 *         return self._filename
 * 
 * def patternfromfile(str filename):             # <<<<<<<<<<<<<<
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_3patternfromfile(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_2patternfromfile[] = "Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead.";
static PyMethodDef __pyx_mdef_11colibricore_3patternfromfile = {"patternfromfile", (PyCFunction)__pyx_pw_11colibricore_3patternfromfile, METH_O, __pyx_doc_11colibricore_2patternfromfile};
static PyObject *__pyx_pw_11colibricore_3patternfromfile(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patternfromfile (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 157, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_2patternfromfile(__pyx_self, ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_2patternfromfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("patternfromfile", 0);

  /* "colibricore_wrapper.pyx":159
 * def patternfromfile(str filename):
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))             # <<<<<<<<<<<<<<
 *     pattern = Pattern()
 *     pattern.bind(cpattern)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cpattern = patternfromfile(__pyx_t_4);

  /* "colibricore_wrapper.pyx":160
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 *     pattern = Pattern()             # <<<<<<<<<<<<<<
 *     pattern.bind(cpattern)
 *     return pattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":161
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 *     pattern = Pattern()
 *     pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *     return pattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_pattern->__pyx_vtab)->bind(__pyx_v_pattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":162
 *     pattern = Pattern()
 *     pattern.bind(cpattern)
 *     return pattern             # <<<<<<<<<<<<<<
 * 
 * cdef class Pattern:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
  __pyx_r = ((PyObject *)__pyx_v_pattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":157
 *         return self._filename
 * 
 * def patternfromfile(str filename):             # <<<<<<<<<<<<<<
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.patternfromfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":169
 *     cdef cPattern cpattern
 * 
 *     cdef cPattern getcpattern(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern
 * 
 */

static Pattern __pyx_f_11colibricore_7Pattern_getcpattern(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Pattern __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcpattern", 0);

  /* "colibricore_wrapper.pyx":170
 * 
 *     cdef cPattern getcpattern(self):
 *         return self.cpattern             # <<<<<<<<<<<<<<
 * 
 *     cdef bind(self, cPattern& cpattern):
 */
  __pyx_r = __pyx_v_self->cpattern;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":169
 *     cdef cPattern cpattern
 * 
 *     cdef cPattern getcpattern(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":172
 *         return self.cpattern
 * 
 *     cdef bind(self, cPattern& cpattern):             # <<<<<<<<<<<<<<
 *         self.cpattern = cpattern
 * 
 */

static PyObject *__pyx_f_11colibricore_7Pattern_bind(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, Pattern &__pyx_v_cpattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":173
 * 
 *     cdef bind(self, cPattern& cpattern):
 *         self.cpattern = cpattern             # <<<<<<<<<<<<<<
 * 
 *     def bindunk(self):
 */
  __pyx_v_self->cpattern = __pyx_v_cpattern;

  /* "colibricore_wrapper.pyx":172
 *         return self.cpattern
 * 
 *     cdef bind(self, cPattern& cpattern):             # <<<<<<<<<<<<<<
 *         self.cpattern = cpattern
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":175
 *         self.cpattern = cpattern
 * 
 *     def bindunk(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cUNKPATTERN
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_1bindunk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_1bindunk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindunk (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_bindunk(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_bindunk(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindunk", 0);

  /* "colibricore_wrapper.pyx":176
 * 
 *     def bindunk(self):
 *         self.cpattern = cUNKPATTERN             # <<<<<<<<<<<<<<
 * 
 *     def bindskip(self):
 */
  __pyx_v_self->cpattern = UNKPATTERN;

  /* "colibricore_wrapper.pyx":175
 *         self.cpattern = cpattern
 * 
 *     def bindunk(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cUNKPATTERN
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":178
 *         self.cpattern = cUNKPATTERN
 * 
 *     def bindskip(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cSKIPPATTERN
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_3bindskip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_3bindskip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindskip (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_2bindskip(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_2bindskip(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindskip", 0);

  /* "colibricore_wrapper.pyx":179
 * 
 *     def bindskip(self):
 *         self.cpattern = cSKIPPATTERN             # <<<<<<<<<<<<<<
 * 
 *     def bindflex(self):
 */
  __pyx_v_self->cpattern = SKIPPATTERN;

  /* "colibricore_wrapper.pyx":178
 *         self.cpattern = cUNKPATTERN
 * 
 *     def bindskip(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cSKIPPATTERN
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":181
 *         self.cpattern = cSKIPPATTERN
 * 
 *     def bindflex(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cFLEXPATTERN
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_5bindflex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_5bindflex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindflex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_4bindflex(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_4bindflex(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindflex", 0);

  /* "colibricore_wrapper.pyx":182
 * 
 *     def bindflex(self):
 *         self.cpattern = cFLEXPATTERN             # <<<<<<<<<<<<<<
 * 
 *     def bindboundary(self):
 */
  __pyx_v_self->cpattern = FLEXPATTERN;

  /* "colibricore_wrapper.pyx":181
 *         self.cpattern = cSKIPPATTERN
 * 
 *     def bindflex(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cFLEXPATTERN
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":184
 *         self.cpattern = cFLEXPATTERN
 * 
 *     def bindboundary(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cBOUNDARYPATTERN
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_7bindboundary(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_7bindboundary(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindboundary (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_6bindboundary(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_6bindboundary(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bindboundary", 0);

  /* "colibricore_wrapper.pyx":185
 * 
 *     def bindboundary(self):
 *         self.cpattern = cBOUNDARYPATTERN             # <<<<<<<<<<<<<<
 * 
 *     def tostring(self, ClassDecoder decoder):
 */
  __pyx_v_self->cpattern = BOUNDARYPATTERN;

  /* "colibricore_wrapper.pyx":184
 *         self.cpattern = cFLEXPATTERN
 * 
 *     def bindboundary(self):             # <<<<<<<<<<<<<<
 *         self.cpattern = cBOUNDARYPATTERN
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":187
 *         self.cpattern = cBOUNDARYPATTERN
 * 
 *     def tostring(self, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Convert a Pattern back to a str
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_9tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_8tostring[] = "Convert a Pattern back to a str\n\n        :param decoder: the class decoder to use\n        :type decoder: ClassDecoder\n        :rtype: str\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_9tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 187, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_8tostring(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_decoder));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_8tostring(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);

  /* "colibricore_wrapper.pyx":195
 *         """
 * 
 *         return str(self.cpattern.tostring(decoder.data),'utf-8')             # <<<<<<<<<<<<<<
 * 
 *     def unknown(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->cpattern.tostring(__pyx_v_decoder->data)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_kp_u_utf_8);
  __Pyx_GIVEREF(__pyx_kp_u_utf_8);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_utf_8);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":187
 *         self.cpattern = cBOUNDARYPATTERN
 * 
 *     def tostring(self, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Convert a Pattern back to a str
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("colibricore.Pattern.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":197
 *         return str(self.cpattern.tostring(decoder.data),'utf-8')
 * 
 *     def unknown(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.unknown()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_11unknown(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_11unknown(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unknown (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_10unknown(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_10unknown(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unknown", 0);

  /* "colibricore_wrapper.pyx":198
 * 
 *     def unknown(self):
 *         return self.cpattern.unknown()             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->cpattern.unknown()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":197
 *         return str(self.cpattern.tostring(decoder.data),'utf-8')
 * 
 *     def unknown(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.unknown()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.unknown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":200
 *         return self.cpattern.unknown()
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Check if the specified pattern occurs within this larger pattern.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_7Pattern_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_12__contains__[] = "Check if the specified pattern occurs within this larger pattern.\n\n        :param pattern: the subpattern to look for\n        :type pattern: Pattern\n        :rtype: bool\n\n        Example::\n\n            subpattern in pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_12__contains__;
#endif
static int __pyx_pw_11colibricore_7Pattern_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 200, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_12__contains__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_7Pattern_12__contains__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  bool __pyx_v_r;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":212
 *         """
 *         cdef bool r
 *         r = self.cpattern.contains(pattern.cpattern)             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  __pyx_v_r = __pyx_v_self->cpattern.contains(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":213
 *         cdef bool r
 *         r = self.cpattern.contains(pattern.cpattern)
 *         return r             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":200
 *         return self.cpattern.unknown()
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Check if the specified pattern occurs within this larger pattern.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":216
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.n() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_7Pattern_15__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_7Pattern_15__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_14__bool__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_7Pattern_14__bool__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":217
 * 
 *     def __bool__(self):
 *         return self.cpattern.n() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->cpattern.n() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":216
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.n() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":219
 *         return self.cpattern.n() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the length of the pattern in words/tokens::
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_7Pattern_17__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_16__len__[] = "Returns the length of the pattern in words/tokens::\n\n            len(pattern)\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_16__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_7Pattern_17__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_16__len__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_7Pattern_16__len__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":224
 *             len(pattern)
 *         """
 *         return self.cpattern.n()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __pyx_r = __pyx_v_self->cpattern.n();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":219
 *         return self.cpattern.n() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the length of the pattern in words/tokens::
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":226
 *         return self.cpattern.n()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         """Produces a copy of the pattern (deep)::
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_19__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_18__copy__[] = "Produces a copy of the pattern (deep)::\n\n            pattern2 = copy(pattern)\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_19__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_18__copy__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_18__copy__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Pattern __pyx_v_c_pattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  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("__copy__", 0);

  /* "colibricore_wrapper.pyx":232
 *         """
 *         cdef cPattern c_pattern
 *         c_pattern = cPattern(self.cpattern) #copy constructor             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)
 */
  __pyx_v_c_pattern = Pattern(__pyx_v_self->cpattern);

  /* "colibricore_wrapper.pyx":233
 *         cdef cPattern c_pattern
 *         c_pattern = cPattern(self.cpattern) #copy constructor
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(c_pattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":234
 *         c_pattern = cPattern(self.cpattern) #copy constructor
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_c_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":235
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = ((PyObject *)__pyx_v_newpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":226
 *         return self.cpattern.n()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         """Produces a copy of the pattern (deep)::
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":237
 *         return newpattern
 * 
 *     def __deepcopy__(self):             # <<<<<<<<<<<<<<
 *         """Produces a copy of the pattern (deep)::
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_21__deepcopy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_20__deepcopy__[] = "Produces a copy of the pattern (deep)::\n\n            pattern2 = copy(pattern)\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_21__deepcopy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_20__deepcopy__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_20__deepcopy__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Pattern __pyx_v_c_pattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  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("__deepcopy__", 0);

  /* "colibricore_wrapper.pyx":243
 *         """
 *         cdef cPattern c_pattern
 *         c_pattern = cPattern(self.cpattern) #copy constructor             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)
 */
  __pyx_v_c_pattern = Pattern(__pyx_v_self->cpattern);

  /* "colibricore_wrapper.pyx":244
 *         cdef cPattern c_pattern
 *         c_pattern = cPattern(self.cpattern) #copy constructor
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(c_pattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":245
 *         c_pattern = cPattern(self.cpattern) #copy constructor
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_c_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":246
 *         newpattern = Pattern()
 *         newpattern.bind(c_pattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def concat(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = ((PyObject *)__pyx_v_newpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":237
 *         return newpattern
 * 
 *     def __deepcopy__(self):             # <<<<<<<<<<<<<<
 *         """Produces a copy of the pattern (deep)::
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":248
 *         return newpattern
 * 
 *     def concat(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPattern newcpattern = self.cpattern + pattern.cpattern
 *         newpattern = Pattern()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_23concat(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_23concat(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("concat (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 248, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_22concat(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_22concat(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  Pattern __pyx_v_newcpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  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("concat", 0);

  /* "colibricore_wrapper.pyx":249
 * 
 *     def concat(self, Pattern pattern):
 *         cdef cPattern newcpattern = self.cpattern + pattern.cpattern             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 */
  __pyx_v_newcpattern = (__pyx_v_self->cpattern + __pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":250
 *     def concat(self, Pattern pattern):
 *         cdef cPattern newcpattern = self.cpattern + pattern.cpattern
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(newcpattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":251
 *         cdef cPattern newcpattern = self.cpattern + pattern.cpattern
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_newcpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":252
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, Pattern other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = ((PyObject *)__pyx_v_newpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":248
 *         return newpattern
 * 
 *     def concat(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPattern newcpattern = self.cpattern + pattern.cpattern
 *         newpattern = Pattern()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":254
 *         return newpattern
 * 
 *     def __add__(self, Pattern other):             # <<<<<<<<<<<<<<
 *         """Concatenate two patterns together, forming a larger one::
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_25__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_24__add__[] = "Concatenate two patterns together, forming a larger one::\n\n                pattern3 = pattern1 + pattern2\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_24__add__;
#endif
static PyObject *__pyx_pw_11colibricore_7Pattern_25__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_11colibricore_Pattern, 1, "other", 0))) __PYX_ERR(1, 254, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_24__add__(((PyObject *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_24__add__(PyObject *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "colibricore_wrapper.pyx":259
 *                 pattern3 = pattern1 + pattern2
 *         """
 *         return self.concat(other)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_concat); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_other)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_other));
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":254
 *         return newpattern
 * 
 *     def __add__(self, Pattern other):             # <<<<<<<<<<<<<<
 *         """Concatenate two patterns together, forming a larger one::
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.Pattern.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":261
 *         return self.concat(other)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieves a word/token from the pattern::
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_26__getitem__[] = "Retrieves a word/token from the pattern::\n\n            unigram = pattern[index]\n\n        Or retrieves a subpattern::\n\n            subpattern = pattern[begin:end]\n\n\n        :param item: an index or slice\n        :rtype: a Pattern instance\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_26__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_7Pattern_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_26__getitem__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_26__getitem__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_v_start;
  int __pyx_v_stop;
  Pattern __pyx_v_c_pattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":279
 *         cdef cPattern c_pattern
 * 
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         if isinstance(item, slice):
 *             start = item.start
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":280
 * 
 *         newpattern = Pattern()
 *         if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *             start = item.start
 *             stop = item.stop
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_item); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "colibricore_wrapper.pyx":281
 *         newpattern = Pattern()
 *         if isinstance(item, slice):
 *             start = item.start             # <<<<<<<<<<<<<<
 *             stop = item.stop
 *             if not stop:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_start = __pyx_t_4;

    /* "colibricore_wrapper.pyx":282
 *         if isinstance(item, slice):
 *             start = item.start
 *             stop = item.stop             # <<<<<<<<<<<<<<
 *             if not stop:
 *                 stop = len(self)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_stop = __pyx_t_4;

    /* "colibricore_wrapper.pyx":283
 *             start = item.start
 *             stop = item.stop
 *             if not stop:             # <<<<<<<<<<<<<<
 *                 stop = len(self)
 *             if not start:
 */
    __pyx_t_3 = ((!(__pyx_v_stop != 0)) != 0);
    if (__pyx_t_3) {

      /* "colibricore_wrapper.pyx":284
 *             stop = item.stop
 *             if not stop:
 *                 stop = len(self)             # <<<<<<<<<<<<<<
 *             if not start:
 *                 start = 0
 */
      __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 284, __pyx_L1_error)
      __pyx_v_stop = __pyx_t_5;

      /* "colibricore_wrapper.pyx":283
 *             start = item.start
 *             stop = item.stop
 *             if not stop:             # <<<<<<<<<<<<<<
 *                 stop = len(self)
 *             if not start:
 */
    }

    /* "colibricore_wrapper.pyx":285
 *             if not stop:
 *                 stop = len(self)
 *             if not start:             # <<<<<<<<<<<<<<
 *                 start = 0
 *             c_pattern = cPattern(self.cpattern, start, stop - start)
 */
    __pyx_t_3 = ((!(__pyx_v_start != 0)) != 0);
    if (__pyx_t_3) {

      /* "colibricore_wrapper.pyx":286
 *                 stop = len(self)
 *             if not start:
 *                 start = 0             # <<<<<<<<<<<<<<
 *             c_pattern = cPattern(self.cpattern, start, stop - start)
 *             newpattern.bind(c_pattern)
 */
      __pyx_v_start = 0;

      /* "colibricore_wrapper.pyx":285
 *             if not stop:
 *                 stop = len(self)
 *             if not start:             # <<<<<<<<<<<<<<
 *                 start = 0
 *             c_pattern = cPattern(self.cpattern, start, stop - start)
 */
    }

    /* "colibricore_wrapper.pyx":287
 *             if not start:
 *                 start = 0
 *             c_pattern = cPattern(self.cpattern, start, stop - start)             # <<<<<<<<<<<<<<
 *             newpattern.bind(c_pattern)
 *             return newpattern
 */
    __pyx_v_c_pattern = Pattern(__pyx_v_self->cpattern, __pyx_v_start, (__pyx_v_stop - __pyx_v_start));

    /* "colibricore_wrapper.pyx":288
 *                 start = 0
 *             c_pattern = cPattern(self.cpattern, start, stop - start)
 *             newpattern.bind(c_pattern)             # <<<<<<<<<<<<<<
 *             return newpattern
 *         else:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_c_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "colibricore_wrapper.pyx":289
 *             c_pattern = cPattern(self.cpattern, start, stop - start)
 *             newpattern.bind(c_pattern)
 *             return newpattern             # <<<<<<<<<<<<<<
 *         else:
 *             if item < 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
    __pyx_r = ((PyObject *)__pyx_v_newpattern);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":280
 * 
 *         newpattern = Pattern()
 *         if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *             start = item.start
 *             stop = item.stop
 */
  }

  /* "colibricore_wrapper.pyx":291
 *             return newpattern
 *         else:
 *             if item < 0:             # <<<<<<<<<<<<<<
 *                 start = len(self) + item
 *             else:
 */
  /*else*/ {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_item, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "colibricore_wrapper.pyx":292
 *         else:
 *             if item < 0:
 *                 start = len(self) + item             # <<<<<<<<<<<<<<
 *             else:
 *                 start = item
 */
      __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 292, __pyx_L1_error)
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 292, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_start = __pyx_t_4;

      /* "colibricore_wrapper.pyx":291
 *             return newpattern
 *         else:
 *             if item < 0:             # <<<<<<<<<<<<<<
 *                 start = len(self) + item
 *             else:
 */
      goto __pyx_L6;
    }

    /* "colibricore_wrapper.pyx":294
 *                 start = len(self) + item
 *             else:
 *                 start = item             # <<<<<<<<<<<<<<
 *             c_pattern = cPattern(self.cpattern, start, 1)
 *             newpattern.bind(c_pattern)
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_item); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 294, __pyx_L1_error)
      __pyx_v_start = __pyx_t_4;
    }
    __pyx_L6:;

    /* "colibricore_wrapper.pyx":295
 *             else:
 *                 start = item
 *             c_pattern = cPattern(self.cpattern, start, 1)             # <<<<<<<<<<<<<<
 *             newpattern.bind(c_pattern)
 *             return newpattern
 */
    __pyx_v_c_pattern = Pattern(__pyx_v_self->cpattern, __pyx_v_start, 1);

    /* "colibricore_wrapper.pyx":296
 *                 start = item
 *             c_pattern = cPattern(self.cpattern, start, 1)
 *             newpattern.bind(c_pattern)             # <<<<<<<<<<<<<<
 *             return newpattern
 * 
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_c_pattern); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "colibricore_wrapper.pyx":297
 *             c_pattern = cPattern(self.cpattern, start, 1)
 *             newpattern.bind(c_pattern)
 *             return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
    __pyx_r = ((PyObject *)__pyx_v_newpattern);
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":261
 *         return self.concat(other)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieves a word/token from the pattern::
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.Pattern.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_7Pattern_30generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":299
 *             return newpattern
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all words/tokens in this pattern"""
 *         for i in range(0, len(self)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_29__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_28__iter__[] = "Iterates over all words/tokens in this pattern";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_28__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_7Pattern_29__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_28__iter__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_28__iter__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct____iter__(__pyx_ptype_11colibricore___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 299, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_7Pattern_30generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Pattern___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 299, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_7Pattern_30generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 299, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":301
 *     def __iter__(self):
 *         """Iterates over all words/tokens in this pattern"""
 *         for i in range(0, len(self)):             # <<<<<<<<<<<<<<
 *             yield self[i]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 301, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;

    /* "colibricore_wrapper.pyx":302
 *         """Iterates over all words/tokens in this pattern"""
 *         for i in range(0, len(self)):
 *             yield self[i]             # <<<<<<<<<<<<<<
 * 
 *     def bytesize(self):
 */
    __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 302, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":299
 *             return newpattern
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all words/tokens in this pattern"""
 *         for i in range(0, len(self)):
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":304
 *             yield self[i]
 * 
 *     def bytesize(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of bytes used to encode this pattern in memory"""
 *         return self.cpattern.bytesize()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_32bytesize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_31bytesize[] = "Returns the number of bytes used to encode this pattern in memory";
static PyObject *__pyx_pw_11colibricore_7Pattern_32bytesize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bytesize (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_31bytesize(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_31bytesize(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bytesize", 0);

  /* "colibricore_wrapper.pyx":306
 *     def bytesize(self):
 *         """Returns the number of bytes used to encode this pattern in memory"""
 *         return self.cpattern.bytesize()             # <<<<<<<<<<<<<<
 * 
 *     def skipcount(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->cpattern.bytesize()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":304
 *             yield self[i]
 * 
 *     def bytesize(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of bytes used to encode this pattern in memory"""
 *         return self.cpattern.bytesize()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.bytesize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":308
 *         return self.cpattern.bytesize()
 * 
 *     def skipcount(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of gaps in this pattern"""
 *         return self.cpattern.skipcount()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_34skipcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_33skipcount[] = "Returns the number of gaps in this pattern";
static PyObject *__pyx_pw_11colibricore_7Pattern_34skipcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("skipcount (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_33skipcount(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_33skipcount(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("skipcount", 0);

  /* "colibricore_wrapper.pyx":310
 *     def skipcount(self):
 *         """Returns the number of gaps in this pattern"""
 *         return self.cpattern.skipcount()             # <<<<<<<<<<<<<<
 * 
 *     def category(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->cpattern.skipcount()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":308
 *         return self.cpattern.bytesize()
 * 
 *     def skipcount(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of gaps in this pattern"""
 *         return self.cpattern.skipcount()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.skipcount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":312
 *         return self.cpattern.skipcount()
 * 
 *     def category(self):             # <<<<<<<<<<<<<<
 *         """Returns the category of this pattern
 *         :rtype: Category.NGRAM (1), Category.SKIPGRAM (2), or Category.FLEXGRAM (3)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_36category(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_35category[] = "Returns the category of this pattern\n        :rtype: Category.NGRAM (1), Category.SKIPGRAM (2), or Category.FLEXGRAM (3)\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_36category(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("category (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_35category(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_35category(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("category", 0);

  /* "colibricore_wrapper.pyx":316
 *         :rtype: Category.NGRAM (1), Category.SKIPGRAM (2), or Category.FLEXGRAM (3)
 *         """
 *         return self.cpattern.category()             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->cpattern.category()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":312
 *         return self.cpattern.skipcount()
 * 
 *     def category(self):             # <<<<<<<<<<<<<<
 *         """Returns the category of this pattern
 *         :rtype: Category.NGRAM (1), Category.SKIPGRAM (2), or Category.FLEXGRAM (3)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.category", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":318
 *         return self.cpattern.category()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """Returns the hashed value for this pattern"""
 *         return self.cpattern.hash()
 */

/* Python wrapper */
static Py_hash_t __pyx_pw_11colibricore_7Pattern_38__hash__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_37__hash__[] = "Returns the hashed value for this pattern";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_7Pattern_37__hash__;
#endif
static Py_hash_t __pyx_pw_11colibricore_7Pattern_38__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_37__hash__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_11colibricore_7Pattern_37__hash__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "colibricore_wrapper.pyx":320
 *     def __hash__(self):
 *         """Returns the hashed value for this pattern"""
 *         return self.cpattern.hash()             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(Pattern self, Pattern other, int op):
 */
  __pyx_r = __pyx_v_self->cpattern.hash();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":318
 *         return self.cpattern.category()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """Returns the hashed value for this pattern"""
 *         return self.cpattern.hash()
 */

  /* function exit code */
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":322
 *         return self.cpattern.hash()
 * 
 *     def __richcmp__(Pattern self, Pattern other, int op):             # <<<<<<<<<<<<<<
 *         """Allows comparisons of two patterns using the usual operators, <, > , <=, <=, =="""
 *         if op == 2: # ==
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_11colibricore_Pattern, 1, "other", 0))) __PYX_ERR(1, 322, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_39__richcmp__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_39__richcmp__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "colibricore_wrapper.pyx":324
 *     def __richcmp__(Pattern self, Pattern other, int op):
 *         """Allows comparisons of two patterns using the usual operators, <, > , <=, <=, =="""
 *         if op == 2: # ==             # <<<<<<<<<<<<<<
 *             return self.cpattern == other.cpattern
 *         elif op == 0: #<
 */
  switch (__pyx_v_op) {
    case 2:

    /* "colibricore_wrapper.pyx":325
 *         """Allows comparisons of two patterns using the usual operators, <, > , <=, <=, =="""
 *         if op == 2: # ==
 *             return self.cpattern == other.cpattern             # <<<<<<<<<<<<<<
 *         elif op == 0: #<
 *             return self.cpattern < other.cpattern
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->cpattern == __pyx_v_other->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":324
 *     def __richcmp__(Pattern self, Pattern other, int op):
 *         """Allows comparisons of two patterns using the usual operators, <, > , <=, <=, =="""
 *         if op == 2: # ==             # <<<<<<<<<<<<<<
 *             return self.cpattern == other.cpattern
 *         elif op == 0: #<
 */
    break;
    case 0:

    /* "colibricore_wrapper.pyx":327
 *             return self.cpattern == other.cpattern
 *         elif op == 0: #<
 *             return self.cpattern < other.cpattern             # <<<<<<<<<<<<<<
 *         elif op == 4: #>
 *             return self.cpattern > other.cpattern
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->cpattern < __pyx_v_other->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":326
 *         if op == 2: # ==
 *             return self.cpattern == other.cpattern
 *         elif op == 0: #<             # <<<<<<<<<<<<<<
 *             return self.cpattern < other.cpattern
 *         elif op == 4: #>
 */
    break;
    case 4:

    /* "colibricore_wrapper.pyx":329
 *             return self.cpattern < other.cpattern
 *         elif op == 4: #>
 *             return self.cpattern > other.cpattern             # <<<<<<<<<<<<<<
 *         elif op == 3: #!=
 *             return not( self.cpattern == other.cpattern)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->cpattern > __pyx_v_other->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":328
 *         elif op == 0: #<
 *             return self.cpattern < other.cpattern
 *         elif op == 4: #>             # <<<<<<<<<<<<<<
 *             return self.cpattern > other.cpattern
 *         elif op == 3: #!=
 */
    break;
    case 3:

    /* "colibricore_wrapper.pyx":331
 *             return self.cpattern > other.cpattern
 *         elif op == 3: #!=
 *             return not( self.cpattern == other.cpattern)             # <<<<<<<<<<<<<<
 *         elif op == 1: #<=
 *             return (self.cpattern == other.cpattern) or (self.cpattern < other.cpattern)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong((!((__pyx_v_self->cpattern == __pyx_v_other->cpattern) != 0))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":330
 *         elif op == 4: #>
 *             return self.cpattern > other.cpattern
 *         elif op == 3: #!=             # <<<<<<<<<<<<<<
 *             return not( self.cpattern == other.cpattern)
 *         elif op == 1: #<=
 */
    break;
    case 1:

    /* "colibricore_wrapper.pyx":333
 *             return not( self.cpattern == other.cpattern)
 *         elif op == 1: #<=
 *             return (self.cpattern == other.cpattern) or (self.cpattern < other.cpattern)             # <<<<<<<<<<<<<<
 *         elif op == 5: #>=
 *             return (self.cpattern == other.cpattern) or (self.cpattern > other.cpattern)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_self->cpattern == __pyx_v_other->cpattern);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_self->cpattern < __pyx_v_other->cpattern);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_L3_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":332
 *         elif op == 3: #!=
 *             return not( self.cpattern == other.cpattern)
 *         elif op == 1: #<=             # <<<<<<<<<<<<<<
 *             return (self.cpattern == other.cpattern) or (self.cpattern < other.cpattern)
 *         elif op == 5: #>=
 */
    break;
    case 5:

    /* "colibricore_wrapper.pyx":335
 *             return (self.cpattern == other.cpattern) or (self.cpattern < other.cpattern)
 *         elif op == 5: #>=
 *             return (self.cpattern == other.cpattern) or (self.cpattern > other.cpattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_self->cpattern == __pyx_v_other->cpattern);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_self->cpattern > __pyx_v_other->cpattern);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_L5_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":334
 *         elif op == 1: #<=
 *             return (self.cpattern == other.cpattern) or (self.cpattern < other.cpattern)
 *         elif op == 5: #>=             # <<<<<<<<<<<<<<
 *             return (self.cpattern == other.cpattern) or (self.cpattern > other.cpattern)
 * 
 */
    break;
    default: break;
  }

  /* "colibricore_wrapper.pyx":322
 *         return self.cpattern.hash()
 * 
 *     def __richcmp__(Pattern self, Pattern other, int op):             # <<<<<<<<<<<<<<
 *         """Allows comparisons of two patterns using the usual operators, <, > , <=, <=, =="""
 *         if op == 2: # ==
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.Pattern.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":338
 * 
 * 
 *     def reverse(self):             # <<<<<<<<<<<<<<
 *         """Reverse the pattern (all the words will be in reverse order)"""
 *         cdef cPattern newcpattern = self.cpattern.reverse()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_42reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_41reverse[] = "Reverse the pattern (all the words will be in reverse order)";
static PyObject *__pyx_pw_11colibricore_7Pattern_42reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverse (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_41reverse(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_41reverse(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Pattern __pyx_v_newcpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  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("reverse", 0);

  /* "colibricore_wrapper.pyx":340
 *     def reverse(self):
 *         """Reverse the pattern (all the words will be in reverse order)"""
 *         cdef cPattern newcpattern = self.cpattern.reverse()             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 */
  __pyx_v_newcpattern = __pyx_v_self->cpattern.reverse();

  /* "colibricore_wrapper.pyx":341
 *         """Reverse the pattern (all the words will be in reverse order)"""
 *         cdef cPattern newcpattern = self.cpattern.reverse()
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(newcpattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":342
 *         cdef cPattern newcpattern = self.cpattern.reverse()
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_newcpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":343
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     cdef Pattern add(Pattern self, Pattern other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = ((PyObject *)__pyx_v_newpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":338
 * 
 * 
 *     def reverse(self):             # <<<<<<<<<<<<<<
 *         """Reverse the pattern (all the words will be in reverse order)"""
 *         cdef cPattern newcpattern = self.cpattern.reverse()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.reverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":345
 *         return newpattern
 * 
 *     cdef Pattern add(Pattern self, Pattern other):             # <<<<<<<<<<<<<<
 *         cdef cPattern newcpattern = self.cpattern + other.cpattern
 *         newpattern = Pattern()
 */

static struct __pyx_obj_11colibricore_Pattern *__pyx_f_11colibricore_7Pattern_add(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_other) {
  Pattern __pyx_v_newcpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  struct __pyx_obj_11colibricore_Pattern *__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("add", 0);

  /* "colibricore_wrapper.pyx":346
 * 
 *     cdef Pattern add(Pattern self, Pattern other):
 *         cdef cPattern newcpattern = self.cpattern + other.cpattern             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 */
  __pyx_v_newcpattern = (__pyx_v_self->cpattern + __pyx_v_other->cpattern);

  /* "colibricore_wrapper.pyx":347
 *     cdef Pattern add(Pattern self, Pattern other):
 *         cdef cPattern newcpattern = self.cpattern + other.cpattern
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(newcpattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":348
 *         cdef cPattern newcpattern = self.cpattern + other.cpattern
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_newcpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":349
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def ngrams(self,int n=0, int maxn=0 ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = __pyx_v_newpattern;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":345
 *         return newpattern
 * 
 *     cdef Pattern add(Pattern self, Pattern other):             # <<<<<<<<<<<<<<
 *         cdef cPattern newcpattern = self.cpattern + other.cpattern
 *         newpattern = Pattern()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":351
 *         return newpattern
 * 
 *     def ngrams(self,int n=0, int maxn=0 ):             # <<<<<<<<<<<<<<
 *         """Generator iterating over all ngrams of a particular size (or range thereof) that are enclosed within this pattern. Despite the name, this may also return skipgrams!
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_44ngrams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_43ngrams[] = "Generator iterating over all ngrams of a particular size (or range thereof) that are enclosed within this pattern. Despite the name, this may also return skipgrams!\n\n        :param n: The desired size to obtain, if unspecified (0), will extract all ngrams\n        :type n: int\n        :param maxn: If larger than n, will extract ngrams in the specified n range\n        :type maxn: int\n        :rtype: generator over Pattern instances\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_44ngrams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_n;
  int __pyx_v_maxn;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ngrams (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_maxn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxn);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ngrams") < 0)) __PYX_ERR(1, 351, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 351, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
    if (values[1]) {
      __pyx_v_maxn = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_maxn == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 351, __pyx_L3_error)
    } else {
      __pyx_v_maxn = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ngrams", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 351, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.Pattern.ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_7Pattern_43ngrams(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), __pyx_v_n, __pyx_v_maxn);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_43ngrams(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_n, int __pyx_v_maxn) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ngrams", 0);

  /* "colibricore_wrapper.pyx":361
 *         """
 * 
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             return self.subngrams()
 *         elif maxn >= n:
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":362
 * 
 *         if n == 0:
 *             return self.subngrams()             # <<<<<<<<<<<<<<
 *         elif maxn >= n:
 *             return self.subngrams(n,maxn)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_subngrams); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":361
 *         """
 * 
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             return self.subngrams()
 *         elif maxn >= n:
 */
  }

  /* "colibricore_wrapper.pyx":363
 *         if n == 0:
 *             return self.subngrams()
 *         elif maxn >= n:             # <<<<<<<<<<<<<<
 *             return self.subngrams(n,maxn)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_maxn >= __pyx_v_n) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":364
 *             return self.subngrams()
 *         elif maxn >= n:
 *             return self.subngrams(n,maxn)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._ngrams_aux(n)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_subngrams); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxn); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 364, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 364, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":363
 *         if n == 0:
 *             return self.subngrams()
 *         elif maxn >= n:             # <<<<<<<<<<<<<<
 *             return self.subngrams(n,maxn)
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":366
 *             return self.subngrams(n,maxn)
 *         else:
 *             return self._ngrams_aux(n)             # <<<<<<<<<<<<<<
 * 
 *     def _ngrams_aux(self,int n):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ngrams_aux); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":351
 *         return newpattern
 * 
 *     def ngrams(self,int n=0, int maxn=0 ):             # <<<<<<<<<<<<<<
 *         """Generator iterating over all ngrams of a particular size (or range thereof) that are enclosed within this pattern. Despite the name, this may also return skipgrams!
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.Pattern.ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_7Pattern_47generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":368
 *             return self._ngrams_aux(n)
 * 
 *     def _ngrams_aux(self,int n):             # <<<<<<<<<<<<<<
 *         cdef vector[cPattern] result
 *         self.cpattern.ngrams(result, n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_46_ngrams_aux(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_46_ngrams_aux(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ngrams_aux (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 368, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.Pattern._ngrams_aux", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_7Pattern_45_ngrams_aux(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((int)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_45_ngrams_aux(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_n) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ngrams_aux", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)__pyx_tp_new_11colibricore___pyx_scope_struct_1__ngrams_aux(__pyx_ptype_11colibricore___pyx_scope_struct_1__ngrams_aux, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 368, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_n = __pyx_v_n;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_7Pattern_47generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_ngrams_aux, __pyx_n_s_Pattern__ngrams_aux, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 368, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern._ngrams_aux", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_7Pattern_47generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ngrams_aux", 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_ERR(1, 368, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":370
 *     def _ngrams_aux(self,int n):
 *         cdef vector[cPattern] result
 *         self.cpattern.ngrams(result, n)             # <<<<<<<<<<<<<<
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()
 */
  (void)(__pyx_cur_scope->__pyx_v_self->cpattern.ngrams(__pyx_cur_scope->__pyx_v_result, __pyx_cur_scope->__pyx_v_n));

  /* "colibricore_wrapper.pyx":372
 *         self.cpattern.ngrams(result, n)
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()             # <<<<<<<<<<<<<<
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_result.begin();

  /* "colibricore_wrapper.pyx":373
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()
 *         cdef vector[cPattern].iterator it_end = result.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cngram  = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_result.end();

  /* "colibricore_wrapper.pyx":374
 *         cdef vector[cPattern].iterator it = result.begin()
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cngram  = deref(it)
 *             ngram = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":375
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:
 *             cngram  = deref(it)             # <<<<<<<<<<<<<<
 *             ngram = Pattern()
 *             ngram.bind(cngram)
 */
    __pyx_cur_scope->__pyx_v_cngram = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":376
 *         while it != it_end:
 *             cngram  = deref(it)
 *             ngram = Pattern()             # <<<<<<<<<<<<<<
 *             ngram.bind(cngram)
 *             yield ngram
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ngram, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":377
 *             cngram  = deref(it)
 *             ngram = Pattern()
 *             ngram.bind(cngram)             # <<<<<<<<<<<<<<
 *             yield ngram
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_ngram->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_ngram, __pyx_cur_scope->__pyx_v_cngram); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":378
 *             ngram = Pattern()
 *             ngram.bind(cngram)
 *             yield ngram             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_ngram);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 378, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":379
 *             ngram.bind(cngram)
 *             yield ngram
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def parts(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":368
 *             return self._ngrams_aux(n)
 * 
 *     def _ngrams_aux(self,int n):             # <<<<<<<<<<<<<<
 *         cdef vector[cPattern] result
 *         self.cpattern.ngrams(result, n)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_ngrams_aux", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_7Pattern_50generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":381
 *             inc(it)
 * 
 *     def parts(self):             # <<<<<<<<<<<<<<
 *         """Generating iterating over the consecutive non-gappy parts in a skipgram of flexgram
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_49parts(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_48parts[] = "Generating iterating over the consecutive non-gappy parts in a skipgram of flexgram\n\n        :rtype: generator over Pattern instances\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_49parts(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parts (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_48parts(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_48parts(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parts", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)__pyx_tp_new_11colibricore___pyx_scope_struct_2_parts(__pyx_ptype_11colibricore___pyx_scope_struct_2_parts, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 381, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_7Pattern_50generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_parts, __pyx_n_s_Pattern_parts, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 381, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern.parts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_7Pattern_50generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parts", 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_ERR(1, 381, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":387
 *         """
 *         cdef vector[cPattern] result
 *         self.cpattern.parts(result)             # <<<<<<<<<<<<<<
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()
 */
  (void)(__pyx_cur_scope->__pyx_v_self->cpattern.parts(__pyx_cur_scope->__pyx_v_result));

  /* "colibricore_wrapper.pyx":389
 *         self.cpattern.parts(result)
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()             # <<<<<<<<<<<<<<
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_result.begin();

  /* "colibricore_wrapper.pyx":390
 *         cdef cPattern cngram
 *         cdef vector[cPattern].iterator it = result.begin()
 *         cdef vector[cPattern].iterator it_end = result.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cngram  = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_result.end();

  /* "colibricore_wrapper.pyx":391
 *         cdef vector[cPattern].iterator it = result.begin()
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cngram  = deref(it)
 *             ngram = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":392
 *         cdef vector[cPattern].iterator it_end = result.end()
 *         while it != it_end:
 *             cngram  = deref(it)             # <<<<<<<<<<<<<<
 *             ngram = Pattern()
 *             ngram.bind(cngram)
 */
    __pyx_cur_scope->__pyx_v_cngram = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":393
 *         while it != it_end:
 *             cngram  = deref(it)
 *             ngram = Pattern()             # <<<<<<<<<<<<<<
 *             ngram.bind(cngram)
 *             yield ngram
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ngram, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":394
 *             cngram  = deref(it)
 *             ngram = Pattern()
 *             ngram.bind(cngram)             # <<<<<<<<<<<<<<
 *             yield ngram
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_ngram->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_ngram, __pyx_cur_scope->__pyx_v_cngram); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":395
 *             ngram = Pattern()
 *             ngram.bind(cngram)
 *             yield ngram             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_ngram);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 395, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":396
 *             ngram.bind(cngram)
 *             yield ngram
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def gaps(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":381
 *             inc(it)
 * 
 *     def parts(self):             # <<<<<<<<<<<<<<
 *         """Generating iterating over the consecutive non-gappy parts in a skipgram of flexgram
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("parts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_7Pattern_53generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":398
 *             inc(it)
 * 
 *     def gaps(self):             # <<<<<<<<<<<<<<
 *         """Generator iterating over the gaps in a skipgram or flexgram, return a tuple (begin,length) for each. For flexgrams, the minimum length (1) is always returned.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_52gaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_51gaps[] = "Generator iterating over the gaps in a skipgram or flexgram, return a tuple (begin,length) for each. For flexgrams, the minimum length (1) is always returned.\n\n        :rtype: generator over (begin, length) tuples\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_52gaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gaps (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_51gaps(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_51gaps(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gaps", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)__pyx_tp_new_11colibricore___pyx_scope_struct_3_gaps(__pyx_ptype_11colibricore___pyx_scope_struct_3_gaps, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 398, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_7Pattern_53generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_gaps, __pyx_n_s_Pattern_gaps, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 398, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern.gaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_7Pattern_53generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gaps", 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_ERR(1, 398, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":404
 *         """
 *         cdef vector[pair[int,int]] result
 *         self.cpattern.gaps(result)             # <<<<<<<<<<<<<<
 *         cdef vector[pair[int,int]].iterator it = result.begin()
 *         cdef vector[pair[int,int]].iterator it_end = result.end()
 */
  (void)(__pyx_cur_scope->__pyx_v_self->cpattern.gaps(__pyx_cur_scope->__pyx_v_result));

  /* "colibricore_wrapper.pyx":405
 *         cdef vector[pair[int,int]] result
 *         self.cpattern.gaps(result)
 *         cdef vector[pair[int,int]].iterator it = result.begin()             # <<<<<<<<<<<<<<
 *         cdef vector[pair[int,int]].iterator it_end = result.end()
 *         cdef pair[int,int] p
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_result.begin();

  /* "colibricore_wrapper.pyx":406
 *         self.cpattern.gaps(result)
 *         cdef vector[pair[int,int]].iterator it = result.begin()
 *         cdef vector[pair[int,int]].iterator it_end = result.end()             # <<<<<<<<<<<<<<
 *         cdef pair[int,int] p
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_result.end();

  /* "colibricore_wrapper.pyx":408
 *         cdef vector[pair[int,int]].iterator it_end = result.end()
 *         cdef pair[int,int] p
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             p  = deref(it)
 *             yield (p.first, p.second)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":409
 *         cdef pair[int,int] p
 *         while it != it_end:
 *             p  = deref(it)             # <<<<<<<<<<<<<<
 *             yield (p.first, p.second)
 *             inc(it)
 */
    __pyx_cur_scope->__pyx_v_p = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":410
 *         while it != it_end:
 *             p  = deref(it)
 *             yield (p.first, p.second)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_p.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_p.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 410, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":411
 *             p  = deref(it)
 *             yield (p.first, p.second)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def toflexgram(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":398
 *             inc(it)
 * 
 *     def gaps(self):             # <<<<<<<<<<<<<<
 *         """Generator iterating over the gaps in a skipgram or flexgram, return a tuple (begin,length) for each. For flexgrams, the minimum length (1) is always returned.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":413
 *             inc(it)
 * 
 *     def toflexgram(self):             # <<<<<<<<<<<<<<
 *         """Converts a skipgram to a flexgram
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_55toflexgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_54toflexgram[] = "Converts a skipgram to a flexgram\n\n        :rtype: Pattern\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_55toflexgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toflexgram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_54toflexgram(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_54toflexgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  Pattern __pyx_v_newcpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_newpattern = NULL;
  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("toflexgram", 0);

  /* "colibricore_wrapper.pyx":418
 *         :rtype: Pattern
 *         """
 *         cdef cPattern newcpattern = self.cpattern.toflexgram()             # <<<<<<<<<<<<<<
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 */
  __pyx_v_newcpattern = __pyx_v_self->cpattern.toflexgram();

  /* "colibricore_wrapper.pyx":419
 *         """
 *         cdef cPattern newcpattern = self.cpattern.toflexgram()
 *         newpattern = Pattern()             # <<<<<<<<<<<<<<
 *         newpattern.bind(newcpattern)
 *         return newpattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_newpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":420
 *         cdef cPattern newcpattern = self.cpattern.toflexgram()
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)             # <<<<<<<<<<<<<<
 *         return newpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_newpattern->__pyx_vtab)->bind(__pyx_v_newpattern, __pyx_v_newcpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":421
 *         newpattern = Pattern()
 *         newpattern.bind(newcpattern)
 *         return newpattern             # <<<<<<<<<<<<<<
 * 
 *     def subngrams(self,int minn=1,int maxn=99):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newpattern));
  __pyx_r = ((PyObject *)__pyx_v_newpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":413
 *             inc(it)
 * 
 *     def toflexgram(self):             # <<<<<<<<<<<<<<
 *         """Converts a skipgram to a flexgram
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.toflexgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_7Pattern_58generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":423
 *         return newpattern
 * 
 *     def subngrams(self,int minn=1,int maxn=99):             # <<<<<<<<<<<<<<
 *         """Generator iterating over all ngrams of all sizes that are enclosed within this pattern. Despite the name, this may also return skipgrams!
 *         :param minn: minimum length (default 1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_57subngrams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_56subngrams[] = "Generator iterating over all ngrams of all sizes that are enclosed within this pattern. Despite the name, this may also return skipgrams!\n        :param minn: minimum length (default 1)\n        :type minn: int\n        :param maxn: maximum length (default unlimited)\n        :type maxn: int\n        :rtype: generator over Pattern instances\n        ";
static PyObject *__pyx_pw_11colibricore_7Pattern_57subngrams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_minn;
  int __pyx_v_maxn;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subngrams (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_minn,&__pyx_n_s_maxn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minn);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxn);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subngrams") < 0)) __PYX_ERR(1, 423, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_minn = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_minn == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 423, __pyx_L3_error)
    } else {
      __pyx_v_minn = ((int)1);
    }
    if (values[1]) {
      __pyx_v_maxn = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_maxn == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 423, __pyx_L3_error)
    } else {
      __pyx_v_maxn = ((int)99);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subngrams", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.Pattern.subngrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_7Pattern_56subngrams(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), __pyx_v_minn, __pyx_v_maxn);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_56subngrams(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_minn, int __pyx_v_maxn) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("subngrams", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)__pyx_tp_new_11colibricore___pyx_scope_struct_4_subngrams(__pyx_ptype_11colibricore___pyx_scope_struct_4_subngrams, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 423, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_minn = __pyx_v_minn;
  __pyx_cur_scope->__pyx_v_maxn = __pyx_v_maxn;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_7Pattern_58generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_subngrams, __pyx_n_s_Pattern_subngrams, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 423, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern.subngrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_7Pattern_58generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  long __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subngrams", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 423, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":431
 *         :rtype: generator over Pattern instances
 *         """
 *         minn = max(1,minn)             # <<<<<<<<<<<<<<
 *         maxn = min(maxn, len(self) -1 )
 *         for n in range(minn,maxn+1):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_minn;
  __pyx_t_2 = 1;
  if (((__pyx_t_1 > __pyx_t_2) != 0)) {
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  __pyx_cur_scope->__pyx_v_minn = __pyx_t_3;

  /* "colibricore_wrapper.pyx":432
 *         """
 *         minn = max(1,minn)
 *         maxn = min(maxn, len(self) -1 )             # <<<<<<<<<<<<<<
 *         for n in range(minn,maxn+1):
 *             for pattern in self.ngrams(n):
 */
  __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 432, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 - 1);
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_maxn;
  if (((__pyx_t_5 < __pyx_t_1) != 0)) {
    __pyx_t_4 = __pyx_t_5;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  __pyx_cur_scope->__pyx_v_maxn = __pyx_t_4;

  /* "colibricore_wrapper.pyx":433
 *         minn = max(1,minn)
 *         maxn = min(maxn, len(self) -1 )
 *         for n in range(minn,maxn+1):             # <<<<<<<<<<<<<<
 *             for pattern in self.ngrams(n):
 *                 yield pattern
 */
  __pyx_t_3 = (__pyx_cur_scope->__pyx_v_maxn + 1);
  __pyx_t_2 = __pyx_t_3;
  for (__pyx_t_6 = __pyx_cur_scope->__pyx_v_minn; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
    __pyx_cur_scope->__pyx_v_n = __pyx_t_6;

    /* "colibricore_wrapper.pyx":434
 *         maxn = min(maxn, len(self) -1 )
 *         for n in range(minn,maxn+1):
 *             for pattern in self.ngrams(n):             # <<<<<<<<<<<<<<
 *                 yield pattern
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_ngrams); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 434, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 434, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 434, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_11(__pyx_t_8);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 434, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pattern);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;

      /* "colibricore_wrapper.pyx":435
 *         for n in range(minn,maxn+1):
 *             for pattern in self.ngrams(n):
 *                 yield pattern             # <<<<<<<<<<<<<<
 * 
 *     def tolist(self):
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pattern);
      __pyx_r = __pyx_cur_scope->__pyx_v_pattern;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
      __Pyx_XGIVEREF(__pyx_t_8);
      __pyx_cur_scope->__pyx_t_4 = __pyx_t_8;
      __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L8_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
      __pyx_t_8 = __pyx_cur_scope->__pyx_t_4;
      __pyx_cur_scope->__pyx_t_4 = 0;
      __Pyx_XGOTREF(__pyx_t_8);
      __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 435, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":434
 *         maxn = min(maxn, len(self) -1 )
 *         for n in range(minn,maxn+1):
 *             for pattern in self.ngrams(n):             # <<<<<<<<<<<<<<
 *                 yield pattern
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":423
 *         return newpattern
 * 
 *     def subngrams(self,int minn=1,int maxn=99):             # <<<<<<<<<<<<<<
 *         """Generator iterating over all ngrams of all sizes that are enclosed within this pattern. Despite the name, this may also return skipgrams!
 *         :param minn: minimum length (default 1)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("subngrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":437
 *                 yield pattern
 * 
 *     def tolist(self):             # <<<<<<<<<<<<<<
 *         """Returns a list representing the raw classes in the pattern"""
 *         cdef vector[unsigned int] state = self.cpattern.tovector()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_60tolist(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_59tolist[] = "Returns a list representing the raw classes in the pattern";
static PyObject *__pyx_pw_11colibricore_7Pattern_60tolist(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tolist (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_59tolist(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_59tolist(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  std::vector<unsigned int>  __pyx_v_state;
  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("tolist", 0);

  /* "colibricore_wrapper.pyx":439
 *     def tolist(self):
 *         """Returns a list representing the raw classes in the pattern"""
 *         cdef vector[unsigned int] state = self.cpattern.tovector()             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  __pyx_v_state = __pyx_v_self->cpattern.tovector();

  /* "colibricore_wrapper.pyx":440
 *         """Returns a list representing the raw classes in the pattern"""
 *         cdef vector[unsigned int] state = self.cpattern.tovector()
 *         return state             # <<<<<<<<<<<<<<
 * 
 *     def __bytes__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_unsigned_int(__pyx_v_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":437
 *                 yield pattern
 * 
 *     def tolist(self):             # <<<<<<<<<<<<<<
 *         """Returns a list representing the raw classes in the pattern"""
 *         cdef vector[unsigned int] state = self.cpattern.tovector()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.tolist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":442
 *         return state
 * 
 *     def __bytes__(self):             # <<<<<<<<<<<<<<
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_62__bytes__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_62__bytes__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bytes__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_61__bytes__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_61__bytes__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  int __pyx_v_s;
  PyObject *__pyx_v_b = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bytes__", 0);

  /* "colibricore_wrapper.pyx":443
 * 
 *     def __bytes__(self):
 *         cdef int s = self.bytesize()             # <<<<<<<<<<<<<<
 *         cdef bytes b = self.cpattern.data[:s]
 *         return b
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bytesize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = __pyx_t_4;

  /* "colibricore_wrapper.pyx":444
 *     def __bytes__(self):
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]             # <<<<<<<<<<<<<<
 *         return b
 * 
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_self->cpattern.data) + 0, __pyx_v_s - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_b = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":445
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 *         return b             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":442
 *         return state
 * 
 *     def __bytes__(self):             # <<<<<<<<<<<<<<
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.Pattern.__bytes__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":447
 *         return b
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_64__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_64__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_63__getstate__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_63__getstate__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  int __pyx_v_s;
  PyObject *__pyx_v_b = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getstate__", 0);

  /* "colibricore_wrapper.pyx":448
 * 
 *     def __getstate__(self):
 *         cdef int s = self.bytesize()             # <<<<<<<<<<<<<<
 *         cdef bytes b = self.cpattern.data[:s]
 *         return b
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bytesize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = __pyx_t_4;

  /* "colibricore_wrapper.pyx":449
 *     def __getstate__(self):
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]             # <<<<<<<<<<<<<<
 *         return b
 * 
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_self->cpattern.data) + 0, __pyx_v_s - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_b = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":450
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 *         return b             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, bytes byterep):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":447
 *         return b
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         cdef int s = self.bytesize()
 *         cdef bytes b = self.cpattern.data[:s]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.Pattern.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":452
 *         return b
 * 
 *     def __setstate__(self, bytes byterep):             # <<<<<<<<<<<<<<
 *         cdef unsigned char * cdata = byterep
 *         self.cpattern.set(cdata, len(byterep))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_66__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_byterep); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_66__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_byterep) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_byterep), (&PyBytes_Type), 1, "byterep", 1))) __PYX_ERR(1, 452, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_65__setstate__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((PyObject*)__pyx_v_byterep));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_65__setstate__(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, PyObject *__pyx_v_byterep) {
  unsigned char *__pyx_v_cdata;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  unsigned char *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "colibricore_wrapper.pyx":453
 * 
 *     def __setstate__(self, bytes byterep):
 *         cdef unsigned char * cdata = byterep             # <<<<<<<<<<<<<<
 *         self.cpattern.set(cdata, len(byterep))
 * 
 */
  if (unlikely(__pyx_v_byterep == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(1, 453, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBytes_AsWritableUString(__pyx_v_byterep); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(1, 453, __pyx_L1_error)
  __pyx_v_cdata = __pyx_t_1;

  /* "colibricore_wrapper.pyx":454
 *     def __setstate__(self, bytes byterep):
 *         cdef unsigned char * cdata = byterep
 *         self.cpattern.set(cdata, len(byterep))             # <<<<<<<<<<<<<<
 * 
 *     def isgap(self, int index):
 */
  if (unlikely(__pyx_v_byterep == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 454, __pyx_L1_error)
  }
  __pyx_t_2 = PyBytes_GET_SIZE(__pyx_v_byterep); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 454, __pyx_L1_error)
  __pyx_v_self->cpattern.set(__pyx_v_cdata, __pyx_t_2);

  /* "colibricore_wrapper.pyx":452
 *         return b
 * 
 *     def __setstate__(self, bytes byterep):             # <<<<<<<<<<<<<<
 *         cdef unsigned char * cdata = byterep
 *         self.cpattern.set(cdata, len(byterep))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.Pattern.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":456
 *         self.cpattern.set(cdata, len(byterep))
 * 
 *     def isgap(self, int index):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isgap(index)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_68isgap(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_68isgap(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  int __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isgap (wrapper)", 0);
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 456, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.Pattern.isgap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_7Pattern_67isgap(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((int)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_67isgap(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, int __pyx_v_index) {
  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("isgap", 0);

  /* "colibricore_wrapper.pyx":457
 * 
 *     def isgap(self, int index):
 *         return self.cpattern.isgap(index)             # <<<<<<<<<<<<<<
 * 
 *     def isskipgram(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->cpattern.isgap(__pyx_v_index)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":456
 *         self.cpattern.set(cdata, len(byterep))
 * 
 *     def isgap(self, int index):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isgap(index)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.isgap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":459
 *         return self.cpattern.isgap(index)
 * 
 *     def isskipgram(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isskipgram()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_70isskipgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_70isskipgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isskipgram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_69isskipgram(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_69isskipgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isskipgram", 0);

  /* "colibricore_wrapper.pyx":460
 * 
 *     def isskipgram(self):
 *         return self.cpattern.isskipgram()             # <<<<<<<<<<<<<<
 * 
 *     def isflexgram(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->cpattern.isskipgram()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":459
 *         return self.cpattern.isgap(index)
 * 
 *     def isskipgram(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isskipgram()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.isskipgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":462
 *         return self.cpattern.isskipgram()
 * 
 *     def isflexgram(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isflexgram()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_72isflexgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_72isflexgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isflexgram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_71isflexgram(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_71isflexgram(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isflexgram", 0);

  /* "colibricore_wrapper.pyx":463
 * 
 *     def isflexgram(self):
 *         return self.cpattern.isflexgram()             # <<<<<<<<<<<<<<
 * 
 *     def instanceof(self, Pattern skipgram):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->cpattern.isflexgram()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":462
 *         return self.cpattern.isskipgram()
 * 
 *     def isflexgram(self):             # <<<<<<<<<<<<<<
 *         return self.cpattern.isflexgram()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.isflexgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":465
 *         return self.cpattern.isflexgram()
 * 
 *     def instanceof(self, Pattern skipgram):             # <<<<<<<<<<<<<<
 *         """Is this an instantiation of the skipgram/flexgram? Instantiation is not necessarily full, aka: A ? B C is also an instantiation of A ? ? C"""
 *         return self.cpattern.instanceof(skipgram.cpattern.getpointer())
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_74instanceof(PyObject *__pyx_v_self, PyObject *__pyx_v_skipgram); /*proto*/
static char __pyx_doc_11colibricore_7Pattern_73instanceof[] = "Is this an instantiation of the skipgram/flexgram? Instantiation is not necessarily full, aka: A ? B C is also an instantiation of A ? ? C";
static PyObject *__pyx_pw_11colibricore_7Pattern_74instanceof(PyObject *__pyx_v_self, PyObject *__pyx_v_skipgram) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("instanceof (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_skipgram), __pyx_ptype_11colibricore_Pattern, 1, "skipgram", 0))) __PYX_ERR(1, 465, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_7Pattern_73instanceof(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_skipgram));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_73instanceof(struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_skipgram) {
  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("instanceof", 0);

  /* "colibricore_wrapper.pyx":467
 *     def instanceof(self, Pattern skipgram):
 *         """Is this an instantiation of the skipgram/flexgram? Instantiation is not necessarily full, aka: A ? B C is also an instantiation of A ? ? C"""
 *         return self.cpattern.instanceof(skipgram.cpattern.getpointer())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->cpattern.instanceof(__pyx_v_skipgram->cpattern.getpointer())); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":465
 *         return self.cpattern.isflexgram()
 * 
 *     def instanceof(self, Pattern skipgram):             # <<<<<<<<<<<<<<
 *         """Is this an instantiation of the skipgram/flexgram? Instantiation is not necessarily full, aka: A ? B C is also an instantiation of A ? ? C"""
 *         return self.cpattern.instanceof(skipgram.cpattern.getpointer())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.instanceof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_76__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_76__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_75__reduce_cython__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_75__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_Pattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_7Pattern_78__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_7Pattern_78__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_7Pattern_77__setstate_cython__(((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_7Pattern_77__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_Pattern *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.Pattern.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":475
 *     cdef cIndexedData data
 * 
 *     cdef bind(self, cIndexedData cdata):             # <<<<<<<<<<<<<<
 *         self.data = cdata
 * 
 */

static PyObject *__pyx_f_11colibricore_11IndexedData_bind(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, IndexedData __pyx_v_cdata) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":476
 * 
 *     cdef bind(self, cIndexedData cdata):
 *         self.data = cdata             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data = __pyx_v_cdata;

  /* "colibricore_wrapper.pyx":475
 *     cdef cIndexedData data
 * 
 *     cdef bind(self, cIndexedData cdata):             # <<<<<<<<<<<<<<
 *         self.data = cdata
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":479
 * 
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_11IndexedData_1__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static char __pyx_doc_11colibricore_11IndexedData___contains__[] = "Tests if the specified (sentence,token) tuple is in the set";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_11IndexedData___contains__;
#endif
static int __pyx_pw_11colibricore_11IndexedData_1__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData___contains__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_11IndexedData___contains__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, PyObject *__pyx_v_item) {
  IndexReference __pyx_v_ref;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":481
 *     def __contains__(self, item):
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_item); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 481, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_4 != 2) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":482
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])
 *         return self.data.has(ref)
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 482, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":481
 *     def __contains__(self, item):
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])
 */
  }

  /* "colibricore_wrapper.pyx":483
 *         if not isinstance(item, tuple) or len(item) != 2:
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])             # <<<<<<<<<<<<<<
 *         return self.data.has(ref)
 * 
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_ref = IndexReference(__pyx_t_6, __pyx_t_7);

  /* "colibricore_wrapper.pyx":484
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])
 *         return self.data.has(ref)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_r = __pyx_v_self->data.has(__pyx_v_ref);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":479
 * 
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.IndexedData.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_11IndexedData_4generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":486
 *         return self.data.has(ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all (sentence,token) tuples in the set"""
 *         cdef cIndexReference ref
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_11IndexedData_3__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_11IndexedData_2__iter__[] = "Iterate over all (sentence,token) tuples in the set";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_11IndexedData_2__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_11IndexedData_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_2__iter__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_11IndexedData_2__iter__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_5___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_5___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 486, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_11IndexedData_4generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_IndexedData___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 486, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedData.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_11IndexedData_4generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 486, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":489
 *         """Iterate over all (sentence,token) tuples in the set"""
 *         cdef cIndexReference ref
 *         cdef cIndexedData.iterator it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cIndexedData.iterator it_end = self.data.end()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":490
 *         cdef cIndexReference ref
 *         cdef cIndexedData.iterator it = self.data.begin()
 *         cdef cIndexedData.iterator it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             ref  = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":491
 *         cdef cIndexedData.iterator it = self.data.begin()
 *         cdef cIndexedData.iterator it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             ref  = deref(it)
 *             yield (ref.sentence, ref.token)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":492
 *         cdef cIndexedData.iterator it_end = self.data.end()
 *         while it != it_end:
 *             ref  = deref(it)             # <<<<<<<<<<<<<<
 *             yield (ref.sentence, ref.token)
 *             inc(it)
 */
    __pyx_cur_scope->__pyx_v_ref = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":493
 *         while it != it_end:
 *             ref  = deref(it)
 *             yield (ref.sentence, ref.token)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_ref.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_ref.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 493, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":494
 *             ref  = deref(it)
 *             yield (ref.sentence, ref.token)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":486
 *         return self.data.has(ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all (sentence,token) tuples in the set"""
 *         cdef cIndexReference ref
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":496
 *             inc(it)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of occurrences, i.e. the length of the set"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_11IndexedData_6__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_11IndexedData_5__len__[] = "Returns the number of occurrences, i.e. the length of the set";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_11IndexedData_5__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_11IndexedData_6__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_5__len__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_11IndexedData_5__len__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":498
 *     def __len__(self):
 *         """Returns the number of occurrences, i.e. the length of the set"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":496
 *             inc(it)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of occurrences, i.e. the length of the set"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":500
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_11IndexedData_8__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_11IndexedData_8__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_7__bool__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_11IndexedData_7__bool__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":501
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __int__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":500
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":503
 *         return self.data.size() > 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_11IndexedData_10__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_11colibricore_11IndexedData_10__int__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_9__int__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_11IndexedData_9__int__(struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__int__", 0);

  /* "colibricore_wrapper.pyx":504
 * 
 *     def __int__(self):
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->data.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":503
 *         return self.data.size() > 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedData.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_11IndexedData_12__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_11IndexedData_12__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_11__reduce_cython__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_11IndexedData_11__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedData.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_11IndexedData_14__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_11IndexedData_14__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_11IndexedData_13__setstate_cython__(((struct __pyx_obj_11colibricore_IndexedData *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_11IndexedData_13__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedData *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedData.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":513
 *     cdef cPatternSet[uint].iterator it_end
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_10PatternSet_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_10PatternSet_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet___bool__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_10PatternSet___bool__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":514
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":513
 *     cdef cPatternSet[uint].iterator it_end
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":516
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_10PatternSet_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_10PatternSet_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_10PatternSet_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_10PatternSet_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_2__len__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_10PatternSet_2__len__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":518
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":516
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":520
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_pw_11colibricore_10PatternSet_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_10PatternSet_has(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_10PatternSet_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 520, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":521
 * 
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_5 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":522
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 522, __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_ERR(1, 522, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":521
 * 
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":523
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":520
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternSet.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_10PatternSet_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_10PatternSet_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 520, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_4has(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_10PatternSet_4has(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_10PatternSet_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSet.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":525
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_10PatternSet_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_10PatternSet_6__contains__[] = "Test if the pattern is in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_10PatternSet_6__contains__;
#endif
static int __pyx_pw_11colibricore_10PatternSet_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_6__contains__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_10PatternSet_6__contains__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":532
 *         :rtype: bool
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":533
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 533, __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_ERR(1, 533, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":532
 *         :rtype: bool
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":534
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 534, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_PatternSet *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":525
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_10PatternSet_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":536
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_10PatternSet_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_10PatternSet_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_10PatternSet_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_10PatternSet_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_8__iter__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_10PatternSet_8__iter__(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_6___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_6___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 536, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_10PatternSet_10generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternSet___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_10PatternSet_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 536, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":538
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":540
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":541
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":542
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":543
 *         while it != it_end:
 *             cpattern = deref(it)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":544
 *             cpattern = deref(it)
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":545
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 545, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":546
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def add(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":536
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":548
 *             inc(it)
 * 
 *     def add(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Adds a pattern to the set
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_10PatternSet_12add(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_10PatternSet_11add[] = "Adds a pattern to the set\n    \n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        ";
static PyObject *__pyx_pw_11colibricore_10PatternSet_12add(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 548, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_11add(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_10PatternSet_11add(struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "colibricore_wrapper.pyx":554
 *         :type pattern: Pattern
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":555
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         self.data.insert(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 555, __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_ERR(1, 555, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":554
 *         :type pattern: Pattern
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":556
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     #cdef getdatapointer(self):
 */
  __pyx_v_self->data.insert(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":548
 *             inc(it)
 * 
 *     def add(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Adds a pattern to the set
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternSet.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_10PatternSet_14__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_10PatternSet_14__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_13__reduce_cython__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_10PatternSet_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSet.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_10PatternSet_16__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_10PatternSet_16__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_10PatternSet_15__setstate_cython__(((struct __pyx_obj_11colibricore_PatternSet *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_10PatternSet_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSet.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":571
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_int32_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_17PatternDict_int32_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32___bool__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_int32___bool__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":572
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":571
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":574
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_17PatternDict_int32_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_int32_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_17PatternDict_int32_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_2__len__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_17PatternDict_int32_2__len__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":576
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":574
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":578
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_17PatternDict_int32_has(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_17PatternDict_int32_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":579
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":578
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 578, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_4has(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_4has(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_17PatternDict_int32_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":581
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_6__contains__[] = "Test if the pattern is in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_int32_6__contains__;
#endif
static int __pyx_pw_11colibricore_17PatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 581, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_6__contains__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":583
 *     def __contains__(self, Pattern pattern):
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_PatternDict_int32 *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 583, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":581
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_17PatternDict_int32_10generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":585
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_int32_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_8__iter__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_7___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 585, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_17PatternDict_int32_10generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternDict_int32___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 585, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_17PatternDict_int32_10generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 585, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":587
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":589
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":590
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":591
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":592
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":593
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":594
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 594, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":595
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":585
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":597
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_11__getitem__[] = "Retrieve the value for a pattern in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_int32_11__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 597, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_11__getitem__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("__getitem__", 0);

  /* "colibricore_wrapper.pyx":603
 *         :type pattern: Pattern
 *         """
 *         return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":597
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__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_11colibricore_17PatternDict_int32_15generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":607
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_13items[] = "Iterate over all patterns and their values in the dictionary";
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_13items(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_13items(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_8_items(__pyx_ptype_11colibricore___pyx_scope_struct_8_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 607, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_17PatternDict_int32_15generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_PatternDict_int32_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 607, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int32.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_17PatternDict_int32_15generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 607, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":609
 *     def items(self):
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":611
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":612
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":613
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":614
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":615
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":616
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":617
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 617, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":618
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":607
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":621
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 621, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_16read(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_16read(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":622
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":623
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise IOError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 623, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":622
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":625
 *             self.data.read(encode(filename))
 *         else:
 *             raise IOError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IOError, 0, 0, 0);
    __PYX_ERR(1, 625, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":621
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":627
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 627, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_18write(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_18write(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":628
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":627
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":630
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_int32_20__setitem__[] = "Set the value for a pattern in the dictionary\n\n        :param pattern: the pattern\n        :param value: its value\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_int32_20__setitem__;
#endif
static int __pyx_pw_11colibricore_17PatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v) {
  uint32_t __pyx_v_v;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyInt_As_uint32_t(__pyx_arg_v); if (unlikely((__pyx_v_v == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 630, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 630, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_20__setitem__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((uint32_t)__pyx_v_v));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":636
 *         :param value: its value
 *         """
 *         self.data[pattern.cpattern] = v             # <<<<<<<<<<<<<<
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t]& newdata):
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = __pyx_v_v;

  /* "colibricore_wrapper.pyx":630
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":638
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

static PyObject *__pyx_f_11colibricore_17PatternDict_int32_bind(struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  &__pyx_v_newdata) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":639
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t]& newdata):
 *         self.data = newdata             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data = __pyx_v_newdata;

  /* "colibricore_wrapper.pyx":638
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_22__reduce_cython__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_int32_24__setstate_cython__(((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int32.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":652
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32___bool__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_22SmallPatternDict_int32___bool__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":653
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":652
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":655
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_22SmallPatternDict_int32_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_22SmallPatternDict_int32_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_2__len__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_22SmallPatternDict_int32_2__len__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":657
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":655
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":659
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_22SmallPatternDict_int32_has(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_22SmallPatternDict_int32_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":660
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":659
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 659, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_4has(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_4has(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_22SmallPatternDict_int32_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":662
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_6__contains__[] = "Test if the pattern is in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_6__contains__;
#endif
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 662, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_6__contains__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_22SmallPatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":664
 *     def __contains__(self, Pattern pattern):
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_SmallPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":662
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_22SmallPatternDict_int32_10generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":666
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_8__iter__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_9___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_9___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 666, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_22SmallPatternDict_int32_10generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SmallPatternDict_int32___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 666, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_22SmallPatternDict_int32_10generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 666, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":668
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":670
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":671
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":672
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":673
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":674
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":675
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 675, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":676
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":666
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":678
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_11__getitem__[] = "Retrieve the value for a pattern in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_11__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 678, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_11__getitem__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("__getitem__", 0);

  /* "colibricore_wrapper.pyx":684
 *         :type pattern: Pattern
 *         """
 *         return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":678
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__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_11colibricore_22SmallPatternDict_int32_15generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":688
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_13items[] = "Iterate over all patterns and their values in the dictionary";
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_13items(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_13items(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_10_items(__pyx_ptype_11colibricore___pyx_scope_struct_10_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 688, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_22SmallPatternDict_int32_15generator10, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_SmallPatternDict_int32_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 688, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_22SmallPatternDict_int32_15generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 688, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":690
 *     def items(self):
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":692
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":693
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":694
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":695
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":696
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":697
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":698
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 698, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":699
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":688
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":702
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 702, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_16read(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_16read(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":703
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":704
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise IOError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 704, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":703
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":706
 *             self.data.read(encode(filename))
 *         else:
 *             raise IOError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IOError, 0, 0, 0);
    __PYX_ERR(1, 706, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":702
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":708
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 708, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_18write(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_18write(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":709
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":708
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":711
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v); /*proto*/
static char __pyx_doc_11colibricore_22SmallPatternDict_int32_20__setitem__[] = "Set the value for a pattern in the dictionary\n\n        :param pattern: the pattern\n        :param value: its value\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_20__setitem__;
#endif
static int __pyx_pw_11colibricore_22SmallPatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v) {
  uint32_t __pyx_v_v;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyInt_As_uint32_t(__pyx_arg_v); if (unlikely((__pyx_v_v == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 711, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 711, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_20__setitem__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((uint32_t)__pyx_v_v));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_22SmallPatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":717
 *         :param value: its value
 *         """
 *         self.data[pattern.cpattern] = v             # <<<<<<<<<<<<<<
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint16_t]& newdata):
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = __pyx_v_v;

  /* "colibricore_wrapper.pyx":711
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":719
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint16_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

static PyObject *__pyx_f_11colibricore_22SmallPatternDict_int32_bind(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t>  &__pyx_v_newdata) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":720
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint16_t]& newdata):
 *         self.data = newdata             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data = __pyx_v_newdata;

  /* "colibricore_wrapper.pyx":719
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint16_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_22__reduce_cython__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_22SmallPatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_22SmallPatternDict_int32_24__setstate_cython__(((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_22SmallPatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_SmallPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.SmallPatternDict_int32.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":732
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32___bool__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21TinyPatternDict_int32___bool__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":733
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":732
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":735
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_21TinyPatternDict_int32_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_21TinyPatternDict_int32_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_2__len__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_21TinyPatternDict_int32_2__len__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":737
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":735
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":739
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_21TinyPatternDict_int32_has(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21TinyPatternDict_int32_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":740
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":739
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 739, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_4has(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_4has(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21TinyPatternDict_int32_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":742
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_6__contains__[] = "Test if the pattern is in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_6__contains__;
#endif
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 742, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_6__contains__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21TinyPatternDict_int32_6__contains__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":744
 *     def __contains__(self, Pattern pattern):
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_TinyPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":742
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21TinyPatternDict_int32_10generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":746
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_8__iter__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_8__iter__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_11___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_11___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 746, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21TinyPatternDict_int32_10generator11, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_TinyPatternDict_int32___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21TinyPatternDict_int32_10generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 746, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":748
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":750
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":751
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":752
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":753
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":754
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":755
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 755, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":756
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":746
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":758
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_11__getitem__[] = "Retrieve the value for a pattern in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_11__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 758, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_11__getitem__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_11__getitem__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("__getitem__", 0);

  /* "colibricore_wrapper.pyx":764
 *         :type pattern: Pattern
 *         """
 *         return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":758
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__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_11colibricore_21TinyPatternDict_int32_15generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":768
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_13items[] = "Iterate over all patterns and their values in the dictionary";
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_13items(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_13items(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_12_items(__pyx_ptype_11colibricore___pyx_scope_struct_12_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 768, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21TinyPatternDict_int32_15generator12, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_TinyPatternDict_int32_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 768, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21TinyPatternDict_int32_15generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 768, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":770
 *     def items(self):
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":772
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":773
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":774
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":775
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":776
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":777
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":778
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 778, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":779
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":768
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":782
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 782, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_16read(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_16read(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":783
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 783, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":784
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise IOError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 784, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":783
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":786
 *             self.data.read(encode(filename))
 *         else:
 *             raise IOError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IOError, 0, 0, 0);
    __PYX_ERR(1, 786, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":782
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":788
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 788, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_18write(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_18write(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":789
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 789, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":788
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":791
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v); /*proto*/
static char __pyx_doc_11colibricore_21TinyPatternDict_int32_20__setitem__[] = "Set the value for a pattern in the dictionary\n\n        :param pattern: the pattern\n        :param value: its value\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_20__setitem__;
#endif
static int __pyx_pw_11colibricore_21TinyPatternDict_int32_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v) {
  uint32_t __pyx_v_v;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyInt_As_uint32_t(__pyx_arg_v); if (unlikely((__pyx_v_v == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 791, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 791, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_20__setitem__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((uint32_t)__pyx_v_v));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21TinyPatternDict_int32_20__setitem__(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, uint32_t __pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":797
 *         :param value: its value
 *         """
 *         self.data[pattern.cpattern] = v             # <<<<<<<<<<<<<<
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint8_t]& newdata):
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = __pyx_v_v;

  /* "colibricore_wrapper.pyx":791
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, uint32_t v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":799
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint8_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

static PyObject *__pyx_f_11colibricore_21TinyPatternDict_int32_bind(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t>  &__pyx_v_newdata) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":800
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint8_t]& newdata):
 *         self.data = newdata             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternDict_int: #maps Patterns to uint64
 */
  __pyx_v_self->data = __pyx_v_newdata;

  /* "colibricore_wrapper.pyx":799
 *         self.data[pattern.cpattern] = v
 * 
 *     cdef bind(self, cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint8_t]& newdata):             # <<<<<<<<<<<<<<
 *         self.data = newdata
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_22__reduce_cython__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_21TinyPatternDict_int32_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21TinyPatternDict_int32_24__setstate_cython__(((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21TinyPatternDict_int32_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_TinyPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.TinyPatternDict_int32.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":811
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternDict_int_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_15PatternDict_int_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int___bool__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternDict_int___bool__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":812
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":811
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":814
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_15PatternDict_int_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternDict_int_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_15PatternDict_int_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_2__len__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_15PatternDict_int_2__len__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":816
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":814
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":818
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_15PatternDict_int_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_15PatternDict_int_has(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_15PatternDict_int_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 818, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":819
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":818
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternDict_int.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 818, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_4has(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_4has(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_15PatternDict_int_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":821
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternDict_int_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_6__contains__[] = "Test if the pattern is in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternDict_int_6__contains__;
#endif
static int __pyx_pw_11colibricore_15PatternDict_int_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 821, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_6__contains__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternDict_int_6__contains__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":823
 *     def __contains__(self, Pattern pattern):
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_PatternDict_int *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":821
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_15PatternDict_int_10generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":825
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternDict_int_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_8__iter__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_8__iter__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_13___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_13___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 825, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_15PatternDict_int_10generator13, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternDict_int___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 825, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_15PatternDict_int_10generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 825, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":827
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":829
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":830
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":831
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":832
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":833
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":834
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 834, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":835
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":825
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":837
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_11__getitem__[] = "Retrieve the value for a pattern in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternDict_int_11__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 837, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_11__getitem__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("__getitem__", 0);

  /* "colibricore_wrapper.pyx":843
 *         :type pattern: Pattern
 *         """
 *         return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":837
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int.__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_11colibricore_15PatternDict_int_15generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":847
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_13items[] = "Iterate over all patterns and their values in the dictionary";
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_13items(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_13items(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_14_items(__pyx_ptype_11colibricore___pyx_scope_struct_14_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 847, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_15PatternDict_int_15generator14, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_PatternDict_int_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 847, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_15PatternDict_int_15generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  unsigned int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 847, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":849
 *     def items(self):
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":851
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":852
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":853
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":854
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":855
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":856
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 856, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":857
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 857, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":858
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":847
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":861
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 861, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_16read(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_16read(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":862
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":863
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise IOError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 863, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":862
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":865
 *             self.data.read(encode(filename))
 *         else:
 *             raise IOError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IOError, 0, 0, 0);
    __PYX_ERR(1, 865, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":861
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_int.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":867
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 867, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_18write(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_18write(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":868
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, Pattern pattern, int v):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 868, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":867
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_int.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":870
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, int v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternDict_int_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v); /*proto*/
static char __pyx_doc_11colibricore_15PatternDict_int_20__setitem__[] = "Set the value for a pattern in the dictionary\n\n        :param pattern: the pattern\n        :param value: its value\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternDict_int_20__setitem__;
#endif
static int __pyx_pw_11colibricore_15PatternDict_int_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v) {
  int __pyx_v_v;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_v); {
    __pyx_v_v = __Pyx_PyInt_As_int(__pyx_arg_v); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 870, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_int.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 870, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_20__setitem__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((int)__pyx_v_v));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternDict_int_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":876
 *         :param value: its value
 *         """
 *         self.data[pattern.cpattern] = v             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternDict_float: #maps Patterns to float
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = __pyx_v_v;

  /* "colibricore_wrapper.pyx":870
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, int v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_22__reduce_cython__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternDict_int_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternDict_int_24__setstate_cython__(((struct __pyx_obj_11colibricore_PatternDict_int *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternDict_int_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_int *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_int.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":887
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_float_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_17PatternDict_float_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float___bool__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_float___bool__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":888
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":887
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":890
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_17PatternDict_float_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_float_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_17PatternDict_float_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_2__len__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_17PatternDict_float_2__len__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":892
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":890
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":894
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_17PatternDict_float_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_17PatternDict_float_has(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_17PatternDict_float_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":895
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":894
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternDict_float.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 894, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_4has(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_4has(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_17PatternDict_float_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_float.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":897
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_float_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_6__contains__[] = "Test if the pattern is in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_float_6__contains__;
#endif
static int __pyx_pw_11colibricore_17PatternDict_float_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 897, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_6__contains__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_float_6__contains__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":899
 *     def __contains__(self, Pattern pattern):
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_PatternDict_float *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 899, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":897
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary"""
 *         return self.has(pattern)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_float.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_17PatternDict_float_10generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":901
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_float_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_8__iter__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_8__iter__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_15___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 901, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_17PatternDict_float_10generator15, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternDict_float___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 901, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_float.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_17PatternDict_float_10generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 901, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":903
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":905
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":906
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":907
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":908
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":909
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":910
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 910, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":911
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":901
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":913
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_11__getitem__[] = "Retrieve the value for a pattern in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_float_11__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_12__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 913, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_11__getitem__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_11__getitem__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("__getitem__", 0);

  /* "colibricore_wrapper.pyx":919
 *         :type pattern: Pattern
 *         """
 *         return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":913
 *             inc(it)
 * 
 *     def __getitem__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Retrieve the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_float.__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_11colibricore_17PatternDict_float_15generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":923
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_13items[] = "Iterate over all patterns and their values in the dictionary";
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_14items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_13items(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_13items(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_16_items(__pyx_ptype_11colibricore___pyx_scope_struct_16_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 923, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_17PatternDict_float_15generator16, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_PatternDict_float_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 923, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_float.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_17PatternDict_float_15generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 923, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":925
 *     def items(self):
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":927
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":928
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":929
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":930
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = PyFloat_FromDouble((*__pyx_cur_scope->__pyx_v_it).second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":931
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":932
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":933
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_value);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 933, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":934
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":923
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their values in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":937
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_17read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 937, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_16read(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_16read(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":938
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":939
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise IOError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 939, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":938
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":941
 *             self.data.read(encode(filename))
 *         else:
 *             raise IOError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IOError, 0, 0, 0);
    __PYX_ERR(1, 941, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":937
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_float.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":943
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_19write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 943, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_18write(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_18write(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":944
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, Pattern pattern, float v):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":943
 *             raise IOError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternDict_float.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":946
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, float v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_17PatternDict_float_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v); /*proto*/
static char __pyx_doc_11colibricore_17PatternDict_float_20__setitem__[] = "Set the value for a pattern in the dictionary\n\n        :param pattern: the pattern\n        :param value: its value\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_17PatternDict_float_20__setitem__;
#endif
static int __pyx_pw_11colibricore_17PatternDict_float_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_arg_v) {
  float __pyx_v_v;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_v); {
    __pyx_v_v = __pyx_PyFloat_AsFloat(__pyx_arg_v); if (unlikely((__pyx_v_v == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 946, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternDict_float.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 946, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_20__setitem__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((float)__pyx_v_v));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_17PatternDict_float_20__setitem__(struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, float __pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":952
 *         :param value: its value
 *         """
 *         self.data[pattern.cpattern] = v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = __pyx_v_v;

  /* "colibricore_wrapper.pyx":946
 *         self.data.write(encode(filename))
 * 
 *     def __setitem__(self, Pattern pattern, float v):             # <<<<<<<<<<<<<<
 *         """Set the value for a pattern in the dictionary
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_22__reduce_cython__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_float.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_17PatternDict_float_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_17PatternDict_float_24__setstate_cython__(((struct __pyx_obj_11colibricore_PatternDict_float *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_17PatternDict_float_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternDict_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternDict_float.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":963
 * 
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary. If you want the length for a particular pattern, use childcount(pattern)"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_24AlignedPatternDict_int32_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32___len__[] = "Return the total number of patterns in the dictionary. If you want the length for a particular pattern, use childcount(pattern)";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_24AlignedPatternDict_int32_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32___len__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_24AlignedPatternDict_int32___len__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":965
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary. If you want the length for a particular pattern, use childcount(pattern)"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def childcount(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":963
 * 
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary. If you want the length for a particular pattern, use childcount(pattern)"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":967
 *         return self.data.size()
 * 
 *     def childcount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of children for the specified pattern. Use children(pattern) to iterate over them."""
 *         return self.data[pattern.cpattern].size()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_3childcount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_2childcount[] = "Returns the number of children for the specified pattern. Use children(pattern) to iterate over them.";
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_3childcount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("childcount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 967, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_2childcount(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_2childcount(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("childcount", 0);

  /* "colibricore_wrapper.pyx":969
 *     def childcount(self, Pattern pattern):
 *         """Returns the number of children for the specified pattern. Use children(pattern) to iterate over them."""
 *         return self.data[pattern.cpattern].size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t((__pyx_v_self->data[__pyx_v_pattern->cpattern]).size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":967
 *         return self.data.size()
 * 
 *     def childcount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of children for the specified pattern. Use children(pattern) to iterate over them."""
 *         return self.data[pattern.cpattern].size()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.childcount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":971
 *         return self.data[pattern.cpattern].size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_has(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 971, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_24AlignedPatternDict_int32_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":972
 * 
 *     cpdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":971
 *         return self.data[pattern.cpattern].size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 971, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_4has(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_4has(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_24AlignedPatternDict_int32_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":974
 *         return self.data.has(pattern.cpattern)
 * 
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not self.data.has(pattern.cpattern):
 *             return False
 */

static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_7haspair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_haspair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("haspair", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_haspair); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 974, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_24AlignedPatternDict_int32_7haspair)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 974, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 974, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 974, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern2));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern2));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 974, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":975
 * 
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):
 *         if not self.data.has(pattern.cpattern):             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_7 = ((!(__pyx_v_self->data.has(__pyx_v_pattern->cpattern) != 0)) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":976
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):
 *         if not self.data.has(pattern.cpattern):
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return self.data[pattern.cpattern].has(pattern2.cpattern)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":975
 * 
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):
 *         if not self.data.has(pattern.cpattern):             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":978
 *             return False
 *         else:
 *             return self.data[pattern.cpattern].has(pattern2.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, item):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->data[__pyx_v_pattern->cpattern]).has(__pyx_v_pattern2->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":974
 *         return self.data.has(pattern.cpattern)
 * 
 *     cpdef haspair(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not self.data.has(pattern.cpattern):
 *             return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.haspair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_7haspair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_7haspair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("haspair (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_pattern2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("haspair", 1, 2, 2, 1); __PYX_ERR(1, 974, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "haspair") < 0)) __PYX_ERR(1, 974, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_pattern2 = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("haspair", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 974, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.haspair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 974, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern2), __pyx_ptype_11colibricore_Pattern, 1, "pattern2", 0))) __PYX_ERR(1, 974, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_6haspair(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), __pyx_v_pattern, __pyx_v_pattern2);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_6haspair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  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("haspair", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_24AlignedPatternDict_int32_haspair(__pyx_v_self, __pyx_v_pattern, __pyx_v_pattern2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.haspair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":980
 *             return self.data[pattern.cpattern].has(pattern2.cpattern)
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         """Test if the pattern or the combination of patterns is in the aligned dictionary::
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_24AlignedPatternDict_int32_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_8__contains__[] = "Test if the pattern or the combination of patterns is in the aligned dictionary::\n\n                pattern in aligneddict\n\n            Or:\n\n                (pattern1,pattern2) in aligneddict\n\n            ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_8__contains__;
#endif
static int __pyx_pw_11colibricore_24AlignedPatternDict_int32_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_8__contains__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_24AlignedPatternDict_int32_8__contains__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":990
 * 
 *             """
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_item); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":991
 *             """
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 991, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_t_3 != 2) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":992
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 992, __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_ERR(1, 992, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":991
 *             """
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    }

    /* "colibricore_wrapper.pyx":993
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.haspair(item[0], item[1])
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":994
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.haspair(item[0], item[1])
 *         elif not isinstance(item, Pattern):
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __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_ERR(1, 994, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":993
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.haspair(item[0], item[1])
 */
    }

    /* "colibricore_wrapper.pyx":995
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.haspair(item[0], item[1])             # <<<<<<<<<<<<<<
 *         elif not isinstance(item, Pattern):
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 995, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 995, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->haspair(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6), 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 995, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":990
 * 
 *             """
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":996
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.haspair(item[0], item[1])
 *         elif not isinstance(item, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.has(item)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_item, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":997
 *             return self.haspair(item[0], item[1])
 *         elif not isinstance(item, Pattern):
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.has(item)
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(1, 997, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":996
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.haspair(item[0], item[1])
 *         elif not isinstance(item, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.has(item)
 */
  }

  /* "colibricore_wrapper.pyx":980
 *             return self.data[pattern.cpattern].has(pattern2.cpattern)
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         """Test if the pattern or the combination of patterns is in the aligned dictionary::
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_12generator17(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1000
 *             return self.has(item)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead, to iterate over the children for a specific pattern, use children()"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_11__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_10__iter__[] = "Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead, to iterate over the children for a specific pattern, use children()";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_10__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_10__iter__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_10__iter__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_17___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_17___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1000, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_24AlignedPatternDict_int32_12generator17, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_AlignedPatternDict_int32___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1000, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_12generator17(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 1000, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1002
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead, to iterate over the children for a specific pattern, use children()"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1004
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":1005
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1006
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1007
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1008
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1009
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1009, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1010
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1000
 *             return self.has(item)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead, to iterate over the children for a specific pattern, use children()"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_15generator18(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1013
 * 
 * 
 *     def children(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_14children(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_13children[] = "Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead";
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_14children(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("children (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1013, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_13children(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_13children(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("children", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)__pyx_tp_new_11colibricore___pyx_scope_struct_18_children(__pyx_ptype_11colibricore___pyx_scope_struct_18_children, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1013, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_24AlignedPatternDict_int32_15generator18, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_children, __pyx_n_s_AlignedPatternDict_int32_childre, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1013, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_15generator18(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("children", 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_ERR(1, 1013, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1018
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2_end
 *         cdef cPattern cpattern
 *         it2 = self.data[pattern.cpattern].begin()             # <<<<<<<<<<<<<<
 *         it2_end = self.data[pattern.cpattern].end()
 *         while it2 != it2_end:
 */
  __pyx_cur_scope->__pyx_v_it2 = (__pyx_cur_scope->__pyx_v_self->data[__pyx_cur_scope->__pyx_v_pattern->cpattern]).begin();

  /* "colibricore_wrapper.pyx":1019
 *         cdef cPattern cpattern
 *         it2 = self.data[pattern.cpattern].begin()
 *         it2_end = self.data[pattern.cpattern].end()             # <<<<<<<<<<<<<<
 *         while it2 != it2_end:
 *             cpattern = deref(it2).first
 */
  __pyx_cur_scope->__pyx_v_it2_end = (__pyx_cur_scope->__pyx_v_self->data[__pyx_cur_scope->__pyx_v_pattern->cpattern]).end();

  /* "colibricore_wrapper.pyx":1020
 *         it2 = self.data[pattern.cpattern].begin()
 *         it2_end = self.data[pattern.cpattern].end()
 *         while it2 != it2_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it2).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it2 != __pyx_cur_scope->__pyx_v_it2_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1021
 *         it2_end = self.data[pattern.cpattern].end()
 *         while it2 != it2_end:
 *             cpattern = deref(it2).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it2).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1022
 *         while it2 != it2_end:
 *             cpattern = deref(it2).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1023
 *             cpattern = deref(it2).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it2)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1023, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1024
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it2)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1024, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1025
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it2));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1013
 * 
 * 
 *     def children(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary. If you want to iterate over pattern pairs, use pairs() instead"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_18generator19(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1028
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all pattern pairs and their values in the dictionary. Yields (pattern1,pattern2,value) tuples"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_17items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_16items[] = "Iterate over all pattern pairs and their values in the dictionary. Yields (pattern1,pattern2,value) tuples";
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_17items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_16items(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_16items(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_19_items(__pyx_ptype_11colibricore___pyx_scope_struct_19_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1028, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_24AlignedPatternDict_int32_18generator19, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_AlignedPatternDict_int32_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1028, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_24AlignedPatternDict_int32_18generator19(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1028, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1033
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2end
 *         cdef int value
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1035
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":1036
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1037
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1038
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             it2 = self.data[pattern.cpattern].begin()
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1039
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             it2 = self.data[pattern.cpattern].begin()
 *             it2end = self.data[pattern.cpattern].end()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1040
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             it2 = self.data[pattern.cpattern].begin()             # <<<<<<<<<<<<<<
 *             it2end = self.data[pattern.cpattern].end()
 *             while it2 != it2end:
 */
    __pyx_cur_scope->__pyx_v_it2 = (__pyx_cur_scope->__pyx_v_self->data[__pyx_cur_scope->__pyx_v_pattern->cpattern]).begin();

    /* "colibricore_wrapper.pyx":1041
 *             pattern.bind(cpattern)
 *             it2 = self.data[pattern.cpattern].begin()
 *             it2end = self.data[pattern.cpattern].end()             # <<<<<<<<<<<<<<
 *             while it2 != it2end:
 *                 cpattern = deref(it2).first
 */
    __pyx_cur_scope->__pyx_v_it2end = (__pyx_cur_scope->__pyx_v_self->data[__pyx_cur_scope->__pyx_v_pattern->cpattern]).end();

    /* "colibricore_wrapper.pyx":1042
 *             it2 = self.data[pattern.cpattern].begin()
 *             it2end = self.data[pattern.cpattern].end()
 *             while it2 != it2end:             # <<<<<<<<<<<<<<
 *                 cpattern = deref(it2).first
 *                 pattern2 = Pattern()
 */
    while (1) {
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it2 != __pyx_cur_scope->__pyx_v_it2end) != 0);
      if (!__pyx_t_1) break;

      /* "colibricore_wrapper.pyx":1043
 *             it2end = self.data[pattern.cpattern].end()
 *             while it2 != it2end:
 *                 cpattern = deref(it2).first             # <<<<<<<<<<<<<<
 *                 pattern2 = Pattern()
 *                 pattern2.bind(cpattern)
 */
      __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it2).first;
      __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

      /* "colibricore_wrapper.pyx":1044
 *             while it2 != it2end:
 *                 cpattern = deref(it2).first
 *                 pattern2 = Pattern()             # <<<<<<<<<<<<<<
 *                 pattern2.bind(cpattern)
 *                 value = deref(it2).second
 */
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern2));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern2, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;

      /* "colibricore_wrapper.pyx":1045
 *                 cpattern = deref(it2).first
 *                 pattern2 = Pattern()
 *                 pattern2.bind(cpattern)             # <<<<<<<<<<<<<<
 *                 value = deref(it2).second
 *                 yield pattern, pattern2, value
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern2->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern2, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "colibricore_wrapper.pyx":1046
 *                 pattern2 = Pattern()
 *                 pattern2.bind(cpattern)
 *                 value = deref(it2).second             # <<<<<<<<<<<<<<
 *                 yield pattern, pattern2, value
 *                 inc(it2)
 */
      __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_it2).second;
      __pyx_cur_scope->__pyx_v_value = __pyx_t_4;

      /* "colibricore_wrapper.pyx":1047
 *                 pattern2.bind(cpattern)
 *                 value = deref(it2).second
 *                 yield pattern, pattern2, value             # <<<<<<<<<<<<<<
 *                 inc(it2)
 *             inc(it)
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern2));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern2));
      PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern2));
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L8_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1047, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1048
 *                 value = deref(it2).second
 *                 yield pattern, pattern2, value
 *                 inc(it2)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
      (void)((++__pyx_cur_scope->__pyx_v_it2));
    }

    /* "colibricore_wrapper.pyx":1049
 *                 yield pattern, pattern2, value
 *                 inc(it2)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1028
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all pattern pairs and their values in the dictionary. Yields (pattern1,pattern2,value) tuples"""
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t].iterator it2
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1051
 *             inc(it)
 * 
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *__pyx_f_11colibricore_24AlignedPatternDict_int32_getmap(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *__pyx_v_m;
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getmap", 0);

  /* "colibricore_wrapper.pyx":1052
 * 
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 * 
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1053
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 * 
 *         if not self.has(pattern):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1053, __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_ERR(1, 1053, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1052
 * 
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1055
 *             raise ValueError("Expected instance of Pattern")
 * 
 *         if not self.has(pattern):             # <<<<<<<<<<<<<<
 *            self.data[pattern.cpattern]
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":1056
 * 
 *         if not self.has(pattern):
 *            self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 * 
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * m = &(self.data[pattern.cpattern])
 */
    (void)((__pyx_v_self->data[__pyx_v_pattern->cpattern]));

    /* "colibricore_wrapper.pyx":1055
 *             raise ValueError("Expected instance of Pattern")
 * 
 *         if not self.has(pattern):             # <<<<<<<<<<<<<<
 *            self.data[pattern.cpattern]
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1058
 *            self.data[pattern.cpattern]
 * 
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * m = &(self.data[pattern.cpattern])             # <<<<<<<<<<<<<<
 *         return m
 * 
 */
  __pyx_v_m = (&(__pyx_v_self->data[__pyx_v_pattern->cpattern]));

  /* "colibricore_wrapper.pyx":1059
 * 
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * m = &(self.data[pattern.cpattern])
 *         return m             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1051
 *             inc(it)
 * 
 *     cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * getmap(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("colibricore.AlignedPatternDict_int32.getmap", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1064
 * 
 * 
 *     cpdef getpair(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         return self.data[pattern.cpattern][pattern2.cpattern]
 * 
 */

static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_20getpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_getpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getpair", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getpair); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_24AlignedPatternDict_int32_20getpair)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1064, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1064, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1064, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern2));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern2));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1064, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1065
 * 
 *     cpdef getpair(self, Pattern pattern, Pattern pattern2):
 *         return self.data[pattern.cpattern][pattern2.cpattern]             # <<<<<<<<<<<<<<
 * 
 *     cpdef setpair(self, Pattern pattern, Pattern pattern2, uint32_t value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(((__pyx_v_self->data[__pyx_v_pattern->cpattern])[__pyx_v_pattern2->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1064
 * 
 * 
 *     cpdef getpair(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         return self.data[pattern.cpattern][pattern2.cpattern]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.getpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_20getpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_20getpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getpair (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_pattern2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getpair", 1, 2, 2, 1); __PYX_ERR(1, 1064, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getpair") < 0)) __PYX_ERR(1, 1064, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_pattern2 = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getpair", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1064, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.getpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1064, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern2), __pyx_ptype_11colibricore_Pattern, 1, "pattern2", 0))) __PYX_ERR(1, 1064, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_19getpair(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), __pyx_v_pattern, __pyx_v_pattern2);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_19getpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  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("getpair", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_24AlignedPatternDict_int32_getpair(__pyx_v_self, __pyx_v_pattern, __pyx_v_pattern2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.getpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1067
 *         return self.data[pattern.cpattern][pattern2.cpattern]
 * 
 *     cpdef setpair(self, Pattern pattern, Pattern pattern2, uint32_t value):             # <<<<<<<<<<<<<<
 *         self.data[pattern.cpattern][pattern2.cpattern] = value
 * 
 */

static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_22setpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_24AlignedPatternDict_int32_setpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, uint32_t __pyx_v_value, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setpair", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setpair); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1067, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_24AlignedPatternDict_int32_22setpair)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1067, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1067, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1067, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1067, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern2));
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1067, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1068
 * 
 *     cpdef setpair(self, Pattern pattern, Pattern pattern2, uint32_t value):
 *         self.data[pattern.cpattern][pattern2.cpattern] = value             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  ((__pyx_v_self->data[__pyx_v_pattern->cpattern])[__pyx_v_pattern2->cpattern]) = __pyx_v_value;

  /* "colibricore_wrapper.pyx":1067
 *         return self.data[pattern.cpattern][pattern2.cpattern]
 * 
 *     cpdef setpair(self, Pattern pattern, Pattern pattern2, uint32_t value):             # <<<<<<<<<<<<<<
 *         self.data[pattern.cpattern][pattern2.cpattern] = value
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.setpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_22setpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_22setpair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2 = 0;
  uint32_t __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setpair (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_pattern2,&__pyx_n_s_value,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setpair", 1, 3, 3, 1); __PYX_ERR(1, 1067, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setpair", 1, 3, 3, 2); __PYX_ERR(1, 1067, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setpair") < 0)) __PYX_ERR(1, 1067, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_pattern2 = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
    __pyx_v_value = __Pyx_PyInt_As_uint32_t(values[2]); if (unlikely((__pyx_v_value == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1067, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setpair", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1067, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.setpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1067, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern2), __pyx_ptype_11colibricore_Pattern, 1, "pattern2", 0))) __PYX_ERR(1, 1067, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_21setpair(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), __pyx_v_pattern, __pyx_v_pattern2, __pyx_v_value);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_21setpair(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, uint32_t __pyx_v_value) {
  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("setpair", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_24AlignedPatternDict_int32_setpair(__pyx_v_self, __pyx_v_pattern, __pyx_v_pattern2, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.setpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1070
 *         self.data[pattern.cpattern][pattern2.cpattern] = value
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieve the item, item is a two-tuple of Pattern instances.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_24__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static char __pyx_doc_11colibricore_24AlignedPatternDict_int32_23__getitem__[] = "Retrieve the item, item is a two-tuple of Pattern instances.\n\n             aligneddict[(pattern1,pattern2)]\n\n\n        :param item: A two tuple of Pattern instances\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_23__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_24__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_23__getitem__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_23__getitem__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item) {
  PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *__pyx_v_mapdata;
  struct __pyx_obj_11colibricore_PatternDict_int32 *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":1080
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * mapdata
 * 
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_item); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":1081
 * 
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1081, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_t_3 != 2) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":1082
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1082, __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_ERR(1, 1082, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1081
 * 
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    }

    /* "colibricore_wrapper.pyx":1083
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.getpair(item[0], item[1])
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":1084
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.getpair(item[0], item[1])
 *         elif isinstance(item, Pattern):
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1084, __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_ERR(1, 1084, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1083
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.getpair(item[0], item[1])
 */
    }

    /* "colibricore_wrapper.pyx":1085
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.getpair(item[0], item[1])             # <<<<<<<<<<<<<<
 *         elif isinstance(item, Pattern):
 *             mapdata = self.getmap(item[0])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1085, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1085, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->getpair(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6), 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":1080
 *         cdef cPatternMap[uint32_t,cBaseValueHandler[uint32_t],uint32_t] * mapdata
 * 
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":1086
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.getpair(item[0], item[1])
 *         elif isinstance(item, Pattern):             # <<<<<<<<<<<<<<
 *             mapdata = self.getmap(item[0])
 *             d = PatternDict_int32()
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_item, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1087
 *             return self.getpair(item[0], item[1])
 *         elif isinstance(item, Pattern):
 *             mapdata = self.getmap(item[0])             # <<<<<<<<<<<<<<
 *             d = PatternDict_int32()
 *             d.bind(deref(mapdata))
 */
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1087, __pyx_L1_error)
    __pyx_v_mapdata = ((struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->getmap(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_7));
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "colibricore_wrapper.pyx":1088
 *         elif isinstance(item, Pattern):
 *             mapdata = self.getmap(item[0])
 *             d = PatternDict_int32()             # <<<<<<<<<<<<<<
 *             d.bind(deref(mapdata))
 *             return d
 */
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternDict_int32)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_d = ((struct __pyx_obj_11colibricore_PatternDict_int32 *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "colibricore_wrapper.pyx":1089
 *             mapdata = self.getmap(item[0])
 *             d = PatternDict_int32()
 *             d.bind(deref(mapdata))             # <<<<<<<<<<<<<<
 *             return d
 *         else:
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_PatternDict_int32 *)__pyx_v_d->__pyx_vtab)->bind(__pyx_v_d, (*__pyx_v_mapdata)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "colibricore_wrapper.pyx":1090
 *             d = PatternDict_int32()
 *             d.bind(deref(mapdata))
 *             return d             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_d));
    __pyx_r = ((PyObject *)__pyx_v_d);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":1086
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 *             return self.getpair(item[0], item[1])
 *         elif isinstance(item, Pattern):             # <<<<<<<<<<<<<<
 *             mapdata = self.getmap(item[0])
 *             d = PatternDict_int32()
 */
  }

  /* "colibricore_wrapper.pyx":1092
 *             return d
 *         else:
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  /*else*/ {
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(1, 1092, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1070
 *         self.data[pattern.cpattern][pattern2.cpattern] = value
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieve the item, item is a two-tuple of Pattern instances.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1094
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_24AlignedPatternDict_int32_26__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_11colibricore_24AlignedPatternDict_int32_26__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_25__setitem__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_24AlignedPatternDict_int32_25__setitem__(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  uint32_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":1095
 * 
 *     def __setitem__(self, item, value):
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_item); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1096
 *     def __setitem__(self, item, value):
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1096, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_t_3 != 2) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":1097
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected two-tuple of Patterns")
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1097, __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_ERR(1, 1097, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1096
 *     def __setitem__(self, item, value):
 *         if isinstance(item, tuple):
 *             if len(item) != 2:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 */
    }

    /* "colibricore_wrapper.pyx":1098
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             self.setpair(item[0], item[1], value)
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":1099
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             self.setpair(item[0], item[1], value)
 *         else:
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1099, __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_ERR(1, 1099, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1098
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             self.setpair(item[0], item[1], value)
 */
    }

    /* "colibricore_wrapper.pyx":1100
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected two-tuple of Patterns")
 *             self.setpair(item[0], item[1], value)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Expected two-tuple of Patterns")
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1100, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1100, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_7 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1100, __pyx_L1_error)
    __pyx_t_8 = ((struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self->__pyx_vtab)->setpair(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6), __pyx_t_7, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "colibricore_wrapper.pyx":1095
 * 
 *     def __setitem__(self, item, value):
 *         if isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1102
 *             self.setpair(item[0], item[1], value)
 *         else:
 *             raise ValueError("Expected two-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(1, 1102, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1094
 *             raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1105
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_28read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_28read(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1105, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_27read(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_27read(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":1106
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_4)) {

    /* "colibricore_wrapper.pyx":1107
 *     def read(self, str filename):
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise FileNotFoundError
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1107, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.read(__pyx_t_5);

    /* "colibricore_wrapper.pyx":1106
 * 
 *     def read(self, str filename):
 *         if os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             self.data.read(encode(filename))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1109
 *             self.data.read(encode(filename))
 *         else:
 *             raise FileNotFoundError             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1109, __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_ERR(1, 1109, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1105
 * 
 * 
 *     def read(self, str filename):             # <<<<<<<<<<<<<<
 *         if os.path.exists(filename):
 *             self.data.read(encode(filename))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1111
 *             raise FileNotFoundError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1111, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_29write(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_29write(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":1112
 * 
 *     def write(self, str filename):
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->data.write(__pyx_t_4);

  /* "colibricore_wrapper.pyx":1111
 *             raise FileNotFoundError
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         self.data.write(encode(filename))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_32__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_32__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_31__reduce_cython__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_31__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_34__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_24AlignedPatternDict_int32_34__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_24AlignedPatternDict_int32_33__setstate_cython__(((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_24AlignedPatternDict_int32_33__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.AlignedPatternDict_int32.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1123
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_19IndexedPatternModel_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_19IndexedPatternModel_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel___len__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_19IndexedPatternModel___len__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":1125
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1123
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1127
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_19IndexedPatternModel_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_19IndexedPatternModel_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_2__bool__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_19IndexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":1128
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1127
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1130
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_4types(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_4types(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":1132
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1130
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1134
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_6tokens(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_6tokens(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":1136
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1134
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1138
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_8minlength(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_8minlength(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":1140
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1138
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1142
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_10maxlength(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":1144
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1142
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1146
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_12type(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_12type(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":1148
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.type()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1146
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1150
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_14version(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_14version(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":1152
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.version()             # <<<<<<<<<<<<<<
 * 
 *     def occurrencecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1150
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1154
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_16occurrencecount[] = "Returns the number of times the specified pattern occurs in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("occurrencecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1154, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_16occurrencecount(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("occurrencecount", 0);

  /* "colibricore_wrapper.pyx":1161
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1162
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1162, __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_ERR(1, 1162, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1161
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1163
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coveragecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.occurrencecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1154
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.occurrencecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1165
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_18coveragecount[] = "Returns the number of tokens all instances of the specified pattern cover in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coveragecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1165, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_18coveragecount(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coveragecount", 0);

  /* "colibricore_wrapper.pyx":1172
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1173
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1173, __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_ERR(1, 1173, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1172
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1174
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coverage(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.coveragecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1165
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.coveragecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1176
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_20coverage[] = "Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coverage (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1176, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_20coverage(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_20coverage(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coverage", 0);

  /* "colibricore_wrapper.pyx":1183
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1184
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coverage(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1184, __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_ERR(1, 1184, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1183
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1185
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def frequency(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.coverage(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1176
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1187
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_22frequency[] = "Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frequency (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1187, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_22frequency(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_22frequency(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frequency", 0);

  /* "colibricore_wrapper.pyx":1194
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1195
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.frequency(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1195, __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_ERR(1, 1195, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1194
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1196
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.frequency(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1187
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1199
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_24totaloccurrencesingroup[] = "Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaloccurrencesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaloccurrencesingroup") < 0)) __PYX_ERR(1, 1199, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1199, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1199, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaloccurrencesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_24totaloccurrencesingroup(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaloccurrencesingroup", 0);

  /* "colibricore_wrapper.pyx":1208
 *         :rtype: int
 *         """
 *         return self.data.totaloccurrencesingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaloccurrencesingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1199
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1210
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_26totalpatternsingroup[] = "Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalpatternsingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalpatternsingroup") < 0)) __PYX_ERR(1, 1210, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1210, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1210, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalpatternsingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1210, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_26totalpatternsingroup(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalpatternsingroup", 0);

  /* "colibricore_wrapper.pyx":1219
 *         :rtype: int
 *         """
 *         return self.data.totalpatternsingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totalpatternsingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1210
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1221
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_28totaltokensingroup[] = "Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaltokensingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaltokensingroup") < 0)) __PYX_ERR(1, 1221, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1221, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1221, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaltokensingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1221, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_28totaltokensingroup(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaltokensingroup", 0);

  /* "colibricore_wrapper.pyx":1230
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1221
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1232
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_30totalwordtypesingroup[] = "Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalwordtypesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalwordtypesingroup") < 0)) __PYX_ERR(1, 1232, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1232, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1232, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalwordtypesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1232, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_30totalwordtypesingroup(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalwordtypesingroup", 0);

  /* "colibricore_wrapper.pyx":1241
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1232
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1244
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_has(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":1245
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1246
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1246, __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_ERR(1, 1246, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1245
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1247
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1244
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1249
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_19IndexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_32__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n    \n        Example::\n    \n            pattern in patternmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel_32__contains__;
#endif
static int __pyx_pw_11colibricore_19IndexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_32__contains__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_19IndexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":1260
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1261
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1261, __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_ERR(1, 1261, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1260
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":1262
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1262, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1249
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1264
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_34__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel_34__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_34__getitem__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":1275
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1276
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1276, __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_ERR(1, 1276, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1275
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":1277
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 1277, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1264
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__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_11colibricore_19IndexedPatternModel_38generator20(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1281
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_37__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_36__iter__[] = "Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.\n    \n        Example::\n    \n            for pattern in model:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel_36__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_37__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_36__iter__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_20___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_20___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1281, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_38generator20, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_IndexedPatternModel___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1281, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_38generator20(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 1281, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1290
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1292
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1293
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1294
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1295
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1296
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1296, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1297
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1281
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1299
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_19IndexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_39__init__[] = "Initialise a pattern model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A model to be used as a constraint, only patterns occuring in this constraint model will be loaded/trained\n        :type constrainmodel: IndexedPatternModel, UnindexedPatternModel or None (default)\n        :param reverseindex: Corpus data to use as reverse index. On indexed models, this is required for various operations, including computation of skipgrams\n        :type reverseindex: IndexedCorpus or None\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel_39__init__;
#endif
static int __pyx_pw_11colibricore_19IndexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  PyObject *__pyx_v_reverseindex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,&__pyx_n_s_reverseindex,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reverseindex);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 1299, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
    __pyx_v_reverseindex = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1299, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1299, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_39__init__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, __pyx_v_reverseindex);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_19IndexedPatternModel_39__init__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":1312
 *         """
 * 
 *         self.corpus = None             # <<<<<<<<<<<<<<
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = Py_None;

  /* "colibricore_wrapper.pyx":1313
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reverseindex); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1313, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":1314
 *         self.corpus = None
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadreverseindex); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_reverseindex) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_reverseindex);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1314, __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;

    /* "colibricore_wrapper.pyx":1313
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1316
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":1317
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1317, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_1) != 0);
    if (__pyx_t_5) {

      /* "colibricore_wrapper.pyx":1318
 *         if filename:
 *             if not options:
 *                 options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 */
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "colibricore_wrapper.pyx":1317
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    }

    /* "colibricore_wrapper.pyx":1319
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_5 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1319, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = ((!__pyx_t_1) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (unlikely(__pyx_t_5)) {

      /* "colibricore_wrapper.pyx":1320
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *             self.load(filename,options, constrainmodel)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 1320, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1319
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    }

    /* "colibricore_wrapper.pyx":1321
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1321, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1321, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_options));
      __Pyx_INCREF(__pyx_v_constrainmodel);
      __Pyx_GIVEREF(__pyx_v_constrainmodel);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_constrainmodel);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1316
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  }

  /* "colibricore_wrapper.pyx":1299
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1323
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_41load[] = "Load a patternmodel from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 1323, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1323, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1323, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1323, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_41load(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_41load(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":1331
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1331, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":1332
 *         """
 *         if not options:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 * 
 *         if filename and not os.path.exists(filename):
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1331
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1334
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1335
 * 
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 1335, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1334
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1337
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":1338
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 1338, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1337
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":1339
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_2 = (__pyx_t_6 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":1340
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 1340, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1339
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":1341
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":1342
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 1342, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1341
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":1344
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1344, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    try {
      __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, NULL);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
      __PYX_ERR(1, 1344, __pyx_L1_error)
    }
  }
  __pyx_L7:;

  /* "colibricore_wrapper.pyx":1323
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1346
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadreverseindex (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseindex), __pyx_ptype_11colibricore_IndexedCorpus, 1, "reverseindex", 0))) __PYX_ERR(1, 1346, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_43loadreverseindex(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_reverseindex));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  IndexedCorpus *__pyx_t_1;
  __Pyx_RefNannySetupContext("loadreverseindex", 0);

  /* "colibricore_wrapper.pyx":1347
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data             # <<<<<<<<<<<<<<
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 * 
 */
  __pyx_t_1 = __pyx_v_reverseindex->data;
  __pyx_v_self->data.reverseindex = __pyx_t_1;

  /* "colibricore_wrapper.pyx":1348
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = ((PyObject *)__pyx_v_reverseindex);

  /* "colibricore_wrapper.pyx":1346
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1351
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_46loadconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1351, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1351, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1352
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 1352, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1351
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 1351, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 1351, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1351, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1351, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1351, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1351, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_45loadconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1354
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_48loadconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1354, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1354, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1354, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1354, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1355
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 1355, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1354
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 1354, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 1354, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 1354, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1354, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1354, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1354, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_47loadconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1357
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbysetmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_50loadconstrainedbysetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1357, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1357, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1357, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1357, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1358
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1358, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 1358, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1357
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 1); __PYX_ERR(1, 1357, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 2); __PYX_ERR(1, 1357, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbysetmodel") < 0)) __PYX_ERR(1, 1357, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1357, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1357, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1357, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_49loadconstrainedbysetmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbysetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1360
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_51read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 1360, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1360, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1360, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1360, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_51read(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_51read(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":1362
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1362, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1362, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":1360
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1364
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_write(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_54write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1364, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1370
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1370, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 1370, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1364
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_53write[] = "Write a patternmodel to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1364, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_53write(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_53write(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1372
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_printmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_56printmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_decoder)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_decoder));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1372, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1378
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.printmodel(&cout, decoder.data )             # <<<<<<<<<<<<<<
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):
 */
  __pyx_v_self->data.printmodel((&std::cout), __pyx_v_decoder->data);

  /* "colibricore_wrapper.pyx":1372
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_55printmodel[] = "Print the entire pattern model to stdout, a detailed overview\n    \n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printmodel (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 1372, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_55printmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_decoder));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("printmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_printmodel(__pyx_v_self, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1380
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_train(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train *__pyx_optional_args) {
  PyObject *__pyx_v_constrainmodel = ((PyObject *)Py_None);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  std::string __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_constrainmodel = __pyx_optional_args->constrainmodel;
    }
  }
  __Pyx_INCREF(__pyx_v_filename);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_58train)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1380, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1380, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1380, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(__pyx_v_constrainmodel);
          __Pyx_GIVEREF(__pyx_v_constrainmodel);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_constrainmodel);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1380, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1391
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex != NULL) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1392
 * 
 *         if self.data.reverseindex != NULL:
 *             filename = ""             # <<<<<<<<<<<<<<
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 */
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_u_);

    /* "colibricore_wrapper.pyx":1391
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  }

  /* "colibricore_wrapper.pyx":1393
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_9 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_options), __pyx_n_s_DOSKIPGRAMS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_t_9;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1394
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1394, __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_ERR(1, 1394, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1393
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1397
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_constrainmodel); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 1397, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1398
 * 
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0             # <<<<<<<<<<<<<<
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = PyObject_Length(__pyx_v_constrainmodel); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1398, __pyx_L1_error)
      if (unlikely(!((__pyx_t_10 >= 0) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(1, 1398, __pyx_L1_error)
      }
    }
    #endif

    /* "colibricore_wrapper.pyx":1399
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":1400
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 1400, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":1399
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":1401
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (__pyx_t_7) {

      /* "colibricore_wrapper.pyx":1402
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 1402, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":1401
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":1403
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":1404
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 1404, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":1403
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":1405
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (likely(__pyx_t_7)) {

      /* "colibricore_wrapper.pyx":1406
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float))))) __PYX_ERR(1, 1406, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":1405
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":1408
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage             # <<<<<<<<<<<<<<
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1408, __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_ERR(1, 1408, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "colibricore_wrapper.pyx":1397
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":1409
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1410
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1410, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_11), __pyx_v_options->coptions, NULL, NULL);

    /* "colibricore_wrapper.pyx":1409
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":1411
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1412
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1412, __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_ERR(1, 1412, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1411
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1414
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, NULL);
  }
  __pyx_L8:;

  /* "colibricore_wrapper.pyx":1380
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_57train[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A patternmodel or patternsetmodel to constrain training (default None)\n        :type constrainmodel: None, UnindexedPatternModel, IndexedPatternModel, PatternSetModel\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, 1); __PYX_ERR(1, 1380, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) __PYX_ERR(1, 1380, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1380, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1380, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1380, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_57train(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_57train(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.constrainmodel = __pyx_v_constrainmodel;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_IndexedPatternModel->train(__pyx_v_self, __pyx_v_filename, __pyx_v_options, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1416
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch) {
  PatternSet<unsigned int>  *__pyx_v_cfilterset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train_filtered", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train_filtered); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_60train_filtered)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1416, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1416, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1416, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_filterset));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_filterset));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_filterset));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1416, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1425
 *         :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).
 *         """
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
  __pyx_v_cfilterset = (&__pyx_v_filterset->data);

  /* "colibricore_wrapper.pyx":1427
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1428
 * 
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1428, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);

    /* "colibricore_wrapper.pyx":1427
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1429
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1430
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1430, __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_ERR(1, 1430, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1429
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1432
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1416
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_59train_filtered[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train_filtered (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_filterset,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 1); __PYX_ERR(1, 1416, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 2); __PYX_ERR(1, 1416, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_filtered") < 0)) __PYX_ERR(1, 1416, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_filterset = ((struct __pyx_obj_11colibricore_PatternSet *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1416, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1416, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1416, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filterset), __pyx_ptype_11colibricore_PatternSet, 1, "filterset", 0))) __PYX_ERR(1, 1416, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_59train_filtered(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_filterset);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset) {
  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("train_filtered", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_train_filtered(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_filterset, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1435
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_19IndexedPatternModel_getinterface(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":1436
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1435
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1438
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_62trainconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1438, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1438, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1439
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1440
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":1439
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1441
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1442
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1442, __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_ERR(1, 1442, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1441
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1444
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1438
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 1438, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 1438, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 1438, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1438, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1438, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1438, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1438, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_61trainconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1446
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_64trainconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1446, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1446, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1447
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1448
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1448, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":1447
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1449
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1450
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1450, __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_ERR(1, 1450, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1449
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1452
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1446
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 1446, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 1446, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 1446, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1446, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1446, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1446, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1446, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_63trainconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1454
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbypatternsetmode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1454, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_66trainconstrainedbypatternsetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1454, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1454, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1454, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1454, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1455
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1456
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":1455
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1457
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1458
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1458, __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_ERR(1, 1458, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1457
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1460
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1454
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 1); __PYX_ERR(1, 1454, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 2); __PYX_ERR(1, 1454, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbypatternsetmodel") < 0)) __PYX_ERR(1, 1454, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1454, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1454, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1454, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 1454, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_65trainconstrainedbypatternsetmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbypatternsetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1462
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyalignmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_68trainconstrainedbyalignmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1462, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1462, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1462, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1462, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1463
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":1464
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1464, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":1463
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":1465
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":1466
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1466, __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_ERR(1, 1466, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1465
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1468
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef report(self):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":1462
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 1); __PYX_ERR(1, 1462, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 2); __PYX_ERR(1, 1462, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyalignmodel") < 0)) __PYX_ERR(1, 1462, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 1462, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 1462, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternAlignmentModel_float, 1, "constrainmodel", 0))) __PYX_ERR(1, 1462, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_67trainconstrainedbyalignmodel(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel) {
  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("trainconstrainedbyalignmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1470
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_report(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_report); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_70report)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1470, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1472
 *     cpdef report(self):
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)             # <<<<<<<<<<<<<<
 * 
 *     cpdef printhistogram(self):
 */
  __pyx_v_self->data.report((&std::cout));

  /* "colibricore_wrapper.pyx":1470
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_69report[] = "Print a detailed statistical report to stdout";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("report (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_69report(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_69report(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_report(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1474
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printhistogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_72printhistogram)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1474, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1476
 *     cpdef printhistogram(self):
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.histogram((&std::cout));

  /* "colibricore_wrapper.pyx":1474
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_71printhistogram[] = "Print a histogram to stdout";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printhistogram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_71printhistogram(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_printhistogram(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1480
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_prune(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune *__pyx_optional_args) {
  int __pyx_v_n = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_n = __pyx_optional_args->n;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prune); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_74prune)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1480, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1480, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1488
 *         :type n: int
 *         """
 *         self.data.prune(threshold, n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (void)(__pyx_v_self->data.prune(__pyx_v_threshold, __pyx_v_n));

  /* "colibricore_wrapper.pyx":1480
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_73prune[] = "Prune all patterns occurring below the threshold.\n    \n        :param threshold: the threshold value (minimum number of occurrences)\n        :type threshold: int\n        :param n: prune only patterns of the specified size, use 0 (default) for no size limitation\n        :type n: int\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_threshold;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prune (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(1, 1480, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1480, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1480, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prune", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1480, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_73prune(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_73prune(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.n = __pyx_v_n;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_IndexedPatternModel->prune(__pyx_v_self, __pyx_v_threshold, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1491
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_75reverseindex[] = "Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index.";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_75reverseindex(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex", 0);

  /* "colibricore_wrapper.pyx":1493
 *     def reverseindex(self):
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->corpus);
  __pyx_r = __pyx_v_self->corpus;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1491
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_79generator21(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1496
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_77getreverseindex[] = "Generator over all patterns occurring at the specified index reference\n    \n        :param indexreference: a (sentence, tokenoffset) tuple\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_77getreverseindex(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)__pyx_tp_new_11colibricore___pyx_scope_struct_21_getreverseindex(__pyx_ptype_11colibricore___pyx_scope_struct_21_getreverseindex, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1496, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_indexreference = __pyx_v_indexreference;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_indexreference);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_indexreference);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_79generator21, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex, __pyx_n_s_IndexedPatternModel_getreversein, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_79generator21(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1496, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1502
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_cur_scope->__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1502, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1503
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 1503, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1502
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  }

  /* "colibricore_wrapper.pyx":1504
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1505
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef int sentence = indexreference[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 1505, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1504
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1507
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":1508
 * 
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":1509
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 */
  __pyx_cur_scope->__pyx_v_ref = IndexReference(__pyx_cur_scope->__pyx_v_sentence, __pyx_cur_scope->__pyx_v_token);

  /* "colibricore_wrapper.pyx":1510
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex(__pyx_cur_scope->__pyx_v_ref);

  /* "colibricore_wrapper.pyx":1511
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while resit != results.end():
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":1513
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1514
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_resit).pattern();

    /* "colibricore_wrapper.pyx":1515
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":1516
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(resit)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":1517
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L10_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1517, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1518
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 *     def getreverseindex_bysentence(self, int sentence):
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1496
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_82generator22(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1520
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_80getreverseindex_bysentence[] = "Generator over all patterns occurring in the specified sentence\n    \n        :param sentence: a sentence number\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence) {
  int __pyx_v_sentence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence (wrapper)", 0);
  assert(__pyx_arg_sentence); {
    __pyx_v_sentence = __Pyx_PyInt_As_int(__pyx_arg_sentence); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1520, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_80getreverseindex_bysentence(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((int)__pyx_v_sentence));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_sentence) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)__pyx_tp_new_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence(__pyx_ptype_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1520, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sentence = __pyx_v_sentence;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_82generator22, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex_bysentence, __pyx_n_s_IndexedPatternModel_getreversein_2, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1520, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_82generator22(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1520, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1526
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1527
 * 
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1527, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1526
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1529
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)             # <<<<<<<<<<<<<<
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()
 *         cdef pair[cIndexReference,cPatternPointer] p
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex_bysentence(__pyx_cur_scope->__pyx_v_sentence);

  /* "colibricore_wrapper.pyx":1530
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":1533
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             p = deref(resit)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1534
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             p = deref(resit)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 */
    __pyx_cur_scope->__pyx_v_p = (*__pyx_cur_scope->__pyx_v_resit);

    /* "colibricore_wrapper.pyx":1535
 *         while resit != results.end():
 *             p = deref(resit)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1536
 *             p = deref(resit)
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 */
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_cur_scope->__pyx_v_p.second.pattern();

    /* "colibricore_wrapper.pyx":1537
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1538
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_p.first.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_p.first.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1538, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1539
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1520
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_85generator23(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1542
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_83histogram[] = "Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_cap,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cap);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histogram") < 0)) __PYX_ERR(1, 1542, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1542, __pyx_L3_error)
    } else {
      __pyx_v_threshold = ((unsigned int)0);
    }
    if (values[1]) {
      __pyx_v_cap = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_cap == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1542, __pyx_L3_error)
    } else {
      __pyx_v_cap = ((unsigned int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1542, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1542, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1542, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_83histogram(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_cap, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_83histogram(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("histogram", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)__pyx_tp_new_11colibricore___pyx_scope_struct_23_histogram(__pyx_ptype_11colibricore___pyx_scope_struct_23_histogram, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1542, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_cap = __pyx_v_cap;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_85generator23, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_histogram, __pyx_n_s_IndexedPatternModel_histogram, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1542, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_85generator23(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram", 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_ERR(1, 1542, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1546
 *         cdef stdmap[unsigned int,unsigned int] hist
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)             # <<<<<<<<<<<<<<
 *         it = hist.begin()
 *         while it != hist.end():
 */
  __pyx_cur_scope->__pyx_v_self->data.histogram(__pyx_cur_scope->__pyx_v_hist, __pyx_cur_scope->__pyx_v_threshold, __pyx_cur_scope->__pyx_v_cap, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);

  /* "colibricore_wrapper.pyx":1547
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()             # <<<<<<<<<<<<<<
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_hist.begin();

  /* "colibricore_wrapper.pyx":1548
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()
 *         while it != hist.end():             # <<<<<<<<<<<<<<
 *             yield deref(it).first, deref(it).second
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_hist.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1549
 *         it = hist.begin()
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).first); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1549, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1550
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1542
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1553
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_86top[] = "Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_amount;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("top (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_amount,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amount)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "top") < 0)) __PYX_ERR(1, 1553, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_amount = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1553, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1553, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1553, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("top", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1553, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_86top(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_86top(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size) {
  unsigned int __pyx_v_smallest;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("top", 0);

  /* "colibricore_wrapper.pyx":1556
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)             # <<<<<<<<<<<<<<
 *         return self.filter(smallest, category, size)
 * 
 */
  __pyx_v_smallest = __pyx_v_self->data.topthreshold(__pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* "colibricore_wrapper.pyx":1557
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)
 *         return self.filter(smallest, category, size)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_smallest); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_category); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1557, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1557, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1553
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_90generator24(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1561
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_88filter[] = "Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(1, 1561, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1561, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1561, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1561, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1561, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_88filter(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_88filter(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)__pyx_tp_new_11colibricore___pyx_scope_struct_24_filter(__pyx_ptype_11colibricore___pyx_scope_struct_24_filter, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1561, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_90generator24, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_filter, __pyx_n_s_IndexedPatternModel_filter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1561, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_90generator24(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1561, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1564
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1566
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1567
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1568
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             inc(it)             # <<<<<<<<<<<<<<
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));

    /* "colibricore_wrapper.pyx":1569
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_category > 0) != 0);
    if (!__pyx_t_3) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_cpattern.category() != __pyx_cur_scope->__pyx_v_category) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size > 0) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size != __pyx_cur_scope->__pyx_v_cpattern.n()) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":1570
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue             # <<<<<<<<<<<<<<
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 */
      goto __pyx_L4_continue;

      /* "colibricore_wrapper.pyx":1569
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    }

    /* "colibricore_wrapper.pyx":1571
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 *             count = self.data.occurrencecount(cpattern)             # <<<<<<<<<<<<<<
 *             if count >= threshold:
 *                 pattern = Pattern()
 */
    __pyx_cur_scope->__pyx_v_count = __pyx_cur_scope->__pyx_v_self->data.occurrencecount(__pyx_cur_scope->__pyx_v_cpattern);

    /* "colibricore_wrapper.pyx":1572
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_count >= __pyx_cur_scope->__pyx_v_threshold) != 0);
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":1573
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 *                 pattern = Pattern()             # <<<<<<<<<<<<<<
 *                 pattern.bind(cpattern)
 *                 yield pattern, count
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":1574
 *             if count >= threshold:
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *                 yield pattern, count
 * 
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":1575
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 *                 yield pattern, count             # <<<<<<<<<<<<<<
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):
 */
      __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L12_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1575, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":1572
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    }
    __pyx_L4_continue:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1561
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1577
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_91getinstance[] = "Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found.";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, 1); __PYX_ERR(1, 1577, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstance") < 0)) __PYX_ERR(1, 1577, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pos = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(1, 1577, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1577, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_91getinstance(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pos, __pyx_v_pattern);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstance", 0);

  /* "colibricore_wrapper.pyx":1579
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  __pyx_t_1 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1580
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 *         return self.corpus.getinstance(pos, pattern)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1580, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1579
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  }

  /* "colibricore_wrapper.pyx":1581
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getdata(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->corpus, __pyx_n_s_getinstance); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1581, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1581, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_pos);
    __Pyx_GIVEREF(__pyx_v_pos);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pos);
    __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1577
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1583
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_getdata(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  IndexedData __pyx_v_cvalue;
  struct __pyx_obj_11colibricore_IndexedData *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getdata); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_94getdata)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1586
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 1586, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (likely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":1587
 *         cdef cIndexedData cvalue
 *         if pattern in self:
 *             cvalue = self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 *             value = IndexedData()
 *             value.bind(cvalue)
 */
    __pyx_v_cvalue = (__pyx_v_self->data[__pyx_v_pattern->cpattern]);

    /* "colibricore_wrapper.pyx":1588
 *         if pattern in self:
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()             # <<<<<<<<<<<<<<
 *             value.bind(cvalue)
 *             return value
 */
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_IndexedData)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((struct __pyx_obj_11colibricore_IndexedData *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "colibricore_wrapper.pyx":1589
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 *             value.bind(cvalue)             # <<<<<<<<<<<<<<
 *             return value
 *         else:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedData *)__pyx_v_value->__pyx_vtab)->bind(__pyx_v_value, __pyx_v_cvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "colibricore_wrapper.pyx":1590
 *             value = IndexedData()
 *             value.bind(cvalue)
 *             return value             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_value));
    __pyx_r = ((PyObject *)__pyx_v_value);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":1586
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 */
  }

  /* "colibricore_wrapper.pyx":1592
 *             return value
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 1592, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":1583
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_93getdata[] = "Return the indices at which the pattern occurs";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getdata (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1583, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_93getdata(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_93getdata(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("getdata", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_getdata(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1595
 * 
 * 
 *     cpdef add(self, Pattern pattern, indices):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the indexed model
 *         :param pattern: The pattern to add
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_add(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices, int __pyx_skip_dispatch) {
  IndexedData *__pyx_v_cvalue;
  IndexReference __pyx_v_ref;
  PyObject *__pyx_v_sentence = NULL;
  PyObject *__pyx_v_token = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_96add)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_indices};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1595, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_indices};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1595, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(__pyx_v_indices);
          __Pyx_GIVEREF(__pyx_v_indices);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_indices);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1603
 * 
 *         cdef cIndexedData * cvalue
 *         cvalue = &(self.data[pattern.cpattern])             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref
 *         for sentence,token in indices:
 */
  __pyx_v_cvalue = (&(__pyx_v_self->data[__pyx_v_pattern->cpattern]));

  /* "colibricore_wrapper.pyx":1605
 *         cvalue = &(self.data[pattern.cpattern])
 *         cdef cIndexReference ref
 *         for sentence,token in indices:             # <<<<<<<<<<<<<<
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 */
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1605, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 1605, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 1605, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 1605, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 1605, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) __PYX_ERR(1, 1605, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(1, 1605, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_sentence, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "colibricore_wrapper.pyx":1606
 *         cdef cIndexReference ref
 *         for sentence,token in indices:
 *             ref.sentence = <int> sentence             # <<<<<<<<<<<<<<
 *             ref.token = <int> token
 *         self.data.add(pattern.cpattern, cvalue, ref)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_sentence); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1606, __pyx_L1_error)
    __pyx_v_ref.sentence = ((int)__pyx_t_5);

    /* "colibricore_wrapper.pyx":1607
 *         for sentence,token in indices:
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token             # <<<<<<<<<<<<<<
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_token); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1607, __pyx_L1_error)
    __pyx_v_ref.token = ((int)__pyx_t_5);

    /* "colibricore_wrapper.pyx":1605
 *         cvalue = &(self.data[pattern.cpattern])
 *         cdef cIndexReference ref
 *         for sentence,token in indices:             # <<<<<<<<<<<<<<
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":1608
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 *         self.data.add(pattern.cpattern, cvalue, ref)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->data.add(__pyx_v_pattern->cpattern, __pyx_v_cvalue, __pyx_v_ref);

  /* "colibricore_wrapper.pyx":1595
 * 
 * 
 *     cpdef add(self, Pattern pattern, indices):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the indexed model
 *         :param pattern: The pattern to add
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sentence);
  __Pyx_XDECREF(__pyx_v_token);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_95add[] = "Add a pattern to the indexed model\n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        :param indices: list (or other iterable) of 2-tuples specifying the (sentence,index) of each occurrence of the pattern\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  PyObject *__pyx_v_indices = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_indices,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(1, 1595, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 1595, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_indices = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1595, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1595, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_95add(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_indices);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_95add(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices) {
  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("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_add(__pyx_v_self, __pyx_v_pattern, __pyx_v_indices, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_99generator25(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1610
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_98__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_97__iter__[] = "Iterate over all patterns in this model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_19IndexedPatternModel_97__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_98__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_97__iter__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_97__iter__(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_25___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_25___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1610, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_99generator25, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_IndexedPatternModel___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_99generator25(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 1610, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1612
 *     def __iter__(self):
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1614
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1615
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1616
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1617
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":1618
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1618, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1619
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1610
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_102generator26(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1621
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_101items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_100items[] = "Iterate over all patterns and their index data (IndexedData instances) in this model";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_101items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_100items(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_100items(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_26_items(__pyx_ptype_11colibricore___pyx_scope_struct_26_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1621, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_102generator26, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_IndexedPatternModel_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_102generator26(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  IndexedData __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 1621, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1623
 *     def items(self):
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cIndexedData cvalue
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":1626
 *         cdef cPattern cpattern
 *         cdef cIndexedData cvalue
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1627
 *         cdef cIndexedData cvalue
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cvalue = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":1628
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cvalue = __pyx_t_3;

    /* "colibricore_wrapper.pyx":1629
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             value = IndexedData()
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1630
 *             cvalue = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             value = IndexedData()
 *             value.bind(cvalue)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1631
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             value = IndexedData()             # <<<<<<<<<<<<<<
 *             value.bind(cvalue)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_IndexedData)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, ((struct __pyx_obj_11colibricore_IndexedData *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1632
 *             pattern.bind(cpattern)
 *             value = IndexedData()
 *             value.bind(cvalue)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_IndexedData *)__pyx_cur_scope->__pyx_v_value->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_value, __pyx_cur_scope->__pyx_v_cvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":1633
 *             value = IndexedData()
 *             value.bind(cvalue)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1633, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1634
 *             value.bind(cvalue)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1621
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1640
 * 
 * 
 *     def covered(self, indexreference):             # <<<<<<<<<<<<<<
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_104covered(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_104covered(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("covered (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_103covered(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_103covered(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  unsigned int __pyx_v_sentence;
  unsigned int __pyx_v_token;
  IndexReference __pyx_v_ref;
  IndexReference __pyx_v_ref2;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  std::unordered_set<PatternPointer>  __pyx_v_results2;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  unsigned int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("covered", 0);

  /* "colibricore_wrapper.pyx":1641
 * 
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1641, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1642
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 1642, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1641
 * 
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 */
  }

  /* "colibricore_wrapper.pyx":1643
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1643, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":1644
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef cIndexReference ref2
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":1645
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref2
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_v_ref = IndexReference(__pyx_v_sentence, __pyx_v_token);

  /* "colibricore_wrapper.pyx":1647
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef cIndexReference ref2
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results2
 *         cdef unordered_set[cPatternPointer].iterator resit
 */
  __pyx_v_results = __pyx_v_self->data.getreverseindex(__pyx_v_ref);

  /* "colibricore_wrapper.pyx":1651
 *         cdef unordered_set[cPatternPointer].iterator resit
 *         cdef cPattern cpattern
 *         if not results.empty():             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = ((!(__pyx_v_results.empty() != 0)) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":1652
 *         cdef cPattern cpattern
 *         if not results.empty():
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(1, token+1):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":1651
 *         cdef unordered_set[cPatternPointer].iterator resit
 *         cdef cPattern cpattern
 *         if not results.empty():             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":1654
 *             return True
 *         else:
 *             for i in range(1, token+1):             # <<<<<<<<<<<<<<
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_token + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1654, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1654, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 1654, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1654, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 1654, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1654, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 1654, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "colibricore_wrapper.pyx":1655
 *         else:
 *             for i in range(1, token+1):
 *                 if token-i >= 0:             # <<<<<<<<<<<<<<
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 */
      __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_token); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1655, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1655, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1655, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1655, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "colibricore_wrapper.pyx":1656
 *             for i in range(1, token+1):
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)             # <<<<<<<<<<<<<<
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()
 */
        __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_token); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1656, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1656, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1656, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_v_ref2 = IndexReference(__pyx_v_sentence, __pyx_t_10);

        /* "colibricore_wrapper.pyx":1657
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)             # <<<<<<<<<<<<<<
 *                     resit = results2.begin()
 *                     while resit != results2.end():
 */
        __pyx_v_results2 = __pyx_v_self->data.getreverseindex(__pyx_v_ref2);

        /* "colibricore_wrapper.pyx":1658
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()             # <<<<<<<<<<<<<<
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 */
        __pyx_v_resit = __pyx_v_results2.begin();

        /* "colibricore_wrapper.pyx":1659
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()
 *                     while resit != results2.end():             # <<<<<<<<<<<<<<
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:
 */
        while (1) {
          __pyx_t_1 = ((__pyx_v_resit != __pyx_v_results2.end()) != 0);
          if (!__pyx_t_1) break;

          /* "colibricore_wrapper.pyx":1660
 *                     resit = results2.begin()
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *                         if cpattern.n() >= token+1:
 *                             return True
 */
          __pyx_v_cpattern = (*__pyx_v_resit).pattern();

          /* "colibricore_wrapper.pyx":1661
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:             # <<<<<<<<<<<<<<
 *                             return True
 *                         inc(resit)
 */
          __pyx_t_1 = ((__pyx_v_cpattern.n() >= (__pyx_v_token + 1)) != 0);
          if (__pyx_t_1) {

            /* "colibricore_wrapper.pyx":1662
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:
 *                             return True             # <<<<<<<<<<<<<<
 *                         inc(resit)
 *             return False
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(Py_True);
            __pyx_r = Py_True;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L0;

            /* "colibricore_wrapper.pyx":1661
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:             # <<<<<<<<<<<<<<
 *                             return True
 *                         inc(resit)
 */
          }

          /* "colibricore_wrapper.pyx":1663
 *                         if cpattern.n() >= token+1:
 *                             return True
 *                         inc(resit)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
          (void)((++__pyx_v_resit));
        }

        /* "colibricore_wrapper.pyx":1655
 *         else:
 *             for i in range(1, token+1):
 *                 if token-i >= 0:             # <<<<<<<<<<<<<<
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 */
      }

      /* "colibricore_wrapper.pyx":1654
 *             return True
 *         else:
 *             for i in range(1, token+1):             # <<<<<<<<<<<<<<
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 */
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "colibricore_wrapper.pyx":1664
 *                             return True
 *                         inc(resit)
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":1640
 * 
 * 
 *     def covered(self, indexreference):             # <<<<<<<<<<<<<<
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.covered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1672
 * 
 * 
 *     cpdef outputrelations(self, Pattern pattern, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Compute and output (to stdout) all relations for the specified pattern:
 * 
 */

static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_19IndexedPatternModel_outputrelations(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outputrelations", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_outputrelations); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_19IndexedPatternModel_106outputrelations)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_decoder)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1672, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_decoder)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1672, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1672, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_decoder));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_decoder));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_decoder));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1672, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":1680
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.outputrelations(pattern.cpattern,decoder.data,&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.outputrelations(__pyx_v_pattern->cpattern, __pyx_v_decoder->data, (&std::cout));

  /* "colibricore_wrapper.pyx":1672
 * 
 * 
 *     cpdef outputrelations(self, Pattern pattern, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Compute and output (to stdout) all relations for the specified pattern:
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_105outputrelations[] = "Compute and output (to stdout) all relations for the specified pattern:\n    \n        :param pattern: The pattern to output relations for\n        :type pattern: Pattern\n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outputrelations (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_decoder,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_decoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputrelations", 1, 2, 2, 1); __PYX_ERR(1, 1672, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outputrelations") < 0)) __PYX_ERR(1, 1672, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_decoder = ((struct __pyx_obj_11colibricore_ClassDecoder *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outputrelations", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1672, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1672, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 1672, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_105outputrelations(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_decoder);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_105outputrelations(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("outputrelations", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_19IndexedPatternModel_outputrelations(__pyx_v_self, __pyx_v_pattern, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_109generator27(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1683
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_108getsubchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_107getsubchildren[] = "Get subsumption children for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_108getsubchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubchildren (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getsubchildren") < 0)) __PYX_ERR(1, 1683, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1683, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1683, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1683, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getsubchildren", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1683, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1683, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_107getsubchildren(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_107getsubchildren(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getsubchildren", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)__pyx_tp_new_11colibricore___pyx_scope_struct_27_getsubchildren(__pyx_ptype_11colibricore___pyx_scope_struct_27_getsubchildren, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1683, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_109generator27, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getsubchildren, __pyx_n_s_IndexedPatternModel_getsubchildr, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1683, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_109generator27(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubchildren", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1683, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1694
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1695
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1695, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1695, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1694
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1697
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 * 
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getsubchildren(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1697, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1698
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 * 
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1702
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1703
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1704
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1705
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1706
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1707
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1707, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1708
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1683
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_112generator28(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1710
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_111getsubparents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_110getsubparents[] = "Get subsumption parents for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_111getsubparents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubparents (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getsubparents") < 0)) __PYX_ERR(1, 1710, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1710, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1710, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1710, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getsubparents", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1710, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1710, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_110getsubparents(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_110getsubparents(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getsubparents", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)__pyx_tp_new_11colibricore___pyx_scope_struct_28_getsubparents(__pyx_ptype_11colibricore___pyx_scope_struct_28_getsubparents, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1710, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_112generator28, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getsubparents, __pyx_n_s_IndexedPatternModel_getsubparent, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1710, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_112generator28(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubparents", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1710, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1721
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1722
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1722, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1721
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1724
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getsubparents(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1724, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1725
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1728
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1729
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1730
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1731
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1732
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1733
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1733, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1734
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1710
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_115generator29(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1736
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_114getleftneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_113getleftneighbours[] = "Get left neighbours for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_114getleftneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_v_cutoff;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftneighbours (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,&__pyx_n_s_cutoff,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getleftneighbours") < 0)) __PYX_ERR(1, 1736, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1736, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1736, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1736, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
    if (values[4]) {
      __pyx_v_cutoff = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1736, __pyx_L3_error)
    } else {
      __pyx_v_cutoff = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getleftneighbours", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1736, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1736, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_113getleftneighbours(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size, __pyx_v_cutoff);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_113getleftneighbours(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getleftneighbours", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)__pyx_tp_new_11colibricore___pyx_scope_struct_29_getleftneighbours(__pyx_ptype_11colibricore___pyx_scope_struct_29_getleftneighbours, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1736, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  __pyx_cur_scope->__pyx_v_cutoff = __pyx_v_cutoff;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_115generator29, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getleftneighbours, __pyx_n_s_IndexedPatternModel_getleftneigh, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1736, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_115generator29(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftneighbours", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1736, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1747
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1748
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1748, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1747
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1750
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getleftneighbours(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size, __pyx_cur_scope->__pyx_v_cutoff);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1750, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1751
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1754
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1755
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1756
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1757
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1758
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1759
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1759, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1760
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1736
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_118generator30(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1762
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_117getrightneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_116getrightneighbours[] = "Get right neighbours for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_117getrightneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_v_cutoff;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightneighbours (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,&__pyx_n_s_cutoff,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getrightneighbours") < 0)) __PYX_ERR(1, 1762, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1762, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1762, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1762, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
    if (values[4]) {
      __pyx_v_cutoff = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1762, __pyx_L3_error)
    } else {
      __pyx_v_cutoff = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getrightneighbours", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1762, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_116getrightneighbours(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size, __pyx_v_cutoff);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_116getrightneighbours(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getrightneighbours", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)__pyx_tp_new_11colibricore___pyx_scope_struct_30_getrightneighbours(__pyx_ptype_11colibricore___pyx_scope_struct_30_getrightneighbours, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1762, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  __pyx_cur_scope->__pyx_v_cutoff = __pyx_v_cutoff;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_118generator30, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getrightneighbours, __pyx_n_s_IndexedPatternModel_getrightneig, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1762, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_118generator30(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightneighbours", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1762, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1773
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1774
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1774, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1773
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1776
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getrightneighbours(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size, __pyx_cur_scope->__pyx_v_cutoff);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1776, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1777
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1780
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1781
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1782
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1783
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1784
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1785
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1785, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1786
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getskipcontent(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1762
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_121generator31(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1788
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_120getskipcontent(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_119getskipcontent[] = "Get skip content for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_120getskipcontent(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getskipcontent (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1788, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_119getskipcontent(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_119getskipcontent(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getskipcontent", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)__pyx_tp_new_11colibricore___pyx_scope_struct_31_getskipcontent(__pyx_ptype_11colibricore___pyx_scope_struct_31_getskipcontent, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1788, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_121generator31, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getskipcontent, __pyx_n_s_IndexedPatternModel_getskipconte, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1788, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getskipcontent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_121generator31(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getskipcontent", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1788, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1794
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1795
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1795, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1794
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1797
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getskipcontent(__pyx_cur_scope->__pyx_v_pattern->cpattern);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1797, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1798
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1801
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1802
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1803
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1804
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1805
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1806
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1806, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1807
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1788
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getskipcontent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_124generator32(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1809
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_123gettemplates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_122gettemplates[] = "Get templates (abstracting skipgrams) for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_123gettemplates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gettemplates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gettemplates") < 0)) __PYX_ERR(1, 1809, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1809, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gettemplates", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1809, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1809, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_122gettemplates(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_122gettemplates(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gettemplates", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)__pyx_tp_new_11colibricore___pyx_scope_struct_32_gettemplates(__pyx_ptype_11colibricore___pyx_scope_struct_32_gettemplates, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1809, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_124generator32, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_gettemplates, __pyx_n_s_IndexedPatternModel_gettemplates, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1809, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_124generator32(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gettemplates", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1809, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1817
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1818
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1818, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1817
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1820
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.gettemplates(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1820, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1821
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1824
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1825
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1826
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1827
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1828
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1829
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1829, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1830
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1809
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_127generator33(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1832
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_126getinstances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_125getinstances[] = "Get templates (abstracting skipgrams) for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_126getinstances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstances") < 0)) __PYX_ERR(1, 1832, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1832, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstances", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1832, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1832, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_125getinstances(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_125getinstances(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstances", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)__pyx_tp_new_11colibricore___pyx_scope_struct_33_getinstances(__pyx_ptype_11colibricore___pyx_scope_struct_33_getinstances, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1832, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_127generator33, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getinstances, __pyx_n_s_IndexedPatternModel_getinstances, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1832, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_127generator33(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstances", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1832, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1840
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1841
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1841, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1840
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1843
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getinstances(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1843, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1844
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1847
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1848
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1849
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1850
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1851
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1852
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1852, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1853
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1832
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_130generator34(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1855
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_129getcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_128getcooc[] = "Get left-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_129getcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getcooc") < 0)) __PYX_ERR(1, 1855, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1855, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1855, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1855, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1855, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1855, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_128getcooc(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_128getcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_34_getcooc(__pyx_ptype_11colibricore___pyx_scope_struct_34_getcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1855, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_130generator34, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getcooc, __pyx_n_s_IndexedPatternModel_getcooc, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_130generator34(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1855, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1866
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1867
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1867, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1866
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1869
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1869, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1870
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1873
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1874
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1875
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1876
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1877
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1878
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1878, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1879
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1855
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_133generator35(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1881
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_132getleftcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_131getleftcooc[] = "Get left-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_132getleftcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getleftcooc") < 0)) __PYX_ERR(1, 1881, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1881, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1881, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1881, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getleftcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1881, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1881, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_131getleftcooc(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_131getleftcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getleftcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_35_getleftcooc(__pyx_ptype_11colibricore___pyx_scope_struct_35_getleftcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1881, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_133generator35, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getleftcooc, __pyx_n_s_IndexedPatternModel_getleftcooc, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1881, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_133generator35(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1881, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1892
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1893
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1893, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1892
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1895
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getleftcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1895, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1896
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1899
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1900
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1901
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1902
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1903
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1904
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1904, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1905
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1881
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_136generator36(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":1907
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_135getrightcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_134getrightcooc[] = "Get right-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_135getrightcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getrightcooc") < 0)) __PYX_ERR(1, 1907, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1907, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1907, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1907, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getrightcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1907, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1907, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_134getrightcooc(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_134getrightcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getrightcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_36_getrightcooc(__pyx_ptype_11colibricore___pyx_scope_struct_36_getrightcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 1907, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_19IndexedPatternModel_136generator36, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getrightcooc, __pyx_n_s_IndexedPatternModel_getrightcooc, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 1907, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_19IndexedPatternModel_136generator36(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1907, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":1918
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":1919
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1919, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1918
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":1921
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getrightcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 1921, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":1922
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":1925
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":1926
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":1927
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":1928
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1929
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":1930
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 1930, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1931
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def computeflexgrams_fromskipgrams(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":1907
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1933
 *             inc(relit)
 * 
 *     def computeflexgrams_fromskipgrams(self):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_138computeflexgrams_fromskipgrams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_137computeflexgrams_fromskipgrams[] = "Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found.";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_138computeflexgrams_fromskipgrams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeflexgrams_fromskipgrams (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_137computeflexgrams_fromskipgrams(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_137computeflexgrams_fromskipgrams(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("computeflexgrams_fromskipgrams", 0);

  /* "colibricore_wrapper.pyx":1935
 *     def computeflexgrams_fromskipgrams(self):
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()             # <<<<<<<<<<<<<<
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.computeflexgrams_fromskipgrams()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1933
 *             inc(relit)
 * 
 *     def computeflexgrams_fromskipgrams(self):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.computeflexgrams_fromskipgrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1937
 *         return self.data.computeflexgrams_fromskipgrams()
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_140computeflexgrams_fromcooc(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold); /*proto*/
static char __pyx_doc_11colibricore_19IndexedPatternModel_139computeflexgrams_fromcooc[] = "Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method.";
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_140computeflexgrams_fromcooc(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold) {
  double __pyx_v_threshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeflexgrams_fromcooc (wrapper)", 0);
  assert(__pyx_arg_threshold); {
    __pyx_v_threshold = __pyx_PyFloat_AsDouble(__pyx_arg_threshold); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 1937, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.computeflexgrams_fromcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_139computeflexgrams_fromcooc(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((double)__pyx_v_threshold));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_139computeflexgrams_fromcooc(struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, double __pyx_v_threshold) {
  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("computeflexgrams_fromcooc", 0);

  /* "colibricore_wrapper.pyx":1939
 *     def computeflexgrams_fromcooc(self,double threshold):
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)             # <<<<<<<<<<<<<<
 * 
 * cdef class HashOrderedIndexedPatternModel:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.computeflexgrams_fromcooc(__pyx_v_threshold)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1937
 *         return self.data.computeflexgrams_fromskipgrams()
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.computeflexgrams_fromcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_142__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_142__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_141__reduce_cython__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_141__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_144__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_19IndexedPatternModel_144__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19IndexedPatternModel_143__setstate_cython__(((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19IndexedPatternModel_143__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedPatternModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1949
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel___len__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel___len__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":1951
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1949
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1953
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_2__bool__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":1954
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1953
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1956
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_4types(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_4types(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":1958
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1956
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1960
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_6tokens(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_6tokens(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":1962
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1960
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1964
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_8minlength(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_8minlength(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":1966
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1964
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1968
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_10maxlength(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":1970
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1968
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1972
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_12type(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_12type(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":1974
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.type()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1972
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1976
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_14version(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_14version(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":1978
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.version()             # <<<<<<<<<<<<<<
 * 
 *     def occurrencecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1976
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1980
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_16occurrencecount[] = "Returns the number of times the specified pattern occurs in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("occurrencecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1980, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_16occurrencecount(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("occurrencecount", 0);

  /* "colibricore_wrapper.pyx":1987
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1988
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1988, __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_ERR(1, 1988, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1987
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":1989
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coveragecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.occurrencecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1980
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.occurrencecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":1991
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_18coveragecount[] = "Returns the number of tokens all instances of the specified pattern cover in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coveragecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 1991, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_18coveragecount(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coveragecount", 0);

  /* "colibricore_wrapper.pyx":1998
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":1999
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1999, __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_ERR(1, 1999, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":1998
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2000
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coverage(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.coveragecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":1991
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.coveragecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2002
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_20coverage[] = "Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coverage (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2002, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_20coverage(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_20coverage(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coverage", 0);

  /* "colibricore_wrapper.pyx":2009
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2010
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coverage(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2010, __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_ERR(1, 2010, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2009
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2011
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def frequency(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.coverage(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2002
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2013
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_22frequency[] = "Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frequency (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2013, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_22frequency(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_22frequency(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frequency", 0);

  /* "colibricore_wrapper.pyx":2020
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2021
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.frequency(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2021, __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_ERR(1, 2021, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2020
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2022
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.frequency(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2013
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2025
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_24totaloccurrencesingroup[] = "Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaloccurrencesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaloccurrencesingroup") < 0)) __PYX_ERR(1, 2025, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2025, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2025, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaloccurrencesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_24totaloccurrencesingroup(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaloccurrencesingroup", 0);

  /* "colibricore_wrapper.pyx":2034
 *         :rtype: int
 *         """
 *         return self.data.totaloccurrencesingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaloccurrencesingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2025
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2036
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_26totalpatternsingroup[] = "Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalpatternsingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalpatternsingroup") < 0)) __PYX_ERR(1, 2036, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2036, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2036, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalpatternsingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2036, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_26totalpatternsingroup(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalpatternsingroup", 0);

  /* "colibricore_wrapper.pyx":2045
 *         :rtype: int
 *         """
 *         return self.data.totalpatternsingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totalpatternsingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2036
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2047
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_28totaltokensingroup[] = "Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaltokensingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaltokensingroup") < 0)) __PYX_ERR(1, 2047, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2047, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2047, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaltokensingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2047, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_28totaltokensingroup(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaltokensingroup", 0);

  /* "colibricore_wrapper.pyx":2056
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2047
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2058
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_30totalwordtypesingroup[] = "Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalwordtypesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalwordtypesingroup") < 0)) __PYX_ERR(1, 2058, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2058, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2058, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalwordtypesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2058, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_30totalwordtypesingroup(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalwordtypesingroup", 0);

  /* "colibricore_wrapper.pyx":2067
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2058
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2070
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_has(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":2071
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2072
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2072, __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_ERR(1, 2072, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2071
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2073
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2070
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2075
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_32__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n    \n        Example::\n    \n            pattern in patternmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_32__contains__;
#endif
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_32__contains__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":2086
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2087
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2087, __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_ERR(1, 2087, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2086
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":2088
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 2088, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2075
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2090
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":2101
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2102
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2102, __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_ERR(1, 2102, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2101
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":2103
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 2103, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2090
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__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_11colibricore_30HashOrderedIndexedPatternModel_38generator37(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2107
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_37__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_36__iter__[] = "Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.\n    \n        Example::\n    \n            for pattern in model:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_36__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_37__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_36__iter__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_37___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_37___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2107, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_38generator37, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_HashOrderedIndexedPatternModel, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2107, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_38generator37(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 2107, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2116
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":2118
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2119
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":2120
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2121
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2122
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2122, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2123
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2107
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2125
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_39__init__[] = "Initialise a pattern model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A model to be used as a constraint, only patterns occuring in this constraint model will be loaded/trained\n        :type constrainmodel: IndexedPatternModel, UnindexedPatternModel or None (default)\n        :param reverseindex: Corpus data to use as reverse index. On indexed models, this is required for various operations, including computation of skipgrams\n        :type reverseindex: IndexedCorpus or None\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_39__init__;
#endif
static int __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  PyObject *__pyx_v_reverseindex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,&__pyx_n_s_reverseindex,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reverseindex);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 2125, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
    __pyx_v_reverseindex = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2125, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2125, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2125, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_39__init__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, __pyx_v_reverseindex);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_39__init__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":2138
 *         """
 * 
 *         self.corpus = None             # <<<<<<<<<<<<<<
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = Py_None;

  /* "colibricore_wrapper.pyx":2139
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reverseindex); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2139, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":2140
 *         self.corpus = None
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadreverseindex); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_reverseindex) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_reverseindex);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2140, __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;

    /* "colibricore_wrapper.pyx":2139
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2142
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":2143
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2143, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_1) != 0);
    if (__pyx_t_5) {

      /* "colibricore_wrapper.pyx":2144
 *         if filename:
 *             if not options:
 *                 options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 */
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "colibricore_wrapper.pyx":2143
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    }

    /* "colibricore_wrapper.pyx":2145
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_5 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2145, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = ((!__pyx_t_1) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (unlikely(__pyx_t_5)) {

      /* "colibricore_wrapper.pyx":2146
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *             self.load(filename,options, constrainmodel)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2146, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":2145
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    }

    /* "colibricore_wrapper.pyx":2147
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2147, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2147, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_options));
      __Pyx_INCREF(__pyx_v_constrainmodel);
      __Pyx_GIVEREF(__pyx_v_constrainmodel);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_constrainmodel);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2142
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  }

  /* "colibricore_wrapper.pyx":2125
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2149
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_41load[] = "Load a patternmodel from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 2149, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2149, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2149, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2149, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_41load(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_41load(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":2157
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2157, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":2158
 *         """
 *         if not options:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 * 
 *         if filename and not os.path.exists(filename):
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2157
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2160
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2161
 * 
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 2161, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2160
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2163
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":2164
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 2164, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2163
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":2165
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_2 = (__pyx_t_6 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":2166
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 2166, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2165
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":2167
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":2168
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 2168, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2167
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":2170
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    try {
      __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, NULL);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
      __PYX_ERR(1, 2170, __pyx_L1_error)
    }
  }
  __pyx_L7:;

  /* "colibricore_wrapper.pyx":2149
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2172
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadreverseindex (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseindex), __pyx_ptype_11colibricore_IndexedCorpus, 1, "reverseindex", 0))) __PYX_ERR(1, 2172, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_43loadreverseindex(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_reverseindex));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  IndexedCorpus *__pyx_t_1;
  __Pyx_RefNannySetupContext("loadreverseindex", 0);

  /* "colibricore_wrapper.pyx":2173
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data             # <<<<<<<<<<<<<<
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 * 
 */
  __pyx_t_1 = __pyx_v_reverseindex->data;
  __pyx_v_self->data.reverseindex = __pyx_t_1;

  /* "colibricore_wrapper.pyx":2174
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = ((PyObject *)__pyx_v_reverseindex);

  /* "colibricore_wrapper.pyx":2172
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2177
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_46loadconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2177, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2177, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2177, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2177, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2178
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2178, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2177
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 2177, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 2177, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 2177, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2177, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2177, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2177, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2177, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_45loadconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2180
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_48loadconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2181
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2181, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2180
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 2180, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 2180, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 2180, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2180, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2180, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2180, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2180, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_47loadconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2183
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbysetmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_50loadconstrainedbysetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2183, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2183, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2184
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2184, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2184, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2183
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 1); __PYX_ERR(1, 2183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 2); __PYX_ERR(1, 2183, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbysetmodel") < 0)) __PYX_ERR(1, 2183, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2183, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2183, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2183, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_49loadconstrainedbysetmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbysetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2186
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_51read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 2186, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2186, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2186, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2186, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_51read(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_51read(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":2188
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2188, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2188, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":2186
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2190
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_write(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_54write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2196
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2196, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2190
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_53write[] = "Write a patternmodel to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2190, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_53write(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_53write(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2198
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_56printmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_decoder)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_decoder));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2198, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2204
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.printmodel(&cout, decoder.data )             # <<<<<<<<<<<<<<
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):
 */
  __pyx_v_self->data.printmodel((&std::cout), __pyx_v_decoder->data);

  /* "colibricore_wrapper.pyx":2198
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_55printmodel[] = "Print the entire pattern model to stdout, a detailed overview\n    \n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printmodel (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 2198, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_55printmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_decoder));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("printmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printmodel(__pyx_v_self, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2206
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train *__pyx_optional_args) {
  PyObject *__pyx_v_constrainmodel = ((PyObject *)Py_None);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  std::string __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_constrainmodel = __pyx_optional_args->constrainmodel;
    }
  }
  __Pyx_INCREF(__pyx_v_filename);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_58train)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2206, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2206, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2206, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(__pyx_v_constrainmodel);
          __Pyx_GIVEREF(__pyx_v_constrainmodel);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_constrainmodel);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2206, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2217
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex != NULL) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2218
 * 
 *         if self.data.reverseindex != NULL:
 *             filename = ""             # <<<<<<<<<<<<<<
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 */
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_u_);

    /* "colibricore_wrapper.pyx":2217
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  }

  /* "colibricore_wrapper.pyx":2219
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_9 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_options), __pyx_n_s_DOSKIPGRAMS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 2219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_t_9;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2220
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2220, __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_ERR(1, 2220, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2219
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2223
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_constrainmodel); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 2223, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2224
 * 
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0             # <<<<<<<<<<<<<<
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = PyObject_Length(__pyx_v_constrainmodel); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(1, 2224, __pyx_L1_error)
      if (unlikely(!((__pyx_t_10 >= 0) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(1, 2224, __pyx_L1_error)
      }
    }
    #endif

    /* "colibricore_wrapper.pyx":2225
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":2226
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 2226, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":2225
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":2227
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (__pyx_t_7) {

      /* "colibricore_wrapper.pyx":2228
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 2228, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":2227
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":2229
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":2230
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 2230, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":2229
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":2231
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (likely(__pyx_t_7)) {

      /* "colibricore_wrapper.pyx":2232
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float))))) __PYX_ERR(1, 2232, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":2231
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":2234
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage             # <<<<<<<<<<<<<<
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2234, __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_ERR(1, 2234, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "colibricore_wrapper.pyx":2223
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":2235
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2236
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_11), __pyx_v_options->coptions, NULL, NULL);

    /* "colibricore_wrapper.pyx":2235
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":2237
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2238
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2238, __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_ERR(1, 2238, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2237
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2240
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, NULL);
  }
  __pyx_L8:;

  /* "colibricore_wrapper.pyx":2206
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_57train[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A patternmodel or patternsetmodel to constrain training (default None)\n        :type constrainmodel: None, UnindexedPatternModel, IndexedPatternModel, PatternSetModel\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, 1); __PYX_ERR(1, 2206, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) __PYX_ERR(1, 2206, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2206, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2206, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2206, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_57train(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_57train(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.constrainmodel = __pyx_v_constrainmodel;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel->train(__pyx_v_self, __pyx_v_filename, __pyx_v_options, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2242
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch) {
  PatternSet<unsigned int>  *__pyx_v_cfilterset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train_filtered", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train_filtered); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_60train_filtered)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2242, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2242, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2242, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_filterset));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_filterset));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_filterset));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2242, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2251
 *         :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).
 *         """
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
  __pyx_v_cfilterset = (&__pyx_v_filterset->data);

  /* "colibricore_wrapper.pyx":2253
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2254
 * 
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2254, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);

    /* "colibricore_wrapper.pyx":2253
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":2255
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2256
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2256, __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_ERR(1, 2256, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2255
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2258
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":2242
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_59train_filtered[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train_filtered (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_filterset,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 1); __PYX_ERR(1, 2242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 2); __PYX_ERR(1, 2242, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_filtered") < 0)) __PYX_ERR(1, 2242, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_filterset = ((struct __pyx_obj_11colibricore_PatternSet *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2242, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2242, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filterset), __pyx_ptype_11colibricore_PatternSet, 1, "filterset", 0))) __PYX_ERR(1, 2242, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_59train_filtered(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_filterset);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset) {
  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("train_filtered", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train_filtered(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_filterset, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2261
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getinterface(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":2262
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2261
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2264
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_62trainconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2264, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2264, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2264, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2264, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2265
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2266
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2266, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":2265
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":2267
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2268
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2268, __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_ERR(1, 2268, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2267
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2270
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":2264
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 2264, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 2264, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 2264, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2264, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2264, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2264, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2264, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_61trainconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2272
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_64trainconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2272, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2272, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2272, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2272, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2273
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2274
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2274, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":2273
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":2275
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2276
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2276, __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_ERR(1, 2276, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2275
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2278
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":2272
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 2272, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 2272, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 2272, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2272, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2272, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2272, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2272, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_63trainconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2280
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbypatternsetmode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_66trainconstrainedbypatternsetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2280, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2280, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2280, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2280, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2281
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2282
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":2281
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":2283
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2284
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2284, __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_ERR(1, 2284, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2283
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2286
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":2280
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 1); __PYX_ERR(1, 2280, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 2); __PYX_ERR(1, 2280, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbypatternsetmodel") < 0)) __PYX_ERR(1, 2280, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2280, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2280, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2280, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 2280, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_65trainconstrainedbypatternsetmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbypatternsetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2288
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyalignmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_68trainconstrainedbyalignmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2288, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2288, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2288, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2288, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2289
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":2290
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2290, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":2289
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":2291
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":2292
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2292, __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_ERR(1, 2292, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2291
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2294
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef report(self):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":2288
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 1); __PYX_ERR(1, 2288, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 2); __PYX_ERR(1, 2288, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyalignmodel") < 0)) __PYX_ERR(1, 2288, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2288, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2288, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternAlignmentModel_float, 1, "constrainmodel", 0))) __PYX_ERR(1, 2288, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_67trainconstrainedbyalignmodel(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel) {
  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("trainconstrainedbyalignmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2296
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_report(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_report); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_70report)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2296, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2298
 *     cpdef report(self):
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)             # <<<<<<<<<<<<<<
 * 
 *     cpdef printhistogram(self):
 */
  __pyx_v_self->data.report((&std::cout));

  /* "colibricore_wrapper.pyx":2296
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_69report[] = "Print a detailed statistical report to stdout";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("report (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_69report(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_69report(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_report(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2300
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printhistogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_72printhistogram)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2302
 *     cpdef printhistogram(self):
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.histogram((&std::cout));

  /* "colibricore_wrapper.pyx":2300
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_71printhistogram[] = "Print a histogram to stdout";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printhistogram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_71printhistogram(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printhistogram(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2306
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_prune(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune *__pyx_optional_args) {
  int __pyx_v_n = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_n = __pyx_optional_args->n;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prune); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_74prune)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2306, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2306, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2306, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2306, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2306, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2306, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2314
 *         :type n: int
 *         """
 *         self.data.prune(threshold, n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (void)(__pyx_v_self->data.prune(__pyx_v_threshold, __pyx_v_n));

  /* "colibricore_wrapper.pyx":2306
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_73prune[] = "Prune all patterns occurring below the threshold.\n    \n        :param threshold: the threshold value (minimum number of occurrences)\n        :type threshold: int\n        :param n: prune only patterns of the specified size, use 0 (default) for no size limitation\n        :type n: int\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_threshold;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prune (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(1, 2306, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2306, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2306, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prune", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_73prune(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_73prune(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.n = __pyx_v_n;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel->prune(__pyx_v_self, __pyx_v_threshold, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2317
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_75reverseindex[] = "Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index.";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_75reverseindex(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex", 0);

  /* "colibricore_wrapper.pyx":2319
 *     def reverseindex(self):
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->corpus);
  __pyx_r = __pyx_v_self->corpus;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2317
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_79generator38(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2322
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_77getreverseindex[] = "Generator over all patterns occurring at the specified index reference\n    \n        :param indexreference: a (sentence, tokenoffset) tuple\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_77getreverseindex(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)__pyx_tp_new_11colibricore___pyx_scope_struct_38_getreverseindex(__pyx_ptype_11colibricore___pyx_scope_struct_38_getreverseindex, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2322, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_indexreference = __pyx_v_indexreference;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_indexreference);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_indexreference);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_79generator38, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex, __pyx_n_s_HashOrderedIndexedPatternModel_g, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2322, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_79generator38(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2322, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2328
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_cur_scope->__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 2328, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2329
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 2329, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2328
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  }

  /* "colibricore_wrapper.pyx":2330
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2331
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef int sentence = indexreference[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 2331, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2330
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2333
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":2334
 * 
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":2335
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 */
  __pyx_cur_scope->__pyx_v_ref = IndexReference(__pyx_cur_scope->__pyx_v_sentence, __pyx_cur_scope->__pyx_v_token);

  /* "colibricore_wrapper.pyx":2336
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex(__pyx_cur_scope->__pyx_v_ref);

  /* "colibricore_wrapper.pyx":2337
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while resit != results.end():
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":2339
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2340
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_resit).pattern();

    /* "colibricore_wrapper.pyx":2341
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":2342
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(resit)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":2343
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L10_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2343, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2344
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 *     def getreverseindex_bysentence(self, int sentence):
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2322
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_82generator39(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2346
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_80getreverseindex_bysentence[] = "Generator over all patterns occurring in the specified sentence\n    \n        :param sentence: a sentence number\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence) {
  int __pyx_v_sentence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence (wrapper)", 0);
  assert(__pyx_arg_sentence); {
    __pyx_v_sentence = __Pyx_PyInt_As_int(__pyx_arg_sentence); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2346, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_80getreverseindex_bysentence(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((int)__pyx_v_sentence));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_sentence) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)__pyx_tp_new_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence(__pyx_ptype_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2346, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sentence = __pyx_v_sentence;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_82generator39, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex_bysentence, __pyx_n_s_HashOrderedIndexedPatternModel_g_2, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_82generator39(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2346, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2352
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2353
 * 
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2353, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2352
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2355
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)             # <<<<<<<<<<<<<<
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()
 *         cdef pair[cIndexReference,cPatternPointer] p
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex_bysentence(__pyx_cur_scope->__pyx_v_sentence);

  /* "colibricore_wrapper.pyx":2356
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":2359
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             p = deref(resit)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2360
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             p = deref(resit)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 */
    __pyx_cur_scope->__pyx_v_p = (*__pyx_cur_scope->__pyx_v_resit);

    /* "colibricore_wrapper.pyx":2361
 *         while resit != results.end():
 *             p = deref(resit)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2362
 *             p = deref(resit)
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 */
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_cur_scope->__pyx_v_p.second.pattern();

    /* "colibricore_wrapper.pyx":2363
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2364
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_p.first.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_p.first.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2364, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2365
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2346
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_85generator40(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2368
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_83histogram[] = "Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_cap,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cap);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histogram") < 0)) __PYX_ERR(1, 2368, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2368, __pyx_L3_error)
    } else {
      __pyx_v_threshold = ((unsigned int)0);
    }
    if (values[1]) {
      __pyx_v_cap = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_cap == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2368, __pyx_L3_error)
    } else {
      __pyx_v_cap = ((unsigned int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2368, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2368, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2368, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_83histogram(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_cap, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_83histogram(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("histogram", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)__pyx_tp_new_11colibricore___pyx_scope_struct_40_histogram(__pyx_ptype_11colibricore___pyx_scope_struct_40_histogram, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2368, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_cap = __pyx_v_cap;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_85generator40, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_histogram, __pyx_n_s_HashOrderedIndexedPatternModel_h, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2368, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_85generator40(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram", 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_ERR(1, 2368, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2372
 *         cdef stdmap[unsigned int,unsigned int] hist
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)             # <<<<<<<<<<<<<<
 *         it = hist.begin()
 *         while it != hist.end():
 */
  __pyx_cur_scope->__pyx_v_self->data.histogram(__pyx_cur_scope->__pyx_v_hist, __pyx_cur_scope->__pyx_v_threshold, __pyx_cur_scope->__pyx_v_cap, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);

  /* "colibricore_wrapper.pyx":2373
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()             # <<<<<<<<<<<<<<
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_hist.begin();

  /* "colibricore_wrapper.pyx":2374
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()
 *         while it != hist.end():             # <<<<<<<<<<<<<<
 *             yield deref(it).first, deref(it).second
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_hist.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2375
 *         it = hist.begin()
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).first); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2375, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2376
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2368
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2379
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_86top[] = "Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_amount;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("top (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_amount,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amount)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "top") < 0)) __PYX_ERR(1, 2379, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_amount = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2379, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2379, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2379, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("top", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_86top(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_86top(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size) {
  unsigned int __pyx_v_smallest;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("top", 0);

  /* "colibricore_wrapper.pyx":2382
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)             # <<<<<<<<<<<<<<
 *         return self.filter(smallest, category, size)
 * 
 */
  __pyx_v_smallest = __pyx_v_self->data.topthreshold(__pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* "colibricore_wrapper.pyx":2383
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)
 *         return self.filter(smallest, category, size)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_smallest); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_category); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2383, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2383, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2379
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_90generator41(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2387
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_88filter[] = "Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(1, 2387, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2387, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2387, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2387, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_88filter(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_88filter(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)__pyx_tp_new_11colibricore___pyx_scope_struct_41_filter(__pyx_ptype_11colibricore___pyx_scope_struct_41_filter, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2387, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_90generator41, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_filter, __pyx_n_s_HashOrderedIndexedPatternModel_f, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_90generator41(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2387, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2390
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":2392
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2393
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":2394
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             inc(it)             # <<<<<<<<<<<<<<
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));

    /* "colibricore_wrapper.pyx":2395
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_category > 0) != 0);
    if (!__pyx_t_3) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_cpattern.category() != __pyx_cur_scope->__pyx_v_category) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size > 0) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size != __pyx_cur_scope->__pyx_v_cpattern.n()) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":2396
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue             # <<<<<<<<<<<<<<
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 */
      goto __pyx_L4_continue;

      /* "colibricore_wrapper.pyx":2395
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    }

    /* "colibricore_wrapper.pyx":2397
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 *             count = self.data.occurrencecount(cpattern)             # <<<<<<<<<<<<<<
 *             if count >= threshold:
 *                 pattern = Pattern()
 */
    __pyx_cur_scope->__pyx_v_count = __pyx_cur_scope->__pyx_v_self->data.occurrencecount(__pyx_cur_scope->__pyx_v_cpattern);

    /* "colibricore_wrapper.pyx":2398
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_count >= __pyx_cur_scope->__pyx_v_threshold) != 0);
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":2399
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 *                 pattern = Pattern()             # <<<<<<<<<<<<<<
 *                 pattern.bind(cpattern)
 *                 yield pattern, count
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":2400
 *             if count >= threshold:
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *                 yield pattern, count
 * 
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":2401
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 *                 yield pattern, count             # <<<<<<<<<<<<<<
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):
 */
      __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2401, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2401, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L12_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2401, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":2398
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    }
    __pyx_L4_continue:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2387
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2403
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_91getinstance[] = "Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found.";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, 1); __PYX_ERR(1, 2403, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstance") < 0)) __PYX_ERR(1, 2403, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pos = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2403, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(1, 2403, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2403, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_91getinstance(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pos, __pyx_v_pattern);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstance", 0);

  /* "colibricore_wrapper.pyx":2405
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  __pyx_t_1 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2406
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 *         return self.corpus.getinstance(pos, pattern)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2406, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2405
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  }

  /* "colibricore_wrapper.pyx":2407
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getdata(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->corpus, __pyx_n_s_getinstance); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2407, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2407, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_pos);
    __Pyx_GIVEREF(__pyx_v_pos);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pos);
    __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2403
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2409
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getdata(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  IndexedData __pyx_v_cvalue;
  struct __pyx_obj_11colibricore_IndexedData *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getdata); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_94getdata)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2412
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 2412, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (likely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":2413
 *         cdef cIndexedData cvalue
 *         if pattern in self:
 *             cvalue = self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 *             value = IndexedData()
 *             value.bind(cvalue)
 */
    __pyx_v_cvalue = (__pyx_v_self->data[__pyx_v_pattern->cpattern]);

    /* "colibricore_wrapper.pyx":2414
 *         if pattern in self:
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()             # <<<<<<<<<<<<<<
 *             value.bind(cvalue)
 *             return value
 */
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_IndexedData)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((struct __pyx_obj_11colibricore_IndexedData *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "colibricore_wrapper.pyx":2415
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 *             value.bind(cvalue)             # <<<<<<<<<<<<<<
 *             return value
 *         else:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedData *)__pyx_v_value->__pyx_vtab)->bind(__pyx_v_value, __pyx_v_cvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "colibricore_wrapper.pyx":2416
 *             value = IndexedData()
 *             value.bind(cvalue)
 *             return value             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_value));
    __pyx_r = ((PyObject *)__pyx_v_value);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":2412
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvalue = self.data[pattern.cpattern]
 *             value = IndexedData()
 */
  }

  /* "colibricore_wrapper.pyx":2418
 *             return value
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 2418, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2409
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Return the indices at which the pattern occurs"""
 *         cdef cIndexedData cvalue
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_93getdata[] = "Return the indices at which the pattern occurs";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getdata (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2409, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_93getdata(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_93getdata(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("getdata", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getdata(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2421
 * 
 * 
 *     cpdef add(self, Pattern pattern, indices):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the indexed model
 *         :param pattern: The pattern to add
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_add(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices, int __pyx_skip_dispatch) {
  IndexedData *__pyx_v_cvalue;
  IndexReference __pyx_v_ref;
  PyObject *__pyx_v_sentence = NULL;
  PyObject *__pyx_v_token = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_96add)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_indices};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2421, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_indices};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2421, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2421, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(__pyx_v_indices);
          __Pyx_GIVEREF(__pyx_v_indices);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_indices);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2421, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2429
 * 
 *         cdef cIndexedData * cvalue
 *         cvalue = &(self.data[pattern.cpattern])             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref
 *         for sentence,token in indices:
 */
  __pyx_v_cvalue = (&(__pyx_v_self->data[__pyx_v_pattern->cpattern]));

  /* "colibricore_wrapper.pyx":2431
 *         cvalue = &(self.data[pattern.cpattern])
 *         cdef cIndexReference ref
 *         for sentence,token in indices:             # <<<<<<<<<<<<<<
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 */
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2431, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 2431, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2431, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 2431, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2431, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 2431, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 2431, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) __PYX_ERR(1, 2431, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(1, 2431, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_sentence, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "colibricore_wrapper.pyx":2432
 *         cdef cIndexReference ref
 *         for sentence,token in indices:
 *             ref.sentence = <int> sentence             # <<<<<<<<<<<<<<
 *             ref.token = <int> token
 *         self.data.add(pattern.cpattern, cvalue, ref)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_sentence); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2432, __pyx_L1_error)
    __pyx_v_ref.sentence = ((int)__pyx_t_5);

    /* "colibricore_wrapper.pyx":2433
 *         for sentence,token in indices:
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token             # <<<<<<<<<<<<<<
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_token); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2433, __pyx_L1_error)
    __pyx_v_ref.token = ((int)__pyx_t_5);

    /* "colibricore_wrapper.pyx":2431
 *         cvalue = &(self.data[pattern.cpattern])
 *         cdef cIndexReference ref
 *         for sentence,token in indices:             # <<<<<<<<<<<<<<
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":2434
 *             ref.sentence = <int> sentence
 *             ref.token = <int> token
 *         self.data.add(pattern.cpattern, cvalue, ref)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->data.add(__pyx_v_pattern->cpattern, __pyx_v_cvalue, __pyx_v_ref);

  /* "colibricore_wrapper.pyx":2421
 * 
 * 
 *     cpdef add(self, Pattern pattern, indices):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the indexed model
 *         :param pattern: The pattern to add
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sentence);
  __Pyx_XDECREF(__pyx_v_token);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_95add[] = "Add a pattern to the indexed model\n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        :param indices: list (or other iterable) of 2-tuples specifying the (sentence,index) of each occurrence of the pattern\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_96add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  PyObject *__pyx_v_indices = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_indices,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(1, 2421, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 2421, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_indices = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2421, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_95add(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_indices);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_95add(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_indices) {
  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("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_add(__pyx_v_self, __pyx_v_pattern, __pyx_v_indices, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_99generator42(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2436
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_98__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_97__iter__[] = "Iterate over all patterns in this model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_97__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_98__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_97__iter__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_97__iter__(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_42___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_42___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2436, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_99generator42, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_HashOrderedIndexedPatternModel, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2436, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_99generator42(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 2436, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2438
 *     def __iter__(self):
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":2440
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2441
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":2442
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2443
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2444
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2444, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2445
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2436
 *         self.data.add(pattern.cpattern, cvalue, ref)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_102generator43(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2447
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_101items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_100items[] = "Iterate over all patterns and their index data (IndexedData instances) in this model";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_101items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_100items(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_100items(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_43_items(__pyx_ptype_11colibricore___pyx_scope_struct_43_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2447, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_102generator43, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_HashOrderedIndexedPatternModel_i, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2447, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_102generator43(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  IndexedData __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 2447, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2449
 *     def items(self):
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cIndexedData cvalue
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":2452
 *         cdef cPattern cpattern
 *         cdef cIndexedData cvalue
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2453
 *         cdef cIndexedData cvalue
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cvalue = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":2454
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cvalue = __pyx_t_3;

    /* "colibricore_wrapper.pyx":2455
 *             cpattern = deref(it).first
 *             cvalue = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             value = IndexedData()
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2456
 *             cvalue = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             value = IndexedData()
 *             value.bind(cvalue)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2457
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             value = IndexedData()             # <<<<<<<<<<<<<<
 *             value.bind(cvalue)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_IndexedData)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, ((struct __pyx_obj_11colibricore_IndexedData *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2458
 *             pattern.bind(cpattern)
 *             value = IndexedData()
 *             value.bind(cvalue)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_IndexedData *)__pyx_cur_scope->__pyx_v_value->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_value, __pyx_cur_scope->__pyx_v_cvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":2459
 *             value = IndexedData()
 *             value.bind(cvalue)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_value));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_value));
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2459, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2460
 *             value.bind(cvalue)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2447
 *             inc(it)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their index data (IndexedData instances) in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2466
 * 
 * 
 *     def covered(self, indexreference):             # <<<<<<<<<<<<<<
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_104covered(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_104covered(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("covered (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_103covered(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_103covered(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  unsigned int __pyx_v_sentence;
  unsigned int __pyx_v_token;
  IndexReference __pyx_v_ref;
  IndexReference __pyx_v_ref2;
  std::unordered_set<PatternPointer>  __pyx_v_results;
  std::unordered_set<PatternPointer>  __pyx_v_results2;
  std::unordered_set<PatternPointer> ::iterator __pyx_v_resit;
  Pattern __pyx_v_cpattern;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  unsigned int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("covered", 0);

  /* "colibricore_wrapper.pyx":2467
 * 
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 2467, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2468
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 2468, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2467
 * 
 *     def covered(self, indexreference):
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 */
  }

  /* "colibricore_wrapper.pyx":2469
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2469, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":2470
 *             raise ValueError("Expected tuple")
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef cIndexReference ref2
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":2471
 *         cdef unsigned int sentence = indexreference[0]
 *         cdef unsigned int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref2
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_v_ref = IndexReference(__pyx_v_sentence, __pyx_v_token);

  /* "colibricore_wrapper.pyx":2473
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef cIndexReference ref2
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results2
 *         cdef unordered_set[cPatternPointer].iterator resit
 */
  __pyx_v_results = __pyx_v_self->data.getreverseindex(__pyx_v_ref);

  /* "colibricore_wrapper.pyx":2477
 *         cdef unordered_set[cPatternPointer].iterator resit
 *         cdef cPattern cpattern
 *         if not results.empty():             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = ((!(__pyx_v_results.empty() != 0)) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":2478
 *         cdef cPattern cpattern
 *         if not results.empty():
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(1, token+1):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":2477
 *         cdef unordered_set[cPatternPointer].iterator resit
 *         cdef cPattern cpattern
 *         if not results.empty():             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":2480
 *             return True
 *         else:
 *             for i in range(1, token+1):             # <<<<<<<<<<<<<<
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_token + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2480, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 2480, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 2480, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 2480, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "colibricore_wrapper.pyx":2481
 *         else:
 *             for i in range(1, token+1):
 *                 if token-i >= 0:             # <<<<<<<<<<<<<<
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 */
      __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_token); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2481, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2481, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "colibricore_wrapper.pyx":2482
 *             for i in range(1, token+1):
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)             # <<<<<<<<<<<<<<
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()
 */
        __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_token); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2482, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_v_ref2 = IndexReference(__pyx_v_sentence, __pyx_t_10);

        /* "colibricore_wrapper.pyx":2483
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)             # <<<<<<<<<<<<<<
 *                     resit = results2.begin()
 *                     while resit != results2.end():
 */
        __pyx_v_results2 = __pyx_v_self->data.getreverseindex(__pyx_v_ref2);

        /* "colibricore_wrapper.pyx":2484
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()             # <<<<<<<<<<<<<<
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 */
        __pyx_v_resit = __pyx_v_results2.begin();

        /* "colibricore_wrapper.pyx":2485
 *                     results2 = self.data.getreverseindex(ref2)
 *                     resit = results2.begin()
 *                     while resit != results2.end():             # <<<<<<<<<<<<<<
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:
 */
        while (1) {
          __pyx_t_1 = ((__pyx_v_resit != __pyx_v_results2.end()) != 0);
          if (!__pyx_t_1) break;

          /* "colibricore_wrapper.pyx":2486
 *                     resit = results2.begin()
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *                         if cpattern.n() >= token+1:
 *                             return True
 */
          __pyx_v_cpattern = (*__pyx_v_resit).pattern();

          /* "colibricore_wrapper.pyx":2487
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:             # <<<<<<<<<<<<<<
 *                             return True
 *                         inc(resit)
 */
          __pyx_t_1 = ((__pyx_v_cpattern.n() >= (__pyx_v_token + 1)) != 0);
          if (__pyx_t_1) {

            /* "colibricore_wrapper.pyx":2488
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:
 *                             return True             # <<<<<<<<<<<<<<
 *                         inc(resit)
 *             return False
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(Py_True);
            __pyx_r = Py_True;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L0;

            /* "colibricore_wrapper.pyx":2487
 *                     while resit != results2.end():
 *                         cpattern = deref(resit).pattern()
 *                         if cpattern.n() >= token+1:             # <<<<<<<<<<<<<<
 *                             return True
 *                         inc(resit)
 */
          }

          /* "colibricore_wrapper.pyx":2489
 *                         if cpattern.n() >= token+1:
 *                             return True
 *                         inc(resit)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
          (void)((++__pyx_v_resit));
        }

        /* "colibricore_wrapper.pyx":2481
 *         else:
 *             for i in range(1, token+1):
 *                 if token-i >= 0:             # <<<<<<<<<<<<<<
 *                     ref2 = cIndexReference(sentence, token-i)
 *                     results2 = self.data.getreverseindex(ref2)
 */
      }

      /* "colibricore_wrapper.pyx":2480
 *             return True
 *         else:
 *             for i in range(1, token+1):             # <<<<<<<<<<<<<<
 *                 if token-i >= 0:
 *                     ref2 = cIndexReference(sentence, token-i)
 */
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "colibricore_wrapper.pyx":2490
 *                             return True
 *                         inc(resit)
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":2466
 * 
 * 
 *     def covered(self, indexreference):             # <<<<<<<<<<<<<<
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.covered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2498
 * 
 * 
 *     cpdef outputrelations(self, Pattern pattern, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Compute and output (to stdout) all relations for the specified pattern:
 * 
 */

static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_outputrelations(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outputrelations", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_outputrelations); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_106outputrelations)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_decoder)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_decoder)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_decoder));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_decoder));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_decoder));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2506
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.outputrelations(pattern.cpattern,decoder.data,&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.outputrelations(__pyx_v_pattern->cpattern, __pyx_v_decoder->data, (&std::cout));

  /* "colibricore_wrapper.pyx":2498
 * 
 * 
 *     cpdef outputrelations(self, Pattern pattern, ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Compute and output (to stdout) all relations for the specified pattern:
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_105outputrelations[] = "Compute and output (to stdout) all relations for the specified pattern:\n    \n        :param pattern: The pattern to output relations for\n        :type pattern: Pattern\n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_106outputrelations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outputrelations (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_decoder,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_decoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputrelations", 1, 2, 2, 1); __PYX_ERR(1, 2498, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outputrelations") < 0)) __PYX_ERR(1, 2498, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_decoder = ((struct __pyx_obj_11colibricore_ClassDecoder *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outputrelations", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2498, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2498, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 2498, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_105outputrelations(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_decoder);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_105outputrelations(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("outputrelations", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_30HashOrderedIndexedPatternModel_outputrelations(__pyx_v_self, __pyx_v_pattern, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.outputrelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_109generator44(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2509
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_108getsubchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_107getsubchildren[] = "Get subsumption children for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_108getsubchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubchildren (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getsubchildren") < 0)) __PYX_ERR(1, 2509, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2509, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2509, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2509, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getsubchildren", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2509, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2509, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_107getsubchildren(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_107getsubchildren(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getsubchildren", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)__pyx_tp_new_11colibricore___pyx_scope_struct_44_getsubchildren(__pyx_ptype_11colibricore___pyx_scope_struct_44_getsubchildren, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2509, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_109generator44, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getsubchildren, __pyx_n_s_HashOrderedIndexedPatternModel_g_3, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2509, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_109generator44(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubchildren", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2509, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2520
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2521
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2521, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2520
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2523
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 * 
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getsubchildren(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2523, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2524
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 * 
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2528
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2529
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2530
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2531
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2532
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2533
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2533, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2534
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2509
 * 
 * 
 *     def getsubchildren(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption children for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getsubchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_112generator45(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2536
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_111getsubparents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_110getsubparents[] = "Get subsumption parents for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_111getsubparents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubparents (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getsubparents") < 0)) __PYX_ERR(1, 2536, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2536, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2536, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2536, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getsubparents", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2536, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_110getsubparents(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_110getsubparents(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getsubparents", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)__pyx_tp_new_11colibricore___pyx_scope_struct_45_getsubparents(__pyx_ptype_11colibricore___pyx_scope_struct_45_getsubparents, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2536, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_112generator45, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getsubparents, __pyx_n_s_HashOrderedIndexedPatternModel_g_4, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_112generator45(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsubparents", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2536, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2547
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2548
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2548, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2547
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2550
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getsubparents(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2550, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2551
 * 
 *         cdef t_relationmap  relations = self.data.getsubparents(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2554
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2555
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2556
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2557
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2558
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2559
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2559, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2560
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2536
 *             inc(relit)
 * 
 *     def getsubparents(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get subsumption parents for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getsubparents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_115generator46(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2562
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_114getleftneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_113getleftneighbours[] = "Get left neighbours for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_114getleftneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_v_cutoff;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftneighbours (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,&__pyx_n_s_cutoff,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getleftneighbours") < 0)) __PYX_ERR(1, 2562, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2562, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2562, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2562, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
    if (values[4]) {
      __pyx_v_cutoff = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2562, __pyx_L3_error)
    } else {
      __pyx_v_cutoff = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getleftneighbours", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2562, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2562, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_113getleftneighbours(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size, __pyx_v_cutoff);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_113getleftneighbours(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getleftneighbours", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)__pyx_tp_new_11colibricore___pyx_scope_struct_46_getleftneighbours(__pyx_ptype_11colibricore___pyx_scope_struct_46_getleftneighbours, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2562, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  __pyx_cur_scope->__pyx_v_cutoff = __pyx_v_cutoff;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_115generator46, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getleftneighbours, __pyx_n_s_HashOrderedIndexedPatternModel_g_5, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2562, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_115generator46(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftneighbours", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2562, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2573
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2574
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2574, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2573
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2576
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getleftneighbours(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size, __pyx_cur_scope->__pyx_v_cutoff);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2576, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2577
 * 
 *         cdef t_relationmap  relations = self.data.getleftneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2580
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2581
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2582
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2583
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2584
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2585
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2585, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2586
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2562
 *             inc(relit)
 * 
 *     def getleftneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get left neighbours for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getleftneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_118generator47(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2588
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_117getrightneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_116getrightneighbours[] = "Get right neighbours for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_117getrightneighbours(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_v_cutoff;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightneighbours (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,&__pyx_n_s_cutoff,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getrightneighbours") < 0)) __PYX_ERR(1, 2588, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2588, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2588, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2588, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
    if (values[4]) {
      __pyx_v_cutoff = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2588, __pyx_L3_error)
    } else {
      __pyx_v_cutoff = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getrightneighbours", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2588, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2588, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_116getrightneighbours(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size, __pyx_v_cutoff);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_116getrightneighbours(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size, int __pyx_v_cutoff) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getrightneighbours", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)__pyx_tp_new_11colibricore___pyx_scope_struct_47_getrightneighbours(__pyx_ptype_11colibricore___pyx_scope_struct_47_getrightneighbours, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2588, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  __pyx_cur_scope->__pyx_v_cutoff = __pyx_v_cutoff;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_118generator47, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getrightneighbours, __pyx_n_s_HashOrderedIndexedPatternModel_g_6, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2588, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_118generator47(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightneighbours", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2588, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2599
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2600
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2600, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2599
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrences for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2602
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getrightneighbours(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size, __pyx_cur_scope->__pyx_v_cutoff);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2602, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2603
 * 
 *         cdef t_relationmap  relations = self.data.getrightneighbours(pattern.cpattern, occurrencethreshold, category, size,cutoff)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2606
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2607
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2608
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2609
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2610
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2611
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2611, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2612
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getskipcontent(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2588
 *             inc(relit)
 * 
 *     def getrightneighbours(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0, int cutoff = 0):             # <<<<<<<<<<<<<<
 *         """Get right neighbours for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getrightneighbours", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_121generator48(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2614
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_120getskipcontent(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_119getskipcontent[] = "Get skip content for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_120getskipcontent(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getskipcontent (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2614, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_119getskipcontent(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_119getskipcontent(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getskipcontent", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)__pyx_tp_new_11colibricore___pyx_scope_struct_48_getskipcontent(__pyx_ptype_11colibricore___pyx_scope_struct_48_getskipcontent, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2614, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_121generator48, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getskipcontent, __pyx_n_s_HashOrderedIndexedPatternModel_g_7, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2614, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getskipcontent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_121generator48(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getskipcontent", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2614, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2620
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2621
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2621, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2620
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2623
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getskipcontent(__pyx_cur_scope->__pyx_v_pattern->cpattern);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2623, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2624
 * 
 *         cdef t_relationmap  relations = self.data.getskipcontent(pattern.cpattern)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2627
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2628
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2629
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2630
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2631
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2632
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2632, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2633
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2614
 *             inc(relit)
 * 
 *     def getskipcontent(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Get skip content for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getskipcontent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_124generator49(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2635
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_123gettemplates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_122gettemplates[] = "Get templates (abstracting skipgrams) for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_123gettemplates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gettemplates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gettemplates") < 0)) __PYX_ERR(1, 2635, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2635, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gettemplates", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2635, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2635, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_122gettemplates(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_122gettemplates(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gettemplates", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)__pyx_tp_new_11colibricore___pyx_scope_struct_49_gettemplates(__pyx_ptype_11colibricore___pyx_scope_struct_49_gettemplates, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2635, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_124generator49, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_gettemplates, __pyx_n_s_HashOrderedIndexedPatternModel_g_8, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2635, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_124generator49(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gettemplates", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2635, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2643
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2644
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2644, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2643
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2646
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.gettemplates(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2646, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2647
 * 
 *         cdef t_relationmap  relations = self.data.gettemplates(pattern.cpattern, occurrencethreshold)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2650
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2651
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2652
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2653
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2654
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2655
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2655, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2656
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2635
 *             inc(relit)
 * 
 *     def gettemplates(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("gettemplates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_127generator50(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2658
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_126getinstances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_125getinstances[] = "Get templates (abstracting skipgrams) for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_126getinstances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstances") < 0)) __PYX_ERR(1, 2658, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2658, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstances", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2658, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2658, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_125getinstances(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_125getinstances(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstances", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)__pyx_tp_new_11colibricore___pyx_scope_struct_50_getinstances(__pyx_ptype_11colibricore___pyx_scope_struct_50_getinstances, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2658, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_127generator50, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getinstances, __pyx_n_s_HashOrderedIndexedPatternModel_g_9, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2658, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_127generator50(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstances", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2658, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2666
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2667
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2667, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2666
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2669
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getinstances(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2669, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2670
 * 
 *         cdef t_relationmap  relations = self.data.getinstances(pattern.cpattern, occurrencethreshold)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2673
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2674
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2675
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2676
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2676, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2677
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2678
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2678, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2679
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2658
 *             inc(relit)
 * 
 *     def getinstances(self, Pattern pattern, int occurrencethreshold = 0):             # <<<<<<<<<<<<<<
 *         """Get templates (abstracting skipgrams) for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getinstances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_130generator51(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2681
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_129getcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_128getcooc[] = "Get left-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_129getcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getcooc") < 0)) __PYX_ERR(1, 2681, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2681, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2681, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2681, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2681, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_128getcooc(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_128getcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_51_getcooc(__pyx_ptype_11colibricore___pyx_scope_struct_51_getcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2681, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_130generator51, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getcooc, __pyx_n_s_HashOrderedIndexedPatternModel_g_10, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2681, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_130generator51(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2681, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2692
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2693
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2693, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2692
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2695
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2695, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2696
 * 
 *         cdef t_relationmap  relations = self.data.getcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2699
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2700
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2701
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2702
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2703
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2703, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2704
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2704, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2705
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2681
 *             inc(relit)
 * 
 *     def getcooc(self, Pattern pattern,  int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_133generator52(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2707
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_132getleftcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_131getleftcooc[] = "Get left-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_132getleftcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getleftcooc") < 0)) __PYX_ERR(1, 2707, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2707, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2707, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2707, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getleftcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2707, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2707, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_131getleftcooc(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_131getleftcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getleftcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_52_getleftcooc(__pyx_ptype_11colibricore___pyx_scope_struct_52_getleftcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2707, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_133generator52, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getleftcooc, __pyx_n_s_HashOrderedIndexedPatternModel_g_11, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2707, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_133generator52(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getleftcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2707, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2718
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2719
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2719, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2718
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2721
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getleftcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2721, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2722
 * 
 *         cdef t_relationmap  relations = self.data.getleftcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2725
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2726
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2727
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2728
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2729
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2730
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2730, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2731
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2707
 *             inc(relit)
 * 
 *     def getleftcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get left-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getleftcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_136generator53(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2733
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_135getrightcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_134getrightcooc[] = "Get right-side co-occurrences for the specified pattern\n        :param pattern: The pattern\n        :type pattern: Pattern\n        :param occurrencethreshold: Constrain by patterns occurring at least this many times in this relationship (default: 0, unconstrained)\n        :type occurrencethreshold: int\n        :param category: Constrain by patterns of the specified category (colibricore.Category.NGRAM,colibricore.Category.SKIPGRAM, colibricore.Category.FLEXGRAM)\n        :param size: Constrain by patterns of the specified size\n        :type size: int\n        :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship\n        ";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_135getrightcooc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_occurrencethreshold;
  int __pyx_v_category;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightcooc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_occurrencethreshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_occurrencethreshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getrightcooc") < 0)) __PYX_ERR(1, 2733, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_occurrencethreshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_occurrencethreshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2733, __pyx_L3_error)
    } else {
      __pyx_v_occurrencethreshold = ((int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2733, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2733, __pyx_L3_error)
    } else {
      __pyx_v_size = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getrightcooc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2733, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2733, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_134getrightcooc(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_occurrencethreshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_134getrightcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_occurrencethreshold, int __pyx_v_category, int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getrightcooc", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)__pyx_tp_new_11colibricore___pyx_scope_struct_53_getrightcooc(__pyx_ptype_11colibricore___pyx_scope_struct_53_getrightcooc, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2733, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_occurrencethreshold = __pyx_v_occurrencethreshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_136generator53, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getrightcooc, __pyx_n_s_HashOrderedIndexedPatternModel_g_12, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2733, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_30HashOrderedIndexedPatternModel_136generator53(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  t_relationmap __pyx_t_3;
  Pattern __pyx_t_4;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrightcooc", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2733, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2744
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":2745
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 2745, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2744
 *         :rtype: generator over (Pattern,value) tuples. The values correspond to the number of occurrence for this particularrelationship
 *         """
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":2747
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)             # <<<<<<<<<<<<<<
 *         cdef t_relationmap_iterator relit = relations.begin()
 *         cdef cPattern cpattern
 */
  try {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data.getrightcooc(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_occurrencethreshold, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 2747, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_relations = __pyx_t_3;

  /* "colibricore_wrapper.pyx":2748
 * 
 *         cdef t_relationmap  relations = self.data.getrightcooc(pattern.cpattern, occurrencethreshold, category, size)
 *         cdef t_relationmap_iterator relit = relations.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_relit = __pyx_cur_scope->__pyx_v_relations.begin();

  /* "colibricore_wrapper.pyx":2751
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while relit != relations.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_relit != __pyx_cur_scope->__pyx_v_relations.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2752
 *         cdef unsigned int value
 *         while relit != relations.end():
 *             cpattern = deref(relit).first             # <<<<<<<<<<<<<<
 *             value = deref(relit).second
 *             pattern = Pattern()
 */
    __pyx_t_4 = (*__pyx_cur_scope->__pyx_v_relit).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_4;

    /* "colibricore_wrapper.pyx":2753
 *         while relit != relations.end():
 *             cpattern = deref(relit).first
 *             value = deref(relit).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_5 = (*__pyx_cur_scope->__pyx_v_relit).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_5;

    /* "colibricore_wrapper.pyx":2754
 *             cpattern = deref(relit).first
 *             value = deref(relit).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2755
 *             value = deref(relit).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(relit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2756
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(relit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2756, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2757
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(relit)             # <<<<<<<<<<<<<<
 * 
 *     def computeflexgrams_fromskipgrams(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_relit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2733
 *             inc(relit)
 * 
 *     def getrightcooc(self, Pattern pattern, int occurrencethreshold = 0, int category = 0, int size = 0):             # <<<<<<<<<<<<<<
 *         """Get right-side co-occurrences for the specified pattern
 *         :param pattern: The pattern
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("getrightcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2759
 *             inc(relit)
 * 
 *     def computeflexgrams_fromskipgrams(self):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_138computeflexgrams_fromskipgrams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_137computeflexgrams_fromskipgrams[] = "Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found.";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_138computeflexgrams_fromskipgrams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeflexgrams_fromskipgrams (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_137computeflexgrams_fromskipgrams(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_137computeflexgrams_fromskipgrams(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("computeflexgrams_fromskipgrams", 0);

  /* "colibricore_wrapper.pyx":2761
 *     def computeflexgrams_fromskipgrams(self):
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()             # <<<<<<<<<<<<<<
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.computeflexgrams_fromskipgrams()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2759
 *             inc(relit)
 * 
 *     def computeflexgrams_fromskipgrams(self):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams from skipgrams in the model. Returns the number of flexgrams found."""
 *         return self.data.computeflexgrams_fromskipgrams()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.computeflexgrams_fromskipgrams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2763
 *         return self.data.computeflexgrams_fromskipgrams()
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_140computeflexgrams_fromcooc(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold); /*proto*/
static char __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_139computeflexgrams_fromcooc[] = "Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method.";
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_140computeflexgrams_fromcooc(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold) {
  double __pyx_v_threshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeflexgrams_fromcooc (wrapper)", 0);
  assert(__pyx_arg_threshold); {
    __pyx_v_threshold = __pyx_PyFloat_AsDouble(__pyx_arg_threshold); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 2763, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.computeflexgrams_fromcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_139computeflexgrams_fromcooc(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((double)__pyx_v_threshold));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_139computeflexgrams_fromcooc(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, double __pyx_v_threshold) {
  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("computeflexgrams_fromcooc", 0);

  /* "colibricore_wrapper.pyx":2765
 *     def computeflexgrams_fromcooc(self,double threshold):
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternSetModel:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.computeflexgrams_fromcooc(__pyx_v_threshold)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2763
 *         return self.data.computeflexgrams_fromskipgrams()
 * 
 *     def computeflexgrams_fromcooc(self,double threshold):             # <<<<<<<<<<<<<<
 *         """Compute flexgrams based on  co-occurence. The threshold is expressed in normalised pointwise mutual information. Returns the number of flexgrams found. Flexgrams contain at only one gap using this method."""
 *         return self.data.computeflexgrams_fromcooc(threshold)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.computeflexgrams_fromcooc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_142__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_142__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_141__reduce_cython__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_141__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_144__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_144__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_143__setstate_cython__(((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_30HashOrderedIndexedPatternModel_143__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.HashOrderedIndexedPatternModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2770
 *     cdef cPatternSetModel data
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternSetModel_1__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_15PatternSetModel_1__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel___bool__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternSetModel___bool__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":2771
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2770
 *     cdef cPatternSetModel data
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2773
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_15PatternSetModel_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_2__len__[] = "Return the total number of patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternSetModel_2__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_15PatternSetModel_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_2__len__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_15PatternSetModel_2__len__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":2775
 *     def __len__(self):
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cpdef has(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2773
 *         return self.data.size() > 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of patterns in the dictionary"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2777
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_pw_11colibricore_15PatternSetModel_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_15PatternSetModel_has(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2777, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_15PatternSetModel_5has)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2777, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":2778
 * 
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_5 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":2779
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2779, __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_ERR(1, 2779, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2778
 * 
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2780
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2777
 *         return self.data.size()
 * 
 *     cpdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternSetModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_5has(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2777, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_4has(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_4has(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_15PatternSetModel_has(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSetModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2782
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternSetModel_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_6__contains__[] = "Test if the pattern is in the dictionary\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternSetModel_6__contains__;
#endif
static int __pyx_pw_11colibricore_15PatternSetModel_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_6__contains__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternSetModel_6__contains__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":2789
 *         :rtype: bool
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2790
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2790, __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_ERR(1, 2790, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2789
 *         :rtype: bool
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":2791
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 2791, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2791, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2782
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Test if the pattern is in the dictionary
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternSetModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_15PatternSetModel_10generator54(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":2793
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_9__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_8__iter__[] = "Iterate over all patterns in the dictionary";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternSetModel_8__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_8__iter__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_8__iter__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_54___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_54___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 2793, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_15PatternSetModel_10generator54, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternSetModel___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 2793, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternSetModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_15PatternSetModel_10generator54(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 2793, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":2795
 *     def __iter__(self):
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":2797
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             cpattern = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":2798
 *         cdef cPattern cpattern
 *         it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":2799
 *         it_end = self.data.end()
 *         while it != it_end:
 *             cpattern = deref(it)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":2800
 *         while it != it_end:
 *             cpattern = deref(it)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2801
 *             cpattern = deref(it)
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":2802
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 2802, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2803
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def add(self, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":2793
 *         return self.has(pattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns in the dictionary"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2805
 *             inc(it)
 * 
 *     def add(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Adds a pattern to the set
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_12add(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_11add[] = "Adds a pattern to the set\n    \n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        ";
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_12add(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2805, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_11add(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_11add(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "colibricore_wrapper.pyx":2811
 *         :type pattern: Pattern
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2812
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         self.data.insert(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2812, __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_ERR(1, 2812, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2811
 *         :type pattern: Pattern
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2813
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         self.data.insert(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     #cdef getdatapointer(self):
 */
  __pyx_v_self->data.insert(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":2805
 *             inc(it)
 * 
 *     def add(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Adds a pattern to the set
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternSetModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2818
 *     #    return address(self.data)
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_15PatternSetModel_getinterface(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":2819
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2818
 *     #    return address(self.data)
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2821
 *         return self.data.getinterface()
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_15PatternSetModel_14__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_13__init__[] = "Initialise a pattern model. Either an empty one or loading from file.\n\n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_15PatternSetModel_13__init__;
#endif
static int __pyx_pw_11colibricore_15PatternSetModel_14__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 2821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternSetModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2821, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2821, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_13__init__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_15PatternSetModel_13__init__(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":2830
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":2831
 *         """
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             self.load(filename,options)
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2831, __pyx_L1_error)
    __pyx_t_2 = ((!__pyx_t_1) != 0);
    if (__pyx_t_2) {

      /* "colibricore_wrapper.pyx":2832
 *         if filename:
 *             if not options:
 *                 options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *             self.load(filename,options)
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "colibricore_wrapper.pyx":2831
 *         """
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             self.load(filename,options)
 */
    }

    /* "colibricore_wrapper.pyx":2833
 *             if not options:
 *                 options = PatternModelOptions()
 *             self.load(filename,options)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2833, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2833, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_options));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2830
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  }

  /* "colibricore_wrapper.pyx":2821
 *         return self.data.getinterface()
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.PatternSetModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2835
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_16load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_15load[] = "Load a patternmodel from file\n\n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_16load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 2835, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2835, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternSetModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2835, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2835, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_15load(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_15load(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":2843
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_options) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":2844
 *         """
 *         if options is None:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":2843
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  }

  /* "colibricore_wrapper.pyx":2845
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 2845, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2846
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename), options.coptions)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2846, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2846, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 2846, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2845
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  }

  /* "colibricore_wrapper.pyx":2847
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2847, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2847, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2835
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.PatternSetModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2849
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_18read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_17read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_18read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 2849, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2849, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternSetModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2849, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 2849, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_17read(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_17read(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":2851
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     def write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2851, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2851, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":2849
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.PatternSetModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2853
 *         self.load(filename, options)
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_20write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_15PatternSetModel_19write[] = "Write a patternmodel to file\n\n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_20write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2853, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_19write(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_19write(struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":2859
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 * cpdef write(self, str filename):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 2859, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_4);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 2859, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":2853
 *         self.load(filename, options)
 * 
 *     def write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternSetModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_22__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_22__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_21__reduce_cython__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_21__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSetModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_24__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_15PatternSetModel_24__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_15PatternSetModel_23__setstate_cython__(((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_15PatternSetModel_23__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternSetModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2861
 *         self.data.write(encode(filename))
 * 
 * cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *     """Write a patternmodel to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_5write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "colibricore_wrapper.pyx":2867
 *     :type filename: str
 *     """
 *     self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 * cdef class UnindexedPatternModel:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2867, __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;

  /* "colibricore_wrapper.pyx":2861
 *         self.data.write(encode(filename))
 * 
 * cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *     """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_5write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_4write[] = "Write a patternmodel to file\n\n    :param filename: The name of the file to write to\n    :type filename: str\n    ";
static PyObject *__pyx_pw_11colibricore_5write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, 1); __PYX_ERR(1, 2861, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(1, 2861, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_filename = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2861, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 2861, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_4write(__pyx_self, __pyx_v_self, __pyx_v_filename);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_4write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_write(__pyx_v_self, __pyx_v_filename, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2876
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_21UnindexedPatternModel_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21UnindexedPatternModel___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_21UnindexedPatternModel_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel___len__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_21UnindexedPatternModel___len__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":2878
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2876
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2880
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21UnindexedPatternModel_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_21UnindexedPatternModel_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_2__bool__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21UnindexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":2881
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2880
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2883
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_4types(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_4types(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":2885
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2883
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2887
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_6tokens(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_6tokens(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":2889
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2887
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2891
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_8minlength(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_8minlength(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":2893
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2891
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2895
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_10maxlength(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":2897
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2895
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2899
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_12type(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_12type(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":2901
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.type()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2899
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2903
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_14version(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_14version(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":2905
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.version()             # <<<<<<<<<<<<<<
 * 
 *     def occurrencecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2903
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2907
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_16occurrencecount[] = "Returns the number of times the specified pattern occurs in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("occurrencecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2907, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_16occurrencecount(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("occurrencecount", 0);

  /* "colibricore_wrapper.pyx":2914
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2915
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2915, __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_ERR(1, 2915, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2914
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2916
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coveragecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.occurrencecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2907
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.occurrencecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2918
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_18coveragecount[] = "Returns the number of tokens all instances of the specified pattern cover in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coveragecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2918, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_18coveragecount(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coveragecount", 0);

  /* "colibricore_wrapper.pyx":2925
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2926
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2926, __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_ERR(1, 2926, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2925
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2927
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coverage(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.coveragecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2918
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.coveragecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2929
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_20coverage[] = "Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coverage (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2929, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_20coverage(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_20coverage(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coverage", 0);

  /* "colibricore_wrapper.pyx":2936
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2937
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coverage(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2937, __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_ERR(1, 2937, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2936
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2938
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def frequency(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.coverage(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2929
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2940
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_22frequency[] = "Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frequency (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 2940, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_22frequency(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_22frequency(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frequency", 0);

  /* "colibricore_wrapper.pyx":2947
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2948
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.frequency(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2948, __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_ERR(1, 2948, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2947
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":2949
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.frequency(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2940
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2952
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_24totaloccurrencesingroup[] = "Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaloccurrencesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaloccurrencesingroup") < 0)) __PYX_ERR(1, 2952, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2952, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2952, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaloccurrencesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2952, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_24totaloccurrencesingroup(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaloccurrencesingroup", 0);

  /* "colibricore_wrapper.pyx":2961
 *         :rtype: int
 *         """
 *         return self.data.totaloccurrencesingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaloccurrencesingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2952
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2963
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_26totalpatternsingroup[] = "Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalpatternsingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalpatternsingroup") < 0)) __PYX_ERR(1, 2963, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2963, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2963, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalpatternsingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_26totalpatternsingroup(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalpatternsingroup", 0);

  /* "colibricore_wrapper.pyx":2972
 *         :rtype: int
 *         """
 *         return self.data.totalpatternsingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totalpatternsingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2963
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2974
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_28totaltokensingroup[] = "Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaltokensingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaltokensingroup") < 0)) __PYX_ERR(1, 2974, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2974, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2974, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaltokensingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2974, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_28totaltokensingroup(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaltokensingroup", 0);

  /* "colibricore_wrapper.pyx":2983
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2974
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2985
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_30totalwordtypesingroup[] = "Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalwordtypesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalwordtypesingroup") < 0)) __PYX_ERR(1, 2985, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2985, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2985, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalwordtypesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2985, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_30totalwordtypesingroup(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalwordtypesingroup", 0);

  /* "colibricore_wrapper.pyx":2994
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2985
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":2997
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_has(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":2998
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":2999
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2999, __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_ERR(1, 2999, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":2998
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3000
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":2997
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3002
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21UnindexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_32__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n    \n        Example::\n    \n            pattern in patternmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_32__contains__;
#endif
static int __pyx_pw_11colibricore_21UnindexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_32__contains__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21UnindexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":3013
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3014
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3014, __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_ERR(1, 3014, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3013
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3015
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 3015, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3002
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3017
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_34__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_34__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_34__getitem__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":3028
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3029
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3029, __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_ERR(1, 3029, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3028
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3030
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 3030, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3017
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__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_11colibricore_21UnindexedPatternModel_38generator55(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3034
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_37__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_36__iter__[] = "Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.\n    \n        Example::\n    \n            for pattern in model:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_36__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_37__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_36__iter__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_55___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_55___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3034, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_38generator55, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_UnindexedPatternModel___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3034, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_38generator55(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 3034, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3043
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3045
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3046
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3047
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3048
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3049
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3049, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3050
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3034
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3052
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_21UnindexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_39__init__[] = "Initialise a pattern model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A model to be used as a constraint, only patterns occuring in this constraint model will be loaded/trained\n        :type constrainmodel: IndexedPatternModel, UnindexedPatternModel or None (default)\n        :param reverseindex: Corpus data to use as reverse index. On indexed models, this is required for various operations, including computation of skipgrams\n        :type reverseindex: IndexedCorpus or None\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_39__init__;
#endif
static int __pyx_pw_11colibricore_21UnindexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  PyObject *__pyx_v_reverseindex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,&__pyx_n_s_reverseindex,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reverseindex);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 3052, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
    __pyx_v_reverseindex = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3052, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3052, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3052, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_39__init__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, __pyx_v_reverseindex);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_21UnindexedPatternModel_39__init__(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":3065
 *         """
 * 
 *         self.corpus = None             # <<<<<<<<<<<<<<
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = Py_None;

  /* "colibricore_wrapper.pyx":3066
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reverseindex); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3066, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3067
 *         self.corpus = None
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadreverseindex); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_reverseindex) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_reverseindex);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3067, __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;

    /* "colibricore_wrapper.pyx":3066
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3069
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3070
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3070, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_1) != 0);
    if (__pyx_t_5) {

      /* "colibricore_wrapper.pyx":3071
 *         if filename:
 *             if not options:
 *                 options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 */
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "colibricore_wrapper.pyx":3070
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    }

    /* "colibricore_wrapper.pyx":3072
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_5 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3072, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = ((!__pyx_t_1) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (unlikely(__pyx_t_5)) {

      /* "colibricore_wrapper.pyx":3073
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *             self.load(filename,options, constrainmodel)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3073, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3073, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 3073, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":3072
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    }

    /* "colibricore_wrapper.pyx":3074
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3074, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3074, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_options));
      __Pyx_INCREF(__pyx_v_constrainmodel);
      __Pyx_GIVEREF(__pyx_v_constrainmodel);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_constrainmodel);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3069
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  }

  /* "colibricore_wrapper.pyx":3052
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3076
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_41load[] = "Load a patternmodel from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 3076, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3076, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3076, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3076, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_41load(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_41load(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":3084
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3084, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":3085
 *         """
 *         if not options:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 * 
 *         if filename and not os.path.exists(filename):
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3084
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3087
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3088
 * 
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 3088, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3087
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3090
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":3091
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 3091, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3090
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3092
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_2 = (__pyx_t_6 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":3093
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 3093, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3092
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3094
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":3095
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 3095, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3094
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3097
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3097, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    try {
      __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, NULL);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
      __PYX_ERR(1, 3097, __pyx_L1_error)
    }
  }
  __pyx_L7:;

  /* "colibricore_wrapper.pyx":3076
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3099
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadreverseindex (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseindex), __pyx_ptype_11colibricore_IndexedCorpus, 1, "reverseindex", 0))) __PYX_ERR(1, 3099, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_43loadreverseindex(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_reverseindex));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  IndexedCorpus *__pyx_t_1;
  __Pyx_RefNannySetupContext("loadreverseindex", 0);

  /* "colibricore_wrapper.pyx":3100
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data             # <<<<<<<<<<<<<<
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 * 
 */
  __pyx_t_1 = __pyx_v_reverseindex->data;
  __pyx_v_self->data.reverseindex = __pyx_t_1;

  /* "colibricore_wrapper.pyx":3101
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = ((PyObject *)__pyx_v_reverseindex);

  /* "colibricore_wrapper.pyx":3099
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3104
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_46loadconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3104, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3104, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3104, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3104, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3105
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3105, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3104
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3104, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3104, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 3104, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3104, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3104, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3104, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3104, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_45loadconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3107
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_48loadconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3107, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3107, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3108
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3108, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3107
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3107, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 3107, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3107, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3107, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3107, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_47loadconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3110
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbysetmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_50loadconstrainedbysetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3110, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3110, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3110, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3110, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3111
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3111, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3110
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 1); __PYX_ERR(1, 3110, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 2); __PYX_ERR(1, 3110, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbysetmodel") < 0)) __PYX_ERR(1, 3110, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3110, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3110, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3110, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3110, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_49loadconstrainedbysetmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbysetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3113
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_51read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 3113, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3113, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3113, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_51read(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_51read(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":3115
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3115, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3115, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":3113
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3117
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_write(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_54write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3117, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3123
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3123, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3117
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_53write[] = "Write a patternmodel to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3117, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_53write(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_53write(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3125
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_printmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3125, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_56printmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_decoder)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_decoder));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3125, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3131
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.printmodel(&cout, decoder.data )             # <<<<<<<<<<<<<<
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):
 */
  __pyx_v_self->data.printmodel((&std::cout), __pyx_v_decoder->data);

  /* "colibricore_wrapper.pyx":3125
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_55printmodel[] = "Print the entire pattern model to stdout, a detailed overview\n    \n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printmodel (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 3125, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_55printmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_decoder));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("printmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_printmodel(__pyx_v_self, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3133
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_train(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train *__pyx_optional_args) {
  PyObject *__pyx_v_constrainmodel = ((PyObject *)Py_None);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  std::string __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_constrainmodel = __pyx_optional_args->constrainmodel;
    }
  }
  __Pyx_INCREF(__pyx_v_filename);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_58train)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3133, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3133, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3133, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(__pyx_v_constrainmodel);
          __Pyx_GIVEREF(__pyx_v_constrainmodel);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_constrainmodel);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3133, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3144
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex != NULL) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3145
 * 
 *         if self.data.reverseindex != NULL:
 *             filename = ""             # <<<<<<<<<<<<<<
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 */
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_u_);

    /* "colibricore_wrapper.pyx":3144
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  }

  /* "colibricore_wrapper.pyx":3146
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_9 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_options), __pyx_n_s_DOSKIPGRAMS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 3146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_t_9;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3147
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3147, __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_ERR(1, 3147, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3146
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3150
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_constrainmodel); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 3150, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3151
 * 
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0             # <<<<<<<<<<<<<<
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = PyObject_Length(__pyx_v_constrainmodel); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3151, __pyx_L1_error)
      if (unlikely(!((__pyx_t_10 >= 0) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(1, 3151, __pyx_L1_error)
      }
    }
    #endif

    /* "colibricore_wrapper.pyx":3152
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":3153
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 3153, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3152
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3154
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (__pyx_t_7) {

      /* "colibricore_wrapper.pyx":3155
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 3155, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3155, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3154
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3156
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":3157
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 3157, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3156
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3158
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (likely(__pyx_t_7)) {

      /* "colibricore_wrapper.pyx":3159
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float))))) __PYX_ERR(1, 3159, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3158
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3161
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage             # <<<<<<<<<<<<<<
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3161, __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_ERR(1, 3161, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "colibricore_wrapper.pyx":3150
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":3162
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3163
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_11), __pyx_v_options->coptions, NULL, NULL);

    /* "colibricore_wrapper.pyx":3162
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":3164
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3165
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3165, __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_ERR(1, 3165, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3164
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3167
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, NULL);
  }
  __pyx_L8:;

  /* "colibricore_wrapper.pyx":3133
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_57train[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A patternmodel or patternsetmodel to constrain training (default None)\n        :type constrainmodel: None, UnindexedPatternModel, IndexedPatternModel, PatternSetModel\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, 1); __PYX_ERR(1, 3133, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) __PYX_ERR(1, 3133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3133, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3133, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_57train(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_57train(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.constrainmodel = __pyx_v_constrainmodel;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_UnindexedPatternModel->train(__pyx_v_self, __pyx_v_filename, __pyx_v_options, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3169
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch) {
  PatternSet<unsigned int>  *__pyx_v_cfilterset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train_filtered", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train_filtered); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_60train_filtered)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3169, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3169, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3169, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_filterset));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_filterset));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_filterset));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3169, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3178
 *         :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).
 *         """
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
  __pyx_v_cfilterset = (&__pyx_v_filterset->data);

  /* "colibricore_wrapper.pyx":3180
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3181
 * 
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3181, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);

    /* "colibricore_wrapper.pyx":3180
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3182
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3183
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3183, __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_ERR(1, 3183, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3182
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3185
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3169
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_59train_filtered[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train_filtered (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_filterset,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 1); __PYX_ERR(1, 3169, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 2); __PYX_ERR(1, 3169, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_filtered") < 0)) __PYX_ERR(1, 3169, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_filterset = ((struct __pyx_obj_11colibricore_PatternSet *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3169, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3169, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filterset), __pyx_ptype_11colibricore_PatternSet, 1, "filterset", 0))) __PYX_ERR(1, 3169, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_59train_filtered(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_filterset);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset) {
  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("train_filtered", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_train_filtered(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_filterset, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3188
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_21UnindexedPatternModel_getinterface(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":3189
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3188
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3191
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_62trainconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3191, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3191, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3191, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3191, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3192
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3193
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3193, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3192
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3194
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3195
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3195, __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_ERR(1, 3195, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3194
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3197
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3191
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3191, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3191, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 3191, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3191, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3191, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3191, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3191, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_61trainconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3199
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_64trainconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3199, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3199, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3200
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3201
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3201, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3200
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3202
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3203
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3203, __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_ERR(1, 3203, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3202
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3205
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3199
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3199, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3199, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 3199, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3199, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3199, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3199, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_63trainconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3207
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbypatternsetmode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_66trainconstrainedbypatternsetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3207, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3207, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3207, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3207, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3208
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3209
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3209, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3208
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3210
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3211
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3211, __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_ERR(1, 3211, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3210
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3213
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3207
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 1); __PYX_ERR(1, 3207, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 2); __PYX_ERR(1, 3207, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbypatternsetmodel") < 0)) __PYX_ERR(1, 3207, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3207, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3207, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3207, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3207, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_65trainconstrainedbypatternsetmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbypatternsetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3215
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyalignmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_68trainconstrainedbyalignmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3215, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3215, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3216
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3217
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3216
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3218
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3219
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3219, __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_ERR(1, 3219, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3218
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3221
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef report(self):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3215
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 1); __PYX_ERR(1, 3215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 2); __PYX_ERR(1, 3215, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyalignmodel") < 0)) __PYX_ERR(1, 3215, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3215, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3215, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternAlignmentModel_float, 1, "constrainmodel", 0))) __PYX_ERR(1, 3215, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_67trainconstrainedbyalignmodel(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel) {
  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("trainconstrainedbyalignmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3223
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_report(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_report); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3223, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_70report)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3223, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3225
 *     cpdef report(self):
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)             # <<<<<<<<<<<<<<
 * 
 *     cpdef printhistogram(self):
 */
  __pyx_v_self->data.report((&std::cout));

  /* "colibricore_wrapper.pyx":3223
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_69report[] = "Print a detailed statistical report to stdout";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("report (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_69report(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_69report(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_report(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3227
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printhistogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_72printhistogram)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3227, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3229
 *     cpdef printhistogram(self):
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.histogram((&std::cout));

  /* "colibricore_wrapper.pyx":3227
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_71printhistogram[] = "Print a histogram to stdout";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printhistogram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_71printhistogram(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_printhistogram(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3233
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_prune(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune *__pyx_optional_args) {
  int __pyx_v_n = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_n = __pyx_optional_args->n;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prune); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_74prune)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3233, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3233, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3241
 *         :type n: int
 *         """
 *         self.data.prune(threshold, n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (void)(__pyx_v_self->data.prune(__pyx_v_threshold, __pyx_v_n));

  /* "colibricore_wrapper.pyx":3233
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_73prune[] = "Prune all patterns occurring below the threshold.\n    \n        :param threshold: the threshold value (minimum number of occurrences)\n        :type threshold: int\n        :param n: prune only patterns of the specified size, use 0 (default) for no size limitation\n        :type n: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_threshold;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prune (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(1, 3233, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3233, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3233, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prune", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3233, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_73prune(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_73prune(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.n = __pyx_v_n;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_UnindexedPatternModel->prune(__pyx_v_self, __pyx_v_threshold, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3244
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_75reverseindex[] = "Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index.";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_75reverseindex(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex", 0);

  /* "colibricore_wrapper.pyx":3246
 *     def reverseindex(self):
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->corpus);
  __pyx_r = __pyx_v_self->corpus;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3244
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_79generator56(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3249
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_77getreverseindex[] = "Generator over all patterns occurring at the specified index reference\n    \n        :param indexreference: a (sentence, tokenoffset) tuple\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_77getreverseindex(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)__pyx_tp_new_11colibricore___pyx_scope_struct_56_getreverseindex(__pyx_ptype_11colibricore___pyx_scope_struct_56_getreverseindex, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3249, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_indexreference = __pyx_v_indexreference;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_indexreference);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_indexreference);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_79generator56, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex, __pyx_n_s_UnindexedPatternModel_getreverse, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3249, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_79generator56(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3249, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3255
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_cur_scope->__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3255, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3256
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 3256, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3255
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  }

  /* "colibricore_wrapper.pyx":3257
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3258
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef int sentence = indexreference[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 3258, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3257
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3260
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":3261
 * 
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":3262
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 */
  __pyx_cur_scope->__pyx_v_ref = IndexReference(__pyx_cur_scope->__pyx_v_sentence, __pyx_cur_scope->__pyx_v_token);

  /* "colibricore_wrapper.pyx":3263
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex(__pyx_cur_scope->__pyx_v_ref);

  /* "colibricore_wrapper.pyx":3264
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while resit != results.end():
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":3266
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3267
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_resit).pattern();

    /* "colibricore_wrapper.pyx":3268
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":3269
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(resit)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":3270
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L10_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3270, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3271
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 *     def getreverseindex_bysentence(self, int sentence):
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3249
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_82generator57(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3273
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_80getreverseindex_bysentence[] = "Generator over all patterns occurring in the specified sentence\n    \n        :param sentence: a sentence number\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence) {
  int __pyx_v_sentence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence (wrapper)", 0);
  assert(__pyx_arg_sentence); {
    __pyx_v_sentence = __Pyx_PyInt_As_int(__pyx_arg_sentence); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3273, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_80getreverseindex_bysentence(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((int)__pyx_v_sentence));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_sentence) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)__pyx_tp_new_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence(__pyx_ptype_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3273, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sentence = __pyx_v_sentence;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_82generator57, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex_bysentence, __pyx_n_s_UnindexedPatternModel_getreverse_2, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3273, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_82generator57(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3273, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3279
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3280
 * 
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 3280, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3279
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3282
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)             # <<<<<<<<<<<<<<
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()
 *         cdef pair[cIndexReference,cPatternPointer] p
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex_bysentence(__pyx_cur_scope->__pyx_v_sentence);

  /* "colibricore_wrapper.pyx":3283
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":3286
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             p = deref(resit)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3287
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             p = deref(resit)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 */
    __pyx_cur_scope->__pyx_v_p = (*__pyx_cur_scope->__pyx_v_resit);

    /* "colibricore_wrapper.pyx":3288
 *         while resit != results.end():
 *             p = deref(resit)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":3289
 *             p = deref(resit)
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 */
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_cur_scope->__pyx_v_p.second.pattern();

    /* "colibricore_wrapper.pyx":3290
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":3291
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_p.first.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_p.first.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3291, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3292
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3273
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_85generator58(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3295
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_83histogram[] = "Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_cap,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cap);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histogram") < 0)) __PYX_ERR(1, 3295, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3295, __pyx_L3_error)
    } else {
      __pyx_v_threshold = ((unsigned int)0);
    }
    if (values[1]) {
      __pyx_v_cap = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_cap == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3295, __pyx_L3_error)
    } else {
      __pyx_v_cap = ((unsigned int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3295, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3295, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_83histogram(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_cap, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_83histogram(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("histogram", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)__pyx_tp_new_11colibricore___pyx_scope_struct_58_histogram(__pyx_ptype_11colibricore___pyx_scope_struct_58_histogram, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3295, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_cap = __pyx_v_cap;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_85generator58, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_histogram, __pyx_n_s_UnindexedPatternModel_histogram, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3295, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_85generator58(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram", 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_ERR(1, 3295, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3299
 *         cdef stdmap[unsigned int,unsigned int] hist
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)             # <<<<<<<<<<<<<<
 *         it = hist.begin()
 *         while it != hist.end():
 */
  __pyx_cur_scope->__pyx_v_self->data.histogram(__pyx_cur_scope->__pyx_v_hist, __pyx_cur_scope->__pyx_v_threshold, __pyx_cur_scope->__pyx_v_cap, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);

  /* "colibricore_wrapper.pyx":3300
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()             # <<<<<<<<<<<<<<
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_hist.begin();

  /* "colibricore_wrapper.pyx":3301
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()
 *         while it != hist.end():             # <<<<<<<<<<<<<<
 *             yield deref(it).first, deref(it).second
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_hist.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3302
 *         it = hist.begin()
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).first); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3302, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3303
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3295
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3306
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_86top[] = "Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_amount;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("top (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_amount,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amount)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "top") < 0)) __PYX_ERR(1, 3306, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_amount = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3306, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3306, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3306, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("top", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_86top(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_86top(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size) {
  unsigned int __pyx_v_smallest;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("top", 0);

  /* "colibricore_wrapper.pyx":3309
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)             # <<<<<<<<<<<<<<
 *         return self.filter(smallest, category, size)
 * 
 */
  __pyx_v_smallest = __pyx_v_self->data.topthreshold(__pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* "colibricore_wrapper.pyx":3310
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)
 *         return self.filter(smallest, category, size)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_smallest); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_category); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3310, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3310, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3306
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_90generator59(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3314
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_88filter[] = "Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(1, 3314, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3314, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3314, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3314, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3314, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_88filter(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_88filter(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)__pyx_tp_new_11colibricore___pyx_scope_struct_59_filter(__pyx_ptype_11colibricore___pyx_scope_struct_59_filter, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3314, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_90generator59, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_filter, __pyx_n_s_UnindexedPatternModel_filter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3314, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_90generator59(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3314, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3317
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3319
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3320
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3321
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             inc(it)             # <<<<<<<<<<<<<<
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));

    /* "colibricore_wrapper.pyx":3322
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_category > 0) != 0);
    if (!__pyx_t_3) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_cpattern.category() != __pyx_cur_scope->__pyx_v_category) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size > 0) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size != __pyx_cur_scope->__pyx_v_cpattern.n()) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":3323
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue             # <<<<<<<<<<<<<<
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 */
      goto __pyx_L4_continue;

      /* "colibricore_wrapper.pyx":3322
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    }

    /* "colibricore_wrapper.pyx":3324
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 *             count = self.data.occurrencecount(cpattern)             # <<<<<<<<<<<<<<
 *             if count >= threshold:
 *                 pattern = Pattern()
 */
    __pyx_cur_scope->__pyx_v_count = __pyx_cur_scope->__pyx_v_self->data.occurrencecount(__pyx_cur_scope->__pyx_v_cpattern);

    /* "colibricore_wrapper.pyx":3325
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_count >= __pyx_cur_scope->__pyx_v_threshold) != 0);
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":3326
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 *                 pattern = Pattern()             # <<<<<<<<<<<<<<
 *                 pattern.bind(cpattern)
 *                 yield pattern, count
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":3327
 *             if count >= threshold:
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *                 yield pattern, count
 * 
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":3328
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 *                 yield pattern, count             # <<<<<<<<<<<<<<
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):
 */
      __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L12_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3328, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":3325
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    }
    __pyx_L4_continue:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3314
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3330
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_91getinstance[] = "Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found.";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, 1); __PYX_ERR(1, 3330, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstance") < 0)) __PYX_ERR(1, 3330, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pos = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3330, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(1, 3330, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3330, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_91getinstance(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_pos, __pyx_v_pattern);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstance", 0);

  /* "colibricore_wrapper.pyx":3332
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  __pyx_t_1 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3333
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 *         return self.corpus.getinstance(pos, pattern)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 3333, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3332
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3334
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getdata(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->corpus, __pyx_n_s_getinstance); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3334, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3334, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_pos);
    __Pyx_GIVEREF(__pyx_v_pos);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pos);
    __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3330
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3336
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if pattern in self:
 *             return self.data[pattern.cpattern]
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_getdata(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getdata); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_94getdata)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3337
 * 
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             return self.data[pattern.cpattern]
 *         else:
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 3337, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (likely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":3338
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:
 *             return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3337
 * 
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             return self.data[pattern.cpattern]
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3340
 *             return self.data[pattern.cpattern]
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 3340, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3336
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if pattern in self:
 *             return self.data[pattern.cpattern]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getdata (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3336, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_93getdata(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_93getdata(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("getdata", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_21UnindexedPatternModel_getdata(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_97generator60(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3342
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_96items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_95items[] = "Iterate over all patterns and their occurrence count in this model";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_96items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_95items(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_95items(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_60_items(__pyx_ptype_11colibricore___pyx_scope_struct_60_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3342, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_21UnindexedPatternModel_97generator60, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_UnindexedPatternModel_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3342, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_21UnindexedPatternModel_97generator60(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 3342, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3344
 *     def items(self):
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3347
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3348
 *         cdef unsigned int value
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3349
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3350
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3351
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3352
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3352, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3353
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     cpdef add(self, Pattern pattern, int count=1):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3342
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3355
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_21UnindexedPatternModel_add(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add *__pyx_optional_args) {
  int __pyx_v_count = ((int)1);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_count = __pyx_optional_args->count;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_21UnindexedPatternModel_99add)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3355, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3355, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3355, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3355, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3363
 *         :type count: int
 *         """
 *         self.data[pattern.cpattern] = self.data[pattern.cpattern] + count             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = ((__pyx_v_self->data[__pyx_v_pattern->cpattern]) + __pyx_v_count);

  /* "colibricore_wrapper.pyx":3355
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_21UnindexedPatternModel_98add[] = "Add a pattern to the unindexed model\n    \n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        :param count: The number of occurrences\n        :type count: int\n        ";
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_count;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_count,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 3355, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_count = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3355, __pyx_L3_error)
    } else {
      __pyx_v_count = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3355, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3355, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_98add(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_count);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_98add(struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.count = __pyx_v_count;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_UnindexedPatternModel->add(__pyx_v_self, __pyx_v_pattern, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_101__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_101__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_100__reduce_cython__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_100__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_103__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_21UnindexedPatternModel_103__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_21UnindexedPatternModel_102__setstate_cython__(((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_21UnindexedPatternModel_102__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.UnindexedPatternModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3373
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel___len__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_28OrderedUnindexedPatternModel___len__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":3375
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3373
 *     cdef object corpus
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3377
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_2__bool__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_2__bool__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":3378
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3377
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3380
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_4types(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_4types(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":3382
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3380
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3384
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_6tokens(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_6tokens(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":3386
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3384
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3388
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_8minlength(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_8minlength(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":3390
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3388
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3392
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_10maxlength(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_10maxlength(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":3394
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3392
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3396
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_12type(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_12type(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":3398
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.type()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3396
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.type()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3400
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_14version(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_14version(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":3402
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.version()             # <<<<<<<<<<<<<<
 * 
 *     def occurrencecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3400
 *         return self.data.type()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.version()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3404
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_16occurrencecount[] = "Returns the number of times the specified pattern occurs in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_17occurrencecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("occurrencecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3404, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_16occurrencecount(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_16occurrencecount(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("occurrencecount", 0);

  /* "colibricore_wrapper.pyx":3411
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3412
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3412, __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_ERR(1, 3412, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3411
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3413
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.occurrencecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coveragecount(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.occurrencecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3404
 *         return self.data.version()
 * 
 *     def occurrencecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of times the specified pattern occurs in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.occurrencecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3415
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_18coveragecount[] = "Returns the number of tokens all instances of the specified pattern cover in the training data\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_19coveragecount(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coveragecount (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3415, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_18coveragecount(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_18coveragecount(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coveragecount", 0);

  /* "colibricore_wrapper.pyx":3422
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3423
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3423, __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_ERR(1, 3423, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3422
 *         :rtype: int
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3424
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coveragecount(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def coverage(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.coveragecount(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3415
 *         return self.data.occurrencecount(pattern.cpattern)
 * 
 *     def coveragecount(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.coveragecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3426
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_20coverage[] = "Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_21coverage(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coverage (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3426, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_20coverage(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_20coverage(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coverage", 0);

  /* "colibricore_wrapper.pyx":3433
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3434
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.coverage(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3434, __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_ERR(1, 3434, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3433
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3435
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.coverage(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def frequency(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.coverage(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3426
 *         return self.data.coveragecount(pattern.cpattern)
 * 
 *     def coverage(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the number of tokens all instances of the specified pattern cover in the training data, as a fraction of the total amount of tokens
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3437
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_22frequency[] = "Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: float\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_23frequency(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frequency (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3437, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_22frequency(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_22frequency(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frequency", 0);

  /* "colibricore_wrapper.pyx":3444
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3445
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.frequency(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3445, __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_ERR(1, 3445, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3444
 *         :rtype: float
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3446
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.frequency(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->data.frequency(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3437
 *         return self.data.coverage(pattern.cpattern)
 * 
 *     def frequency(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Returns the frequency of the pattern within its category (ngram/skipgram/flexgram) and exact size class. For a bigram it will thus return the bigram frequency.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3449
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_24totaloccurrencesingroup[] = "Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_25totaloccurrencesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaloccurrencesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaloccurrencesingroup") < 0)) __PYX_ERR(1, 3449, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3449, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3449, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaloccurrencesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3449, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_24totaloccurrencesingroup(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_24totaloccurrencesingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaloccurrencesingroup", 0);

  /* "colibricore_wrapper.pyx":3458
 *         :rtype: int
 *         """
 *         return self.data.totaloccurrencesingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaloccurrencesingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3449
 * 
 * 
 *     def totaloccurrencesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of occurrences in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total occurrence count over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totaloccurrencesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3460
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_26totalpatternsingroup[] = "Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_27totalpatternsingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalpatternsingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalpatternsingroup") < 0)) __PYX_ERR(1, 3460, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3460, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3460, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalpatternsingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3460, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_26totalpatternsingroup(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_26totalpatternsingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalpatternsingroup", 0);

  /* "colibricore_wrapper.pyx":3469
 *         :rtype: int
 *         """
 *         return self.data.totalpatternsingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totalpatternsingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3460
 *         return self.data.totaloccurrencesingroup(category,n)
 * 
 *     def totalpatternsingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of distrinct skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totalpatternsingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3471
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_28totaltokensingroup[] = "Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_29totaltokensingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totaltokensingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totaltokensingroup") < 0)) __PYX_ERR(1, 3471, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3471, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3471, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totaltokensingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3471, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_28totaltokensingroup(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_28totaltokensingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totaltokensingroup", 0);

  /* "colibricore_wrapper.pyx":3480
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3471
 *         return self.data.totalpatternsingroup(category,n)
 * 
 *     def totaltokensingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered tokens in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered tokens over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totaltokensingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3482
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_30totalwordtypesingroup[] = "Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.\n    \n        :param category: The category constraint (Category.NGRAM, Category.SKIPGRAM, Category.FLEXGRAM or 0 for no-constraint, default)\n        :type category: int\n        :param n: The size constraint (0= no constraint, default)\n        :type n: int\n        :rtype: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_31totalwordtypesingroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_category;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("totalwordtypesingroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_category,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "totalwordtypesingroup") < 0)) __PYX_ERR(1, 3482, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3482, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3482, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("totalwordtypesingroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_30totalwordtypesingroup(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_category, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_30totalwordtypesingroup(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_category, int __pyx_v_n) {
  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("totalwordtypesingroup", 0);

  /* "colibricore_wrapper.pyx":3491
 *         :rtype: int
 *         """
 *         return self.data.totaltokensingroup(category,n)             # <<<<<<<<<<<<<<
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.totaltokensingroup(__pyx_v_category, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3482
 *         return self.data.totaltokensingroup(category,n)
 * 
 *     def totalwordtypesingroup(self, int category=0, int n=0):             # <<<<<<<<<<<<<<
 *         """Returns the total number of covered word types (unigram types) in the specified group, within the specified category and/or size class, you can set either to zero (default) to consider all. Example, category=Category.SKIPGRAM and n=0 would consider give the total number of covered word types over all skipgrams.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.totalwordtypesingroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3494
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_has(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":3495
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3496
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3496, __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_ERR(1, 3496, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3495
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":3497
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3494
 *         return self.data.totalwordtypesingroup(category,n)
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3499
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_32__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: bool\n    \n        Example::\n    \n            pattern in patternmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_32__contains__;
#endif
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_33__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_32__contains__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_32__contains__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":3510
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3511
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3511, __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_ERR(1, 3511, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3510
 *             pattern in patternmodel
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3512
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 3512, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3499
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3514
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_34__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_34__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_34__getitem__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_34__getitem__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":3525
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3526
 *         """
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3526, __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_ERR(1, 3526, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3525
 *             occurrences = model[pattern]
 *         """
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3527
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 3527, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3514
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__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_11colibricore_28OrderedUnindexedPatternModel_38generator61(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3531
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_37__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_36__iter__[] = "Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.\n    \n        Example::\n    \n            for pattern in model:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_36__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_37__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_36__iter__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_36__iter__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_61___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_61___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3531, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_38generator61, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_OrderedUnindexedPatternModel___i, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3531, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_38generator61(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 3531, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3540
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3542
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3543
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3544
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3545
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3546
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3546, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3547
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3531
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all patterns in the model. Also consider using the filter() or top() methods if they suit your needs, as they will be faster than doing it manually.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3549
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_39__init__[] = "Initialise a pattern model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A model to be used as a constraint, only patterns occuring in this constraint model will be loaded/trained\n        :type constrainmodel: IndexedPatternModel, UnindexedPatternModel or None (default)\n        :param reverseindex: Corpus data to use as reverse index. On indexed models, this is required for various operations, including computation of skipgrams\n        :type reverseindex: IndexedCorpus or None\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_39__init__;
#endif
static int __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_40__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  PyObject *__pyx_v_reverseindex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,&__pyx_n_s_reverseindex,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reverseindex);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 3549, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
    __pyx_v_reverseindex = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3549, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3549, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3549, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_39__init__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, __pyx_v_reverseindex);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_39__init__(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel, PyObject *__pyx_v_reverseindex) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":3562
 *         """
 * 
 *         self.corpus = None             # <<<<<<<<<<<<<<
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = Py_None;

  /* "colibricore_wrapper.pyx":3563
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reverseindex); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3563, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3564
 *         self.corpus = None
 *         if reverseindex:
 *             self.loadreverseindex(reverseindex)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadreverseindex); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_reverseindex) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_reverseindex);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3564, __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;

    /* "colibricore_wrapper.pyx":3563
 * 
 *         self.corpus = None
 *         if reverseindex:             # <<<<<<<<<<<<<<
 *             self.loadreverseindex(reverseindex)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3566
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3567
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3567, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_1) != 0);
    if (__pyx_t_5) {

      /* "colibricore_wrapper.pyx":3568
 *         if filename:
 *             if not options:
 *                 options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 */
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "colibricore_wrapper.pyx":3567
 * 
 *         if filename:
 *             if not options:             # <<<<<<<<<<<<<<
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 */
    }

    /* "colibricore_wrapper.pyx":3569
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_5 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exists); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = ((!__pyx_t_1) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (unlikely(__pyx_t_5)) {

      /* "colibricore_wrapper.pyx":3570
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *             self.load(filename,options, constrainmodel)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 3570, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":3569
 *             if not options:
 *                 options = PatternModelOptions()
 *             if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)
 */
    }

    /* "colibricore_wrapper.pyx":3571
 *             if filename and not os.path.exists(filename):
 *                 raise FileNotFoundError(filename)
 *             self.load(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3571, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3571, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_options));
      __Pyx_INCREF(__pyx_v_constrainmodel);
      __Pyx_GIVEREF(__pyx_v_constrainmodel);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_constrainmodel);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3566
 *             self.loadreverseindex(reverseindex)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             if not options:
 *                 options = PatternModelOptions()
 */
  }

  /* "colibricore_wrapper.pyx":3549
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None, constrainmodel = None, reverseindex = None):             # <<<<<<<<<<<<<<
 *         """Initialise a pattern model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3573
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_41load[] = "Load a patternmodel from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri patternmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_42load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 3573, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3573, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3573, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3573, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_41load(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_41load(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":3581
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_options)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3581, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":3582
 *         """
 *         if not options:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 * 
 *         if filename and not os.path.exists(filename):
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":3581
 *         :type options: PatternModelOptions
 *         """
 *         if not options:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3584
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":3585
 * 
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 3585, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3584
 *             options = PatternModelOptions()
 * 
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3587
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":3588
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 3588, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3587
 *             raise FileNotFoundError(filename)
 * 
 *         if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3589
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_2 = (__pyx_t_6 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":3590
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 3590, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3589
 *         if isinstance(constrainmodel, IndexedPatternModel):
 *             self.loadconstrainedbyindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3591
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "colibricore_wrapper.pyx":3592
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)
 */
    if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 3592, __pyx_L1_error)
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3591
 *         elif isinstance(constrainmodel, UnindexedPatternModel):
 *             self.loadconstrainedbyunindexedmodel(filename,options, constrainmodel)
 *         elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 */
    goto __pyx_L7;
  }

  /* "colibricore_wrapper.pyx":3594
 *             self.loadconstrainedbysetmodel(filename,options, constrainmodel)
 *         else:
 *             self.data.load(encode(filename), options.coptions, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3594, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    try {
      __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, NULL);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
      __PYX_ERR(1, 3594, __pyx_L1_error)
    }
  }
  __pyx_L7:;

  /* "colibricore_wrapper.pyx":3573
 *             self.load(filename,options, constrainmodel)
 * 
 *     def load(self, str filename, PatternModelOptions options=None, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Load a patternmodel from file.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3596
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_44loadreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_reverseindex) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadreverseindex (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseindex), __pyx_ptype_11colibricore_IndexedCorpus, 1, "reverseindex", 0))) __PYX_ERR(1, 3596, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_43loadreverseindex(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_reverseindex));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_43loadreverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_reverseindex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  IndexedCorpus *__pyx_t_1;
  __Pyx_RefNannySetupContext("loadreverseindex", 0);

  /* "colibricore_wrapper.pyx":3597
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data             # <<<<<<<<<<<<<<
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 * 
 */
  __pyx_t_1 = __pyx_v_reverseindex->data;
  __pyx_v_self->data.reverseindex = __pyx_t_1;

  /* "colibricore_wrapper.pyx":3598
 *     def loadreverseindex(self, IndexedCorpus reverseindex):
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reverseindex));
  __Pyx_GOTREF(__pyx_v_self->corpus);
  __Pyx_DECREF(__pyx_v_self->corpus);
  __pyx_v_self->corpus = ((PyObject *)__pyx_v_reverseindex);

  /* "colibricore_wrapper.pyx":3596
 *             self.data.load(encode(filename), options.coptions, NULL)
 * 
 *     def loadreverseindex(self, IndexedCorpus reverseindex):             # <<<<<<<<<<<<<<
 *         self.data.reverseindex = reverseindex.data
 *         self.corpus = reverseindex #so python doesn't garbage collect the python object
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3601
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_46loadconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3601, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3601, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3602
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3602, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3601
 * 
 * 
 *     cpdef loadconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_46loadconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3601, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3601, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 3601, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3601, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3601, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3601, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3601, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_45loadconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_45loadconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3604
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_48loadconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3604, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3604, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3605
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3605, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3604
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_48loadconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3604, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3604, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 3604, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3604, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3604, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3604, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3604, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_47loadconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_47loadconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3607
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadconstrainedbysetmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_50loadconstrainedbysetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3607, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3607, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3608
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3608, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3607
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     cpdef loadconstrainedbysetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_50loadconstrainedbysetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("loadconstrainedbysetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 1); __PYX_ERR(1, 3607, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, 2); __PYX_ERR(1, 3607, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadconstrainedbysetmodel") < 0)) __PYX_ERR(1, 3607, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("loadconstrainedbysetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3607, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3607, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3607, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3607, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_49loadconstrainedbysetmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_49loadconstrainedbysetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("loadconstrainedbysetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbysetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.loadconstrainedbysetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3610
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_51read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_52read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 3610, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3610, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3610, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3610, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_51read(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_51read(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":3612
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":3610
 *         self.data.load(encode(filename),options.coptions,  constrainmodel.getinterface())
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3614
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_write(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_54write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3614, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3620
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 3620, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3614
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write a patternmodel to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_53write[] = "Write a patternmodel to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_54write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3614, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_53write(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_53write(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3622
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_56printmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_decoder)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_decoder));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3622, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3628
 *         :type decoder: ClassDecoder
 *         """
 *         self.data.printmodel(&cout, decoder.data )             # <<<<<<<<<<<<<<
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):
 */
  __pyx_v_self->data.printmodel((&std::cout), __pyx_v_decoder->data);

  /* "colibricore_wrapper.pyx":3622
 *         self.data.write(encode(filename))
 * 
 *     cpdef printmodel(self,ClassDecoder decoder):             # <<<<<<<<<<<<<<
 *         """Print the entire pattern model to stdout, a detailed overview
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_55printmodel[] = "Print the entire pattern model to stdout, a detailed overview\n    \n        :param decoder: The class decoder\n        :type decoder: ClassDecoder\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_56printmodel(PyObject *__pyx_v_self, PyObject *__pyx_v_decoder) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printmodel (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_decoder), __pyx_ptype_11colibricore_ClassDecoder, 1, "decoder", 0))) __PYX_ERR(1, 3622, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_55printmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_ClassDecoder *)__pyx_v_decoder));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_55printmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_ClassDecoder *__pyx_v_decoder) {
  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("printmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_printmodel(__pyx_v_self, __pyx_v_decoder, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.printmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3630
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train *__pyx_optional_args) {
  PyObject *__pyx_v_constrainmodel = ((PyObject *)Py_None);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  std::string __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_constrainmodel = __pyx_optional_args->constrainmodel;
    }
  }
  __Pyx_INCREF(__pyx_v_filename);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3630, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_58train)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3630, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), __pyx_v_constrainmodel};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3630, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3630, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(__pyx_v_constrainmodel);
          __Pyx_GIVEREF(__pyx_v_constrainmodel);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_constrainmodel);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3630, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3641
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex != NULL) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3642
 * 
 *         if self.data.reverseindex != NULL:
 *             filename = ""             # <<<<<<<<<<<<<<
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 */
    __Pyx_INCREF(__pyx_kp_u_);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_kp_u_);

    /* "colibricore_wrapper.pyx":3641
 *         """
 * 
 *         if self.data.reverseindex != NULL:             # <<<<<<<<<<<<<<
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 */
  }

  /* "colibricore_wrapper.pyx":3643
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_11colibricore_IndexedPatternModel); 
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_9 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_options), __pyx_n_s_DOSKIPGRAMS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 3643, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_t_9;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3644
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3644, __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_ERR(1, 3644, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3643
 *         if self.data.reverseindex != NULL:
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3647
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_constrainmodel); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 3647, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3648
 * 
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0             # <<<<<<<<<<<<<<
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = PyObject_Length(__pyx_v_constrainmodel); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3648, __pyx_L1_error)
      if (unlikely(!((__pyx_t_10 >= 0) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(1, 3648, __pyx_L1_error)
      }
    }
    #endif

    /* "colibricore_wrapper.pyx":3649
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":3650
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_IndexedPatternModel))))) __PYX_ERR(1, 3650, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3649
 *         if constrainmodel:
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3651
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (__pyx_t_7) {

      /* "colibricore_wrapper.pyx":3652
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_UnindexedPatternModel))))) __PYX_ERR(1, 3652, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3651
 *             if isinstance(constrainmodel, IndexedPatternModel):
 *                 self.trainconstrainedbyindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, UnindexedPatternModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3653
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel); 
    __pyx_t_9 = (__pyx_t_7 != 0);
    if (__pyx_t_9) {

      /* "colibricore_wrapper.pyx":3654
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternSetModel))))) __PYX_ERR(1, 3654, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternSetModel *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3654, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3653
 *             elif isinstance(constrainmodel, UnindexedPatternModel):
 *                 self.trainconstrainedbyunindexedmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternSetModel):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3655
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float); 
    __pyx_t_7 = (__pyx_t_9 != 0);
    if (likely(__pyx_t_7)) {

      /* "colibricore_wrapper.pyx":3656
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 */
      if (!(likely(((__pyx_v_constrainmodel) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_constrainmodel, __pyx_ptype_11colibricore_PatternAlignmentModel_float))))) __PYX_ERR(1, 3656, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self->__pyx_vtab)->trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "colibricore_wrapper.pyx":3655
 *             elif isinstance(constrainmodel, PatternSetModel):
 *                 self.trainconstrainedbypatternsetmodel(filename, options, constrainmodel)
 *             elif isinstance(constrainmodel, PatternAlignmentModel_float):             # <<<<<<<<<<<<<<
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "colibricore_wrapper.pyx":3658
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage             # <<<<<<<<<<<<<<
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3658, __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_ERR(1, 3658, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "colibricore_wrapper.pyx":3647
 * 
 * 
 *         if constrainmodel:             # <<<<<<<<<<<<<<
 *             assert len(constrainmodel) >= 0
 *             if isinstance(constrainmodel, IndexedPatternModel):
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":3659
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3660
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_11), __pyx_v_options->coptions, NULL, NULL);

    /* "colibricore_wrapper.pyx":3659
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage
 *         elif filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L8;
  }

  /* "colibricore_wrapper.pyx":3661
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3662
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3662, __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_ERR(1, 3662, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3661
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3664
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, NULL);
  }
  __pyx_L8:;

  /* "colibricore_wrapper.pyx":3630
 *         self.data.printmodel(&cout, decoder.data )
 * 
 *     cpdef train(self, str filename, PatternModelOptions options, constrainmodel = None):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_57train[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param constrainmodel: A patternmodel or patternsetmodel to constrain training (default None)\n        :type constrainmodel: None, UnindexedPatternModel, IndexedPatternModel, PatternSetModel\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_58train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  PyObject *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, 1); __PYX_ERR(1, 3630, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) __PYX_ERR(1, 3630, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3630, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3630, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3630, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_57train(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_57train(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, PyObject *__pyx_v_constrainmodel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.constrainmodel = __pyx_v_constrainmodel;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel->train(__pyx_v_self, __pyx_v_filename, __pyx_v_options, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3666
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train_filtered(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset, int __pyx_skip_dispatch) {
  PatternSet<unsigned int>  *__pyx_v_cfilterset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("train_filtered", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_train_filtered); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_60train_filtered)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3666, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_filterset)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3666, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_filterset));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_filterset));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_filterset));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3675
 *         :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).
 *         """
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)             # <<<<<<<<<<<<<<
 * 
 *         if filename:
 */
  __pyx_v_cfilterset = (&__pyx_v_filterset->data);

  /* "colibricore_wrapper.pyx":3677
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3678
 * 
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);

    /* "colibricore_wrapper.pyx":3677
 *         cdef cPatternSet[uint] * cfilterset = address(filterset.data)
 * 
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3679
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3680
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3680, __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_ERR(1, 3680, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3679
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, cfilterset)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3682
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, cfilterset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, NULL, __pyx_v_cfilterset);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3666
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 * 
 *     cpdef train_filtered(self, str filename, PatternModelOptions options, PatternSet filterset):             # <<<<<<<<<<<<<<
 *         """Train the patternmodel on the specified corpus data (a *.colibri.dat file)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_59train_filtered[] = "Train the patternmodel on the specified corpus data (a *.colibri.dat file)\n    \n        :param filename: The name of the file to load, must be a valid colibri.dat file. Can be set to an empty string if a corpus was pre-loaded already.\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        :param filterset: An instance of PatternSet. A limited set of skipgrams/flexgrams to use as a filter, patterns will only be included if they are an instance of a skipgram in this list (i.e. disjunctive). Ngrams can also be included as filters, if a pattern subsumes one of the ngrams in the filter, it counts as a match (or if it matches it exactly).\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_60train_filtered(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("train_filtered (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_filterset,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 1); __PYX_ERR(1, 3666, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, 2); __PYX_ERR(1, 3666, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_filtered") < 0)) __PYX_ERR(1, 3666, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_filterset = ((struct __pyx_obj_11colibricore_PatternSet *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("train_filtered", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3666, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3666, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3666, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filterset), __pyx_ptype_11colibricore_PatternSet, 1, "filterset", 0))) __PYX_ERR(1, 3666, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_59train_filtered(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_filterset);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_59train_filtered(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSet *__pyx_v_filterset) {
  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("train_filtered", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_train_filtered(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_filterset, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.train_filtered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3685
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getinterface(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":3686
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3685
 * 
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3688
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_62trainconstrainedbyindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3688, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3688, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3688, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3688, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3689
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3690
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3690, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3689
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3691
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3692
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3692, __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_ERR(1, 3692, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3691
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3694
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_IndexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3688
 *         return self.data.getinterface()
 * 
 *     cpdef trainconstrainedbyindexedmodel(self, str filename, PatternModelOptions options, IndexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_62trainconstrainedbyindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3688, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3688, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyindexedmodel") < 0)) __PYX_ERR(1, 3688, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3688, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3688, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3688, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_IndexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3688, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_61trainconstrainedbyindexedmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_61trainconstrainedbyindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_IndexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3696
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyunindexedmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_64trainconstrainedbyunindexedmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3696, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3696, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3697
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3698
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3697
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3699
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3700
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3700, __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_ERR(1, 3700, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3699
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3702
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3696
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyunindexedmodel(self, str filename, PatternModelOptions options, UnindexedPatternModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_64trainconstrainedbyunindexedmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyunindexedmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 1); __PYX_ERR(1, 3696, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, 2); __PYX_ERR(1, 3696, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyunindexedmodel") < 0)) __PYX_ERR(1, 3696, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyunindexedmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3696, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3696, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3696, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_UnindexedPatternModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3696, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_63trainconstrainedbyunindexedmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_63trainconstrainedbyunindexedmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_UnindexedPatternModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbyunindexedmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyunindexedmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyunindexedmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3704
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbypatternsetmode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_66trainconstrainedbypatternsetmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3704, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3704, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3704, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3704, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3705
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3706
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3706, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3705
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3707
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3708
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3708, __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_ERR(1, 3708, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3707
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3710
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternSetModel *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3704
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbypatternsetmodel(self, str filename, PatternModelOptions options, PatternSetModel constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_66trainconstrainedbypatternsetmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbypatternsetmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 1); __PYX_ERR(1, 3704, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, 2); __PYX_ERR(1, 3704, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbypatternsetmodel") < 0)) __PYX_ERR(1, 3704, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternSetModel *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbypatternsetmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3704, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3704, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3704, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternSetModel, 1, "constrainmodel", 0))) __PYX_ERR(1, 3704, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_65trainconstrainedbypatternsetmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_65trainconstrainedbypatternsetmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternSetModel *__pyx_v_constrainmodel) {
  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("trainconstrainedbypatternsetmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbypatternsetmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbypatternsetmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3712
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trainconstrainedbyalignmodel); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_68trainconstrainedbyalignmodel)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3712, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options), ((PyObject *)__pyx_v_constrainmodel)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3712, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3712, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_filename);
          __Pyx_GIVEREF(__pyx_v_filename);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
          __Pyx_INCREF(((PyObject *)__pyx_v_options));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
          __Pyx_INCREF(((PyObject *)__pyx_v_constrainmodel));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_constrainmodel));
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, ((PyObject *)__pyx_v_constrainmodel));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3712, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3713
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
  __pyx_t_7 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_7) {

    /* "colibricore_wrapper.pyx":3714
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3714, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->data.train(((std::string)__pyx_t_8), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);

    /* "colibricore_wrapper.pyx":3713
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3715
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "colibricore_wrapper.pyx":3716
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3716, __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_ERR(1, 3716, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3715
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 *         elif self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3718
 *             raise ValueError("No filename or reverseindex specified!")
 *         else:
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)             # <<<<<<<<<<<<<<
 * 
 *     cpdef report(self):
 */
  /*else*/ {
    __pyx_v_self->data.train(((std::istream *)NULL), __pyx_v_options->coptions, ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_constrainmodel->__pyx_vtab)->getinterface(__pyx_v_constrainmodel), NULL);
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3712
 *             self.data.train(<istream*> NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef trainconstrainedbyalignmodel(self, str filename, PatternModelOptions options, PatternAlignmentModel_float constrainmodel):             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.train(<string> encode(filename),options.coptions,  constrainmodel.getinterface(), NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_68trainconstrainedbyalignmodel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trainconstrainedbyalignmodel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,&__pyx_n_s_constrainmodel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 1); __PYX_ERR(1, 3712, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constrainmodel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, 2); __PYX_ERR(1, 3712, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trainconstrainedbyalignmodel") < 0)) __PYX_ERR(1, 3712, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
    __pyx_v_constrainmodel = ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trainconstrainedbyalignmodel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3712, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 3712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constrainmodel), __pyx_ptype_11colibricore_PatternAlignmentModel_float, 1, "constrainmodel", 0))) __PYX_ERR(1, 3712, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_67trainconstrainedbyalignmodel(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_67trainconstrainedbyalignmodel(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_constrainmodel) {
  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("trainconstrainedbyalignmodel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyalignmodel(__pyx_v_self, __pyx_v_filename, __pyx_v_options, __pyx_v_constrainmodel, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.trainconstrainedbyalignmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3720
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_report(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_report); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_70report)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3722
 *     cpdef report(self):
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)             # <<<<<<<<<<<<<<
 * 
 *     cpdef printhistogram(self):
 */
  __pyx_v_self->data.report((&std::cout));

  /* "colibricore_wrapper.pyx":3720
 *             self.data.train(<istream*>  NULL,options.coptions,  constrainmodel.getinterface(), NULL)
 * 
 *     cpdef report(self):             # <<<<<<<<<<<<<<
 *         """Print a detailed statistical report to stdout"""
 *         self.data.report(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_69report[] = "Print a detailed statistical report to stdout";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_70report(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("report (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_69report(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_69report(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("report", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_report(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.report", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3724
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printhistogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_printhistogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_72printhistogram)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3726
 *     cpdef printhistogram(self):
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.histogram((&std::cout));

  /* "colibricore_wrapper.pyx":3724
 *         self.data.report(&cout)
 * 
 *     cpdef printhistogram(self):             # <<<<<<<<<<<<<<
 *         """Print a histogram to stdout"""
 *         self.data.histogram(&cout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_71printhistogram[] = "Print a histogram to stdout";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_72printhistogram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("printhistogram (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_71printhistogram(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_71printhistogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("printhistogram", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_printhistogram(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.printhistogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3730
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_prune(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune *__pyx_optional_args) {
  int __pyx_v_n = ((int)0);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_n = __pyx_optional_args->n;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prune); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_74prune)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3730, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3730, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3730, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3730, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3730, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3730, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3738
 *         :type n: int
 *         """
 *         self.data.prune(threshold, n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (void)(__pyx_v_self->data.prune(__pyx_v_threshold, __pyx_v_n));

  /* "colibricore_wrapper.pyx":3730
 * 
 * 
 *     cpdef prune(self, int threshold, int n=0):             # <<<<<<<<<<<<<<
 *         """Prune all patterns occurring below the threshold.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_73prune[] = "Prune all patterns occurring below the threshold.\n    \n        :param threshold: the threshold value (minimum number of occurrences)\n        :type threshold: int\n        :param n: prune only patterns of the specified size, use 0 (default) for no size limitation\n        :type n: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_74prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_threshold;
  int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prune (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(1, 3730, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3730, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3730, __pyx_L3_error)
    } else {
      __pyx_v_n = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prune", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3730, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_73prune(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_73prune(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_threshold, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.n = __pyx_v_n;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel->prune(__pyx_v_self, __pyx_v_threshold, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3741
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_75reverseindex[] = "Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index.";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_76reverseindex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_75reverseindex(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_75reverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reverseindex", 0);

  /* "colibricore_wrapper.pyx":3743
 *     def reverseindex(self):
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->corpus);
  __pyx_r = __pyx_v_self->corpus;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3741
 * 
 * 
 *     def reverseindex(self):             # <<<<<<<<<<<<<<
 *         """Returns the reverseindex associated with the model, this will be an instance of IndexedCorpus. Use getreverseindex( (sentence, token) ) instead if you want to query the reverse index."""
 *         return self.corpus
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_79generator62(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3746
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_77getreverseindex[] = "Generator over all patterns occurring at the specified index reference\n    \n        :param indexreference: a (sentence, tokenoffset) tuple\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_78getreverseindex(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_77getreverseindex(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v_indexreference));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_77getreverseindex(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)__pyx_tp_new_11colibricore___pyx_scope_struct_62_getreverseindex(__pyx_ptype_11colibricore___pyx_scope_struct_62_getreverseindex, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3746, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_indexreference = __pyx_v_indexreference;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_indexreference);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_indexreference);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_79generator62, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex, __pyx_n_s_OrderedUnindexedPatternModel_get, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_79generator62(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3746, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3752
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_cur_scope->__pyx_v_indexreference); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_indexreference); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3752, __pyx_L1_error)
  __pyx_t_3 = ((!((__pyx_t_4 == 2) != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3753
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 3753, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3752
 *         """
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 */
  }

  /* "colibricore_wrapper.pyx":3754
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3755
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef int sentence = indexreference[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 3755, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3754
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3757
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef int sentence = indexreference[0]             # <<<<<<<<<<<<<<
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3757, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_sentence = __pyx_t_6;

  /* "colibricore_wrapper.pyx":3758
 * 
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_indexreference, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_token = __pyx_t_6;

  /* "colibricore_wrapper.pyx":3759
 *         cdef int sentence = indexreference[0]
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 */
  __pyx_cur_scope->__pyx_v_ref = IndexReference(__pyx_cur_scope->__pyx_v_sentence, __pyx_cur_scope->__pyx_v_token);

  /* "colibricore_wrapper.pyx":3760
 *         cdef int token = indexreference[1]
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)             # <<<<<<<<<<<<<<
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex(__pyx_cur_scope->__pyx_v_ref);

  /* "colibricore_wrapper.pyx":3761
 *         cdef cIndexReference ref = cIndexReference(sentence, token)
 *         cdef unordered_set[cPatternPointer] results = self.data.getreverseindex(ref)
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while resit != results.end():
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":3763
 *         cdef unordered_set[cPatternPointer].iterator resit = results.begin()
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3764
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_resit).pattern();

    /* "colibricore_wrapper.pyx":3765
 *         while resit != results.end():
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":3766
 *             cpattern = deref(resit).pattern()
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(resit)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "colibricore_wrapper.pyx":3767
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L10_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3767, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3768
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 *     def getreverseindex_bysentence(self, int sentence):
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3746
 * 
 * 
 *     def getreverseindex(self, indexreference):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring at the specified index reference
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("getreverseindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_82generator63(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3770
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_80getreverseindex_bysentence[] = "Generator over all patterns occurring in the specified sentence\n    \n        :param sentence: a sentence number\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_81getreverseindex_bysentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence) {
  int __pyx_v_sentence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence (wrapper)", 0);
  assert(__pyx_arg_sentence); {
    __pyx_v_sentence = __Pyx_PyInt_As_int(__pyx_arg_sentence); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3770, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_80getreverseindex_bysentence(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((int)__pyx_v_sentence));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_80getreverseindex_bysentence(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_sentence) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)__pyx_tp_new_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence(__pyx_ptype_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3770, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sentence = __pyx_v_sentence;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_82generator63, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_getreverseindex_bysentence, __pyx_n_s_OrderedUnindexedPatternModel_get_2, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3770, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_82generator63(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getreverseindex_bysentence", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3770, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3776
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3777
 * 
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 3777, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3776
 *         """
 * 
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":3779
 *             raise ValueError("No reverse index loaded")
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)             # <<<<<<<<<<<<<<
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()
 *         cdef pair[cIndexReference,cPatternPointer] p
 */
  __pyx_cur_scope->__pyx_v_results = __pyx_cur_scope->__pyx_v_self->data.getreverseindex_bysentence(__pyx_cur_scope->__pyx_v_sentence);

  /* "colibricore_wrapper.pyx":3780
 * 
 *         cdef vector[pair[cIndexReference,cPatternPointer]] results = self.data.getreverseindex_bysentence(sentence)
 *         cdef vector[pair[cIndexReference,cPatternPointer]].iterator resit = results.begin()             # <<<<<<<<<<<<<<
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_resit = __pyx_cur_scope->__pyx_v_results.begin();

  /* "colibricore_wrapper.pyx":3783
 *         cdef pair[cIndexReference,cPatternPointer] p
 *         cdef cPattern cpattern
 *         while resit != results.end():             # <<<<<<<<<<<<<<
 *             p = deref(resit)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_resit != __pyx_cur_scope->__pyx_v_results.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3784
 *         cdef cPattern cpattern
 *         while resit != results.end():
 *             p = deref(resit)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 */
    __pyx_cur_scope->__pyx_v_p = (*__pyx_cur_scope->__pyx_v_resit);

    /* "colibricore_wrapper.pyx":3785
 *         while resit != results.end():
 *             p = deref(resit)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":3786
 *             p = deref(resit)
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 */
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_cur_scope->__pyx_v_p.second.pattern();

    /* "colibricore_wrapper.pyx":3787
 *             pattern = Pattern()
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":3788
 *             cpattern = p.second.pattern()
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern             # <<<<<<<<<<<<<<
 *             inc(resit)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_p.first.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_p.first.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3788, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3789
 *             pattern.bind(cpattern)
 *             yield (p.first.sentence, p.first.token), pattern
 *             inc(resit)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_resit));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3770
 *             inc(resit)
 * 
 *     def getreverseindex_bysentence(self, int sentence):             # <<<<<<<<<<<<<<
 *         """Generator over all patterns occurring in the specified sentence
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("getreverseindex_bysentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_85generator64(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3792
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_83histogram[] = "Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_84histogram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  unsigned int __pyx_v_cap;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_cap,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cap);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histogram") < 0)) __PYX_ERR(1, 3792, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3792, __pyx_L3_error)
    } else {
      __pyx_v_threshold = ((unsigned int)0);
    }
    if (values[1]) {
      __pyx_v_cap = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_cap == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3792, __pyx_L3_error)
    } else {
      __pyx_v_cap = ((unsigned int)0);
    }
    if (values[2]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3792, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[3]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3792, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("histogram", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3792, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_83histogram(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_cap, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_83histogram(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, unsigned int __pyx_v_cap, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("histogram", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)__pyx_tp_new_11colibricore___pyx_scope_struct_64_histogram(__pyx_ptype_11colibricore___pyx_scope_struct_64_histogram, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3792, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_cap = __pyx_v_cap;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_85generator64, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_histogram, __pyx_n_s_OrderedUnindexedPatternModel_his, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3792, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_85generator64(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("histogram", 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_ERR(1, 3792, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3796
 *         cdef stdmap[unsigned int,unsigned int] hist
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)             # <<<<<<<<<<<<<<
 *         it = hist.begin()
 *         while it != hist.end():
 */
  __pyx_cur_scope->__pyx_v_self->data.histogram(__pyx_cur_scope->__pyx_v_hist, __pyx_cur_scope->__pyx_v_threshold, __pyx_cur_scope->__pyx_v_cap, __pyx_cur_scope->__pyx_v_category, __pyx_cur_scope->__pyx_v_size);

  /* "colibricore_wrapper.pyx":3797
 *         cdef stdmap[unsigned int,unsigned int].iterator it
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()             # <<<<<<<<<<<<<<
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_hist.begin();

  /* "colibricore_wrapper.pyx":3798
 *         self.data.histogram(hist,threshold,cap, category, size)
 *         it = hist.begin()
 *         while it != hist.end():             # <<<<<<<<<<<<<<
 *             yield deref(it).first, deref(it).second
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_hist.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3799
 *         it = hist.begin()
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).first); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_unsigned_int((*__pyx_cur_scope->__pyx_v_it).second); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3799, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3800
 *         while it != hist.end():
 *             yield deref(it).first, deref(it).second
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3792
 * 
 * 
 *     def histogram(self, unsigned int threshold=0, unsigned int cap=0, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over a histogram of occurrence count data, produces (occurrencecount, frequency) tuples. A minimum threshold may be configured, or a cap on total number of occurrences may be specified (to get only the top occurrences). The histogram can be constrained by category and/or pattern size (if set to >0 values)"""
 *         cdef stdmap[unsigned int,unsigned int] hist
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("histogram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3803
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_86top[] = "Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_87top(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_amount;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("top (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_amount,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amount)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "top") < 0)) __PYX_ERR(1, 3803, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_amount = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3803, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3803, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3803, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("top", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3803, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_86top(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_86top(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, int __pyx_v_amount, int __pyx_v_category, unsigned int __pyx_v_size) {
  unsigned int __pyx_v_smallest;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("top", 0);

  /* "colibricore_wrapper.pyx":3806
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)             # <<<<<<<<<<<<<<
 *         return self.filter(smallest, category, size)
 * 
 */
  __pyx_v_smallest = __pyx_v_self->data.topthreshold(__pyx_v_amount, __pyx_v_category, __pyx_v_size);

  /* "colibricore_wrapper.pyx":3807
 * 
 *         cdef unsigned int smallest = self.data.topthreshold(amount, category, size)
 *         return self.filter(smallest, category, size)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_smallest); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_category); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3807, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3807, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3803
 * 
 * 
 *     def top(self, int amount, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over the top [amount] most occurring patterns (of specified category and size if set to values above 0). This is faster than iterating manually! Will return (pattern, occurrencecount) tuples (unsorted). Note that this may return less than the specified amount of patterns if there are multiple patterns with the same occurrence count in its tail. """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.top", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_90generator65(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3811
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_88filter[] = "Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_89filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_threshold;
  int __pyx_v_category;
  unsigned int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_threshold,&__pyx_n_s_category,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_category);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(1, 3811, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_threshold = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3811, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_category = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_category == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3811, __pyx_L3_error)
    } else {
      __pyx_v_category = ((int)0);
    }
    if (values[2]) {
      __pyx_v_size = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3811, __pyx_L3_error)
    } else {
      __pyx_v_size = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3811, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_88filter(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_threshold, __pyx_v_category, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_88filter(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, unsigned int __pyx_v_threshold, int __pyx_v_category, unsigned int __pyx_v_size) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)__pyx_tp_new_11colibricore___pyx_scope_struct_65_filter(__pyx_ptype_11colibricore___pyx_scope_struct_65_filter, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3811, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __pyx_cur_scope->__pyx_v_category = __pyx_v_category;
  __pyx_cur_scope->__pyx_v_size = __pyx_v_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_90generator65, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_filter, __pyx_n_s_OrderedUnindexedPatternModel_fil, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3811, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_90generator65(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3811, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3814
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3816
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3817
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3818
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             inc(it)             # <<<<<<<<<<<<<<
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));

    /* "colibricore_wrapper.pyx":3819
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_category > 0) != 0);
    if (!__pyx_t_3) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_cpattern.category() != __pyx_cur_scope->__pyx_v_category) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size > 0) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_size != __pyx_cur_scope->__pyx_v_cpattern.n()) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":3820
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue             # <<<<<<<<<<<<<<
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 */
      goto __pyx_L4_continue;

      /* "colibricore_wrapper.pyx":3819
 *             cpattern = deref(it).first
 *             inc(it)
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):             # <<<<<<<<<<<<<<
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 */
    }

    /* "colibricore_wrapper.pyx":3821
 *             if ((category > 0) and (cpattern.category() != category)) or (size > 0) and (size != cpattern.n()):
 *                 continue
 *             count = self.data.occurrencecount(cpattern)             # <<<<<<<<<<<<<<
 *             if count >= threshold:
 *                 pattern = Pattern()
 */
    __pyx_cur_scope->__pyx_v_count = __pyx_cur_scope->__pyx_v_self->data.occurrencecount(__pyx_cur_scope->__pyx_v_cpattern);

    /* "colibricore_wrapper.pyx":3822
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_count >= __pyx_cur_scope->__pyx_v_threshold) != 0);
    if (__pyx_t_1) {

      /* "colibricore_wrapper.pyx":3823
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:
 *                 pattern = Pattern()             # <<<<<<<<<<<<<<
 *                 pattern.bind(cpattern)
 *                 yield pattern, count
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":3824
 *             if count >= threshold:
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *                 yield pattern, count
 * 
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3824, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":3825
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 *                 yield pattern, count             # <<<<<<<<<<<<<<
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):
 */
      __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3825, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3825, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L12_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3825, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":3822
 *                 continue
 *             count = self.data.occurrencecount(cpattern)
 *             if count >= threshold:             # <<<<<<<<<<<<<<
 *                 pattern = Pattern()
 *                 pattern.bind(cpattern)
 */
    }
    __pyx_L4_continue:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3811
 * 
 * 
 *     def filter(self, unsigned int threshold, int category = 0, unsigned int size = 0):             # <<<<<<<<<<<<<<
 *         """Generator over patterns occurring over the set occurrence threshold (and of specified category and size if set to values above 0). This is faster than iterating and filtering manually! Will return (pattern, occurrencecount) tuples (unsorted)"""
 *         cdef long unsigned int count
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3827
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_91getinstance[] = "Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found.";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_92getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, 1); __PYX_ERR(1, 3827, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstance") < 0)) __PYX_ERR(1, 3827, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pos = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3827, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(1, 3827, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3827, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_91getinstance(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_pos, __pyx_v_pattern);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_91getinstance(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getinstance", 0);

  /* "colibricore_wrapper.pyx":3829
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  __pyx_t_1 = ((__pyx_v_self->data.reverseindex == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3830
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 *         return self.corpus.getinstance(pos, pattern)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 3830, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3829
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)
 */
  }

  /* "colibricore_wrapper.pyx":3831
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 *         return self.corpus.getinstance(pos, pattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getdata(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->corpus, __pyx_n_s_getinstance); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3831, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, ((PyObject *)__pyx_v_pattern)};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3831, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_pos);
    __Pyx_GIVEREF(__pyx_v_pos);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pos);
    __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":3827
 *                 yield pattern, count
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         if self.data.reverseindex == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3833
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if pattern in self:
 *             return self.data[pattern.cpattern]
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getdata(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getdata); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_94getdata)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_pattern)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pattern));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3833, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3834
 * 
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             return self.data[pattern.cpattern]
 *         else:
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 3834, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (likely(__pyx_t_6)) {

    /* "colibricore_wrapper.pyx":3835
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:
 *             return self.data[pattern.cpattern]             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->data[__pyx_v_pattern->cpattern])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3834
 * 
 *     cpdef getdata(self, Pattern pattern):
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             return self.data[pattern.cpattern]
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3837
 *             return self.data[pattern.cpattern]
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 3837, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3833
 *         return self.corpus.getinstance(pos, pattern)
 * 
 *     cpdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if pattern in self:
 *             return self.data[pattern.cpattern]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_94getdata(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getdata (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3833, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_93getdata(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_93getdata(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("getdata", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_28OrderedUnindexedPatternModel_getdata(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_97generator66(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":3839
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_96items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_95items[] = "Iterate over all patterns and their occurrence count in this model";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_96items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_95items(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_95items(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_66_items(__pyx_ptype_11colibricore___pyx_scope_struct_66_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 3839, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_28OrderedUnindexedPatternModel_97generator66, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_OrderedUnindexedPatternModel_ite, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 3839, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_28OrderedUnindexedPatternModel_97generator66(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 3839, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":3841
 *     def items(self):
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":3844
 *         cdef cPattern cpattern
 *         cdef unsigned int value
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             value = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":3845
 *         cdef unsigned int value
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             value = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3846
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             value = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_value = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3847
 *             cpattern = deref(it).first
 *             value = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3848
 *             value = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield (pattern,value)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":3849
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield (pattern,value)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 3849, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":3850
 *             pattern.bind(cpattern)
 *             yield (pattern,value)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     cpdef add(self, Pattern pattern, int count=1):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":3839
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and their occurrence count in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3852
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_28OrderedUnindexedPatternModel_add(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add *__pyx_optional_args) {
  int __pyx_v_count = ((int)1);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_count = __pyx_optional_args->count;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3852, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_99add)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3852, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3852, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_pattern), __pyx_t_3};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3852, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":3860
 *         :type count: int
 *         """
 *         self.data[pattern.cpattern] = self.data[pattern.cpattern] + count             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternModelOptions:
 */
  (__pyx_v_self->data[__pyx_v_pattern->cpattern]) = ((__pyx_v_self->data[__pyx_v_pattern->cpattern]) + __pyx_v_count);

  /* "colibricore_wrapper.pyx":3852
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, int count=1):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_98add[] = "Add a pattern to the unindexed model\n    \n        :param pattern: The pattern to add\n        :type pattern: Pattern\n        :param count: The number of occurrences\n        :type count: int\n        ";
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_99add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_count;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_count,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 3852, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_count = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3852, __pyx_L3_error)
    } else {
      __pyx_v_count = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3852, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 3852, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_98add(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_count);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_98add(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.count = __pyx_v_count;
  __pyx_t_1 = __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel->add(__pyx_v_self, __pyx_v_pattern, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_101__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_101__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_100__reduce_cython__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_100__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_103__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_103__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_28OrderedUnindexedPatternModel_102__setstate_cython__(((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_28OrderedUnindexedPatternModel_102__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.OrderedUnindexedPatternModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3890
 *     cdef cPatternModelOptions coptions
 * 
 *     def __init__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         for kwarg, value in kwargs.items():
 *             setattr(self,kwarg.upper(), value)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_19PatternModelOptions_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11colibricore_19PatternModelOptions_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  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 (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_11colibricore_19PatternModelOptions___init__(((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_v_self), __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_19PatternModelOptions___init__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_kwarg = NULL;
  PyObject *__pyx_v_value = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":3891
 * 
 *     def __init__(self, **kwargs):
 *         for kwarg, value in kwargs.items():             # <<<<<<<<<<<<<<
 *             setattr(self,kwarg.upper(), value)
 * 
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(1, 3891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_kwarg, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "colibricore_wrapper.pyx":3892
 *     def __init__(self, **kwargs):
 *         for kwarg, value in kwargs.items():
 *             setattr(self,kwarg.upper(), value)             # <<<<<<<<<<<<<<
 * 
 *     def __setattr__(self,key, value):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwarg, __pyx_n_s_upper); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_t_6, __pyx_v_value); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 3892, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":3890
 *     cdef cPatternModelOptions coptions
 * 
 *     def __init__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         for kwarg, value in kwargs.items():
 *             setattr(self,kwarg.upper(), value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("colibricore.PatternModelOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwarg);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3894
 *             setattr(self,kwarg.upper(), value)
 * 
 *     def __setattr__(self,key, value):             # <<<<<<<<<<<<<<
 *         if key == 'MINTOKENS':
 *             self.coptions.MINTOKENS = value
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_19PatternModelOptions_3__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_11colibricore_19PatternModelOptions_3__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19PatternModelOptions_2__setattr__(((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_19PatternModelOptions_2__setattr__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  bool __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "colibricore_wrapper.pyx":3895
 * 
 *     def __setattr__(self,key, value):
 *         if key == 'MINTOKENS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS = value
 *         elif key == 'MINLENGTH':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3895, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3896
 *     def __setattr__(self,key, value):
 *         if key == 'MINTOKENS':
 *             self.coptions.MINTOKENS = value             # <<<<<<<<<<<<<<
 *         elif key == 'MINLENGTH':
 *             self.coptions.MINLENGTH = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3896, __pyx_L1_error)
    __pyx_v_self->coptions.MINTOKENS = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3895
 * 
 *     def __setattr__(self,key, value):
 *         if key == 'MINTOKENS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS = value
 *         elif key == 'MINLENGTH':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3897
 *         if key == 'MINTOKENS':
 *             self.coptions.MINTOKENS = value
 *         elif key == 'MINLENGTH':             # <<<<<<<<<<<<<<
 *             self.coptions.MINLENGTH = value
 *         elif key == 'MAXLENGTH':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINLENGTH, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3897, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3898
 *             self.coptions.MINTOKENS = value
 *         elif key == 'MINLENGTH':
 *             self.coptions.MINLENGTH = value             # <<<<<<<<<<<<<<
 *         elif key == 'MAXLENGTH':
 *             self.coptions.MAXLENGTH = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3898, __pyx_L1_error)
    __pyx_v_self->coptions.MINLENGTH = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3897
 *         if key == 'MINTOKENS':
 *             self.coptions.MINTOKENS = value
 *         elif key == 'MINLENGTH':             # <<<<<<<<<<<<<<
 *             self.coptions.MINLENGTH = value
 *         elif key == 'MAXLENGTH':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3899
 *         elif key == 'MINLENGTH':
 *             self.coptions.MINLENGTH = value
 *         elif key == 'MAXLENGTH':             # <<<<<<<<<<<<<<
 *             self.coptions.MAXLENGTH = value
 *         elif key == 'DOSKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MAXLENGTH, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3899, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3900
 *             self.coptions.MINLENGTH = value
 *         elif key == 'MAXLENGTH':
 *             self.coptions.MAXLENGTH = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOSKIPGRAMS':
 *             self.coptions.DOSKIPGRAMS = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3900, __pyx_L1_error)
    __pyx_v_self->coptions.MAXLENGTH = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3899
 *         elif key == 'MINLENGTH':
 *             self.coptions.MINLENGTH = value
 *         elif key == 'MAXLENGTH':             # <<<<<<<<<<<<<<
 *             self.coptions.MAXLENGTH = value
 *         elif key == 'DOSKIPGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3901
 *         elif key == 'MAXLENGTH':
 *             self.coptions.MAXLENGTH = value
 *         elif key == 'DOSKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOSKIPGRAMS = value
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOSKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3901, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3902
 *             self.coptions.MAXLENGTH = value
 *         elif key == 'DOSKIPGRAMS':
 *             self.coptions.DOSKIPGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3902, __pyx_L1_error)
    __pyx_v_self->coptions.DOSKIPGRAMS = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3901
 *         elif key == 'MAXLENGTH':
 *             self.coptions.MAXLENGTH = value
 *         elif key == 'DOSKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOSKIPGRAMS = value
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3903
 *         elif key == 'DOSKIPGRAMS':
 *             self.coptions.DOSKIPGRAMS = value
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':             # <<<<<<<<<<<<<<
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 *         elif key == 'MINTOKENS_UNIGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOSKIPGRAMS_EXHAUSTIVE, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3903, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3904
 *             self.coptions.DOSKIPGRAMS = value
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value             # <<<<<<<<<<<<<<
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3904, __pyx_L1_error)
    __pyx_v_self->coptions.DOSKIPGRAMS_EXHAUSTIVE = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3903
 *         elif key == 'DOSKIPGRAMS':
 *             self.coptions.DOSKIPGRAMS = value
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':             # <<<<<<<<<<<<<<
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 *         elif key == 'MINTOKENS_UNIGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3905
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 *         elif key == 'MINTOKENS_UNIGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS_UNIGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3905, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3906
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             self.coptions.MINTOKENS_UNIGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3906, __pyx_L1_error)
    __pyx_v_self->coptions.MINTOKENS_UNIGRAMS = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3905
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             self.coptions.DOSKIPGRAMS_EXHAUSTIVE = value
 *         elif key == 'MINTOKENS_UNIGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3907
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 *         elif key == 'MINTOKENS_SKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 *         elif key == 'MINSKIPTYPES':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS_SKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3907, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3908
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             self.coptions.MINTOKENS_SKIPGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'MINSKIPTYPES':
 *             self.coptions.MINSKIPTYPES = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3908, __pyx_L1_error)
    __pyx_v_self->coptions.MINTOKENS_SKIPGRAMS = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3907
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             self.coptions.MINTOKENS_UNIGRAMS = value
 *         elif key == 'MINTOKENS_SKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 *         elif key == 'MINSKIPTYPES':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3909
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 *         elif key == 'MINSKIPTYPES':             # <<<<<<<<<<<<<<
 *             self.coptions.MINSKIPTYPES = value
 *         elif key == 'MAXSKIPS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINSKIPTYPES, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3909, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3910
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 *         elif key == 'MINSKIPTYPES':
 *             self.coptions.MINSKIPTYPES = value             # <<<<<<<<<<<<<<
 *         elif key == 'MAXSKIPS':
 *             self.coptions.MAXSKIPS = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3910, __pyx_L1_error)
    __pyx_v_self->coptions.MINSKIPTYPES = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3909
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             self.coptions.MINTOKENS_SKIPGRAMS = value
 *         elif key == 'MINSKIPTYPES':             # <<<<<<<<<<<<<<
 *             self.coptions.MINSKIPTYPES = value
 *         elif key == 'MAXSKIPS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3911
 *         elif key == 'MINSKIPTYPES':
 *             self.coptions.MINSKIPTYPES = value
 *         elif key == 'MAXSKIPS':             # <<<<<<<<<<<<<<
 *             self.coptions.MAXSKIPS = value
 *         elif key == 'DOREVERSEINDEX':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MAXSKIPS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3911, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3912
 *             self.coptions.MINSKIPTYPES = value
 *         elif key == 'MAXSKIPS':
 *             self.coptions.MAXSKIPS = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOREVERSEINDEX':
 *             self.coptions.DOREVERSEINDEX = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3912, __pyx_L1_error)
    __pyx_v_self->coptions.MAXSKIPS = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3911
 *         elif key == 'MINSKIPTYPES':
 *             self.coptions.MINSKIPTYPES = value
 *         elif key == 'MAXSKIPS':             # <<<<<<<<<<<<<<
 *             self.coptions.MAXSKIPS = value
 *         elif key == 'DOREVERSEINDEX':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3913
 *         elif key == 'MAXSKIPS':
 *             self.coptions.MAXSKIPS = value
 *         elif key == 'DOREVERSEINDEX':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREVERSEINDEX = value
 *         elif key == 'DOPATTERNPERLINE':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREVERSEINDEX, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3913, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3914
 *             self.coptions.MAXSKIPS = value
 *         elif key == 'DOREVERSEINDEX':
 *             self.coptions.DOREVERSEINDEX = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOPATTERNPERLINE':
 *             self.coptions.DOPATTERNPERLINE = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3914, __pyx_L1_error)
    __pyx_v_self->coptions.DOREVERSEINDEX = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3913
 *         elif key == 'MAXSKIPS':
 *             self.coptions.MAXSKIPS = value
 *         elif key == 'DOREVERSEINDEX':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREVERSEINDEX = value
 *         elif key == 'DOPATTERNPERLINE':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3915
 *         elif key == 'DOREVERSEINDEX':
 *             self.coptions.DOREVERSEINDEX = value
 *         elif key == 'DOPATTERNPERLINE':             # <<<<<<<<<<<<<<
 *             self.coptions.DOPATTERNPERLINE = value
 *         elif key == 'DOREMOVENGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOPATTERNPERLINE, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3915, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3916
 *             self.coptions.DOREVERSEINDEX = value
 *         elif key == 'DOPATTERNPERLINE':
 *             self.coptions.DOPATTERNPERLINE = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVENGRAMS':
 *             self.coptions.DOREMOVENGRAMS = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3916, __pyx_L1_error)
    __pyx_v_self->coptions.DOPATTERNPERLINE = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3915
 *         elif key == 'DOREVERSEINDEX':
 *             self.coptions.DOREVERSEINDEX = value
 *         elif key == 'DOPATTERNPERLINE':             # <<<<<<<<<<<<<<
 *             self.coptions.DOPATTERNPERLINE = value
 *         elif key == 'DOREMOVENGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3917
 *         elif key == 'DOPATTERNPERLINE':
 *             self.coptions.DOPATTERNPERLINE = value
 *         elif key == 'DOREMOVENGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVENGRAMS = value
 *         elif key == 'DOREMOVESKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVENGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3917, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3918
 *             self.coptions.DOPATTERNPERLINE = value
 *         elif key == 'DOREMOVENGRAMS':
 *             self.coptions.DOREMOVENGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             self.coptions.DOREMOVESKIPGRAMS = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3918, __pyx_L1_error)
    __pyx_v_self->coptions.DOREMOVENGRAMS = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3917
 *         elif key == 'DOPATTERNPERLINE':
 *             self.coptions.DOPATTERNPERLINE = value
 *         elif key == 'DOREMOVENGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVENGRAMS = value
 *         elif key == 'DOREMOVESKIPGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3919
 *         elif key == 'DOREMOVENGRAMS':
 *             self.coptions.DOREMOVENGRAMS = value
 *         elif key == 'DOREMOVESKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVESKIPGRAMS = value
 *         elif key == 'DOREMOVEFLEXGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVESKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3919, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3920
 *             self.coptions.DOREMOVENGRAMS = value
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             self.coptions.DOREMOVESKIPGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3920, __pyx_L1_error)
    __pyx_v_self->coptions.DOREMOVESKIPGRAMS = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3919
 *         elif key == 'DOREMOVENGRAMS':
 *             self.coptions.DOREMOVENGRAMS = value
 *         elif key == 'DOREMOVESKIPGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVESKIPGRAMS = value
 *         elif key == 'DOREMOVEFLEXGRAMS':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3921
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             self.coptions.DOREMOVESKIPGRAMS = value
 *         elif key == 'DOREMOVEFLEXGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 *         elif key == 'DORESET':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVEFLEXGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3921, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3922
 *             self.coptions.DOREMOVESKIPGRAMS = value
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             self.coptions.DOREMOVEFLEXGRAMS = value             # <<<<<<<<<<<<<<
 *         elif key == 'DORESET':
 *             self.coptions.DORESET = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3922, __pyx_L1_error)
    __pyx_v_self->coptions.DOREMOVEFLEXGRAMS = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3921
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             self.coptions.DOREMOVESKIPGRAMS = value
 *         elif key == 'DOREMOVEFLEXGRAMS':             # <<<<<<<<<<<<<<
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 *         elif key == 'DORESET':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3923
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 *         elif key == 'DORESET':             # <<<<<<<<<<<<<<
 *             self.coptions.DORESET = value
 *         elif key == 'DEBUG':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DORESET, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3923, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3924
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 *         elif key == 'DORESET':
 *             self.coptions.DORESET = value             # <<<<<<<<<<<<<<
 *         elif key == 'DEBUG':
 *             self.coptions.DEBUG = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3924, __pyx_L1_error)
    __pyx_v_self->coptions.DORESET = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3923
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             self.coptions.DOREMOVEFLEXGRAMS = value
 *         elif key == 'DORESET':             # <<<<<<<<<<<<<<
 *             self.coptions.DORESET = value
 *         elif key == 'DEBUG':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3925
 *         elif key == 'DORESET':
 *             self.coptions.DORESET = value
 *         elif key == 'DEBUG':             # <<<<<<<<<<<<<<
 *             self.coptions.DEBUG = value
 *         elif key == 'QUIET':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DEBUG, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3925, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3926
 *             self.coptions.DORESET = value
 *         elif key == 'DEBUG':
 *             self.coptions.DEBUG = value             # <<<<<<<<<<<<<<
 *         elif key == 'QUIET':
 *             self.coptions.QUIET = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3926, __pyx_L1_error)
    __pyx_v_self->coptions.DEBUG = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3925
 *         elif key == 'DORESET':
 *             self.coptions.DORESET = value
 *         elif key == 'DEBUG':             # <<<<<<<<<<<<<<
 *             self.coptions.DEBUG = value
 *         elif key == 'QUIET':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3927
 *         elif key == 'DEBUG':
 *             self.coptions.DEBUG = value
 *         elif key == 'QUIET':             # <<<<<<<<<<<<<<
 *             self.coptions.QUIET = value
 *         elif key == 'PRUNENONSUBSUMED':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_QUIET, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3927, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3928
 *             self.coptions.DEBUG = value
 *         elif key == 'QUIET':
 *             self.coptions.QUIET = value             # <<<<<<<<<<<<<<
 *         elif key == 'PRUNENONSUBSUMED':
 *             self.coptions.PRUNENONSUBSUMED = value
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 3928, __pyx_L1_error)
    __pyx_v_self->coptions.QUIET = __pyx_t_3;

    /* "colibricore_wrapper.pyx":3927
 *         elif key == 'DEBUG':
 *             self.coptions.DEBUG = value
 *         elif key == 'QUIET':             # <<<<<<<<<<<<<<
 *             self.coptions.QUIET = value
 *         elif key == 'PRUNENONSUBSUMED':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3929
 *         elif key == 'QUIET':
 *             self.coptions.QUIET = value
 *         elif key == 'PRUNENONSUBSUMED':             # <<<<<<<<<<<<<<
 *             self.coptions.PRUNENONSUBSUMED = value
 *         elif key == 'PRUNESUBSUMED':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_PRUNENONSUBSUMED, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3929, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3930
 *             self.coptions.QUIET = value
 *         elif key == 'PRUNENONSUBSUMED':
 *             self.coptions.PRUNENONSUBSUMED = value             # <<<<<<<<<<<<<<
 *         elif key == 'PRUNESUBSUMED':
 *             self.coptions.PRUNESUBSUMED = value
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3930, __pyx_L1_error)
    __pyx_v_self->coptions.PRUNENONSUBSUMED = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3929
 *         elif key == 'QUIET':
 *             self.coptions.QUIET = value
 *         elif key == 'PRUNENONSUBSUMED':             # <<<<<<<<<<<<<<
 *             self.coptions.PRUNENONSUBSUMED = value
 *         elif key == 'PRUNESUBSUMED':
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3931
 *         elif key == 'PRUNENONSUBSUMED':
 *             self.coptions.PRUNENONSUBSUMED = value
 *         elif key == 'PRUNESUBSUMED':             # <<<<<<<<<<<<<<
 *             self.coptions.PRUNESUBSUMED = value
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_PRUNESUBSUMED, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3931, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3932
 *             self.coptions.PRUNENONSUBSUMED = value
 *         elif key == 'PRUNESUBSUMED':
 *             self.coptions.PRUNESUBSUMED = value             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 3932, __pyx_L1_error)
    __pyx_v_self->coptions.PRUNESUBSUMED = __pyx_t_2;

    /* "colibricore_wrapper.pyx":3931
 *         elif key == 'PRUNENONSUBSUMED':
 *             self.coptions.PRUNENONSUBSUMED = value
 *         elif key == 'PRUNESUBSUMED':             # <<<<<<<<<<<<<<
 *             self.coptions.PRUNESUBSUMED = value
 *         else:
 */
    goto __pyx_L3;
  }

  /* "colibricore_wrapper.pyx":3934
 *             self.coptions.PRUNESUBSUMED = value
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self,key):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 3934, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "colibricore_wrapper.pyx":3894
 *             setattr(self,kwarg.upper(), value)
 * 
 *     def __setattr__(self,key, value):             # <<<<<<<<<<<<<<
 *         if key == 'MINTOKENS':
 *             self.coptions.MINTOKENS = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternModelOptions.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3936
 *             raise KeyError
 * 
 *     def __getattr__(self,key):             # <<<<<<<<<<<<<<
 *         if key == 'MINTOKENS':
 *             return self.coptions.MINTOKENS
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19PatternModelOptions_4__getattr__(((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_4__getattr__(struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "colibricore_wrapper.pyx":3937
 * 
 *     def __getattr__(self,key):
 *         if key == 'MINTOKENS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS
 *         elif key == 'MINLENGTH':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3937, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3938
 *     def __getattr__(self,key):
 *         if key == 'MINTOKENS':
 *             return self.coptions.MINTOKENS             # <<<<<<<<<<<<<<
 *         elif key == 'MINLENGTH':
 *             return self.coptions.MINLENGTH
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MINTOKENS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3937
 * 
 *     def __getattr__(self,key):
 *         if key == 'MINTOKENS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS
 *         elif key == 'MINLENGTH':
 */
  }

  /* "colibricore_wrapper.pyx":3939
 *         if key == 'MINTOKENS':
 *             return self.coptions.MINTOKENS
 *         elif key == 'MINLENGTH':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINLENGTH
 *         elif key == 'MAXLENGTH':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINLENGTH, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3939, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3940
 *             return self.coptions.MINTOKENS
 *         elif key == 'MINLENGTH':
 *             return self.coptions.MINLENGTH             # <<<<<<<<<<<<<<
 *         elif key == 'MAXLENGTH':
 *             return self.coptions.MAXLENGTH
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MINLENGTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3939
 *         if key == 'MINTOKENS':
 *             return self.coptions.MINTOKENS
 *         elif key == 'MINLENGTH':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINLENGTH
 *         elif key == 'MAXLENGTH':
 */
  }

  /* "colibricore_wrapper.pyx":3941
 *         elif key == 'MINLENGTH':
 *             return self.coptions.MINLENGTH
 *         elif key == 'MAXLENGTH':             # <<<<<<<<<<<<<<
 *             return self.coptions.MAXLENGTH
 *         elif key == 'DOSKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MAXLENGTH, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3941, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3942
 *             return self.coptions.MINLENGTH
 *         elif key == 'MAXLENGTH':
 *             return self.coptions.MAXLENGTH             # <<<<<<<<<<<<<<
 *         elif key == 'DOSKIPGRAMS':
 *             return self.coptions.DOSKIPGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MAXLENGTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3941
 *         elif key == 'MINLENGTH':
 *             return self.coptions.MINLENGTH
 *         elif key == 'MAXLENGTH':             # <<<<<<<<<<<<<<
 *             return self.coptions.MAXLENGTH
 *         elif key == 'DOSKIPGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3943
 *         elif key == 'MAXLENGTH':
 *             return self.coptions.MAXLENGTH
 *         elif key == 'DOSKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOSKIPGRAMS
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOSKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3943, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3944
 *             return self.coptions.MAXLENGTH
 *         elif key == 'DOSKIPGRAMS':
 *             return self.coptions.DOSKIPGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOSKIPGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3943
 *         elif key == 'MAXLENGTH':
 *             return self.coptions.MAXLENGTH
 *         elif key == 'DOSKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOSKIPGRAMS
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 */
  }

  /* "colibricore_wrapper.pyx":3945
 *         elif key == 'DOSKIPGRAMS':
 *             return self.coptions.DOSKIPGRAMS
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 *         elif key == 'MINTOKENS_UNIGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOSKIPGRAMS_EXHAUSTIVE, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3945, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3946
 *             return self.coptions.DOSKIPGRAMS
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE             # <<<<<<<<<<<<<<
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             return self.coptions.MINTOKENS_UNIGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOSKIPGRAMS_EXHAUSTIVE); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3945
 *         elif key == 'DOSKIPGRAMS':
 *             return self.coptions.DOSKIPGRAMS
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 *         elif key == 'MINTOKENS_UNIGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3947
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 *         elif key == 'MINTOKENS_UNIGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS_UNIGRAMS
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS_UNIGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3947, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3948
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             return self.coptions.MINTOKENS_UNIGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MINTOKENS_UNIGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3947
 *         elif key == 'DOSKIPGRAMS_EXHAUSTIVE':
 *             return self.coptions.DOSKIPGRAMS_EXHAUSTIVE
 *         elif key == 'MINTOKENS_UNIGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS_UNIGRAMS
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3949
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             return self.coptions.MINTOKENS_UNIGRAMS
 *         elif key == 'MINTOKENS_SKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 *         elif key == 'MINSKIPTYPES':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINTOKENS_SKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3949, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3950
 *             return self.coptions.MINTOKENS_UNIGRAMS
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             return self.coptions.MINTOKENS_SKIPGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'MINSKIPTYPES':
 *             return self.coptions.MINSKIPTYPES
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MINTOKENS_SKIPGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3949
 *         elif key == 'MINTOKENS_UNIGRAMS':
 *             return self.coptions.MINTOKENS_UNIGRAMS
 *         elif key == 'MINTOKENS_SKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 *         elif key == 'MINSKIPTYPES':
 */
  }

  /* "colibricore_wrapper.pyx":3951
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 *         elif key == 'MINSKIPTYPES':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINSKIPTYPES
 *         elif key == 'MAXSKIPS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MINSKIPTYPES, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3951, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3952
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 *         elif key == 'MINSKIPTYPES':
 *             return self.coptions.MINSKIPTYPES             # <<<<<<<<<<<<<<
 *         elif key == 'MAXSKIPS':
 *             return self.coptions.MAXSKIPS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MINSKIPTYPES); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3951
 *         elif key == 'MINTOKENS_SKIPGRAMS':
 *             return self.coptions.MINTOKENS_SKIPGRAMS
 *         elif key == 'MINSKIPTYPES':             # <<<<<<<<<<<<<<
 *             return self.coptions.MINSKIPTYPES
 *         elif key == 'MAXSKIPS':
 */
  }

  /* "colibricore_wrapper.pyx":3953
 *         elif key == 'MINSKIPTYPES':
 *             return self.coptions.MINSKIPTYPES
 *         elif key == 'MAXSKIPS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MAXSKIPS
 *         elif key == 'DOREVERSEINDEX':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_MAXSKIPS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3953, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3954
 *             return self.coptions.MINSKIPTYPES
 *         elif key == 'MAXSKIPS':
 *             return self.coptions.MAXSKIPS             # <<<<<<<<<<<<<<
 *         elif key == 'DOREVERSEINDEX':
 *             return self.coptions.DOREVERSEINDEX
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.MAXSKIPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3953
 *         elif key == 'MINSKIPTYPES':
 *             return self.coptions.MINSKIPTYPES
 *         elif key == 'MAXSKIPS':             # <<<<<<<<<<<<<<
 *             return self.coptions.MAXSKIPS
 *         elif key == 'DOREVERSEINDEX':
 */
  }

  /* "colibricore_wrapper.pyx":3955
 *         elif key == 'MAXSKIPS':
 *             return self.coptions.MAXSKIPS
 *         elif key == 'DOREVERSEINDEX':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREVERSEINDEX
 *         elif key == 'DOPATTERNPERLINE':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREVERSEINDEX, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3955, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3956
 *             return self.coptions.MAXSKIPS
 *         elif key == 'DOREVERSEINDEX':
 *             return self.coptions.DOREVERSEINDEX             # <<<<<<<<<<<<<<
 *         elif key == 'DOPATTERNPERLINE':
 *             return self.coptions.DOPATTERNPERLINE
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOREVERSEINDEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3955
 *         elif key == 'MAXSKIPS':
 *             return self.coptions.MAXSKIPS
 *         elif key == 'DOREVERSEINDEX':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREVERSEINDEX
 *         elif key == 'DOPATTERNPERLINE':
 */
  }

  /* "colibricore_wrapper.pyx":3957
 *         elif key == 'DOREVERSEINDEX':
 *             return self.coptions.DOREVERSEINDEX
 *         elif key == 'DOPATTERNPERLINE':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOPATTERNPERLINE
 *         elif key == 'DOREMOVENGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOPATTERNPERLINE, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3957, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3958
 *             return self.coptions.DOREVERSEINDEX
 *         elif key == 'DOPATTERNPERLINE':
 *             return self.coptions.DOPATTERNPERLINE             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVENGRAMS':
 *             return self.coptions.DOREMOVENGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOPATTERNPERLINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3957
 *         elif key == 'DOREVERSEINDEX':
 *             return self.coptions.DOREVERSEINDEX
 *         elif key == 'DOPATTERNPERLINE':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOPATTERNPERLINE
 *         elif key == 'DOREMOVENGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3959
 *         elif key == 'DOPATTERNPERLINE':
 *             return self.coptions.DOPATTERNPERLINE
 *         elif key == 'DOREMOVENGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVENGRAMS
 *         elif key == 'DOREMOVESKIPGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVENGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3959, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3960
 *             return self.coptions.DOPATTERNPERLINE
 *         elif key == 'DOREMOVENGRAMS':
 *             return self.coptions.DOREMOVENGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             return self.coptions.DOREMOVESKIPGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOREMOVENGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3959
 *         elif key == 'DOPATTERNPERLINE':
 *             return self.coptions.DOPATTERNPERLINE
 *         elif key == 'DOREMOVENGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVENGRAMS
 *         elif key == 'DOREMOVESKIPGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3961
 *         elif key == 'DOREMOVENGRAMS':
 *             return self.coptions.DOREMOVENGRAMS
 *         elif key == 'DOREMOVESKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVESKIPGRAMS
 *         elif key == 'DOREMOVEFLEXGRAMS':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVESKIPGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3961, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3962
 *             return self.coptions.DOREMOVENGRAMS
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             return self.coptions.DOREMOVESKIPGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             return self.coptions.DOREMOVEFLEXGRAMS
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOREMOVESKIPGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3961
 *         elif key == 'DOREMOVENGRAMS':
 *             return self.coptions.DOREMOVENGRAMS
 *         elif key == 'DOREMOVESKIPGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVESKIPGRAMS
 *         elif key == 'DOREMOVEFLEXGRAMS':
 */
  }

  /* "colibricore_wrapper.pyx":3963
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             return self.coptions.DOREMOVESKIPGRAMS
 *         elif key == 'DOREMOVEFLEXGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVEFLEXGRAMS
 *         elif key == 'DORESET':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DOREMOVEFLEXGRAMS, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3963, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3964
 *             return self.coptions.DOREMOVESKIPGRAMS
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             return self.coptions.DOREMOVEFLEXGRAMS             # <<<<<<<<<<<<<<
 *         elif key == 'DORESET':
 *             return self.coptions.DORESET
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DOREMOVEFLEXGRAMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3963
 *         elif key == 'DOREMOVESKIPGRAMS':
 *             return self.coptions.DOREMOVESKIPGRAMS
 *         elif key == 'DOREMOVEFLEXGRAMS':             # <<<<<<<<<<<<<<
 *             return self.coptions.DOREMOVEFLEXGRAMS
 *         elif key == 'DORESET':
 */
  }

  /* "colibricore_wrapper.pyx":3965
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             return self.coptions.DOREMOVEFLEXGRAMS
 *         elif key == 'DORESET':             # <<<<<<<<<<<<<<
 *             return self.coptions.DORESET
 *         elif key == 'DEBUG':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DORESET, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3965, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3966
 *             return self.coptions.DOREMOVEFLEXGRAMS
 *         elif key == 'DORESET':
 *             return self.coptions.DORESET             # <<<<<<<<<<<<<<
 *         elif key == 'DEBUG':
 *             return self.coptions.DEBUG
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DORESET); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3965
 *         elif key == 'DOREMOVEFLEXGRAMS':
 *             return self.coptions.DOREMOVEFLEXGRAMS
 *         elif key == 'DORESET':             # <<<<<<<<<<<<<<
 *             return self.coptions.DORESET
 *         elif key == 'DEBUG':
 */
  }

  /* "colibricore_wrapper.pyx":3967
 *         elif key == 'DORESET':
 *             return self.coptions.DORESET
 *         elif key == 'DEBUG':             # <<<<<<<<<<<<<<
 *             return self.coptions.DEBUG
 *         elif key == 'QUIET':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_DEBUG, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3967, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3968
 *             return self.coptions.DORESET
 *         elif key == 'DEBUG':
 *             return self.coptions.DEBUG             # <<<<<<<<<<<<<<
 *         elif key == 'QUIET':
 *             return self.coptions.QUIET
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3967
 *         elif key == 'DORESET':
 *             return self.coptions.DORESET
 *         elif key == 'DEBUG':             # <<<<<<<<<<<<<<
 *             return self.coptions.DEBUG
 *         elif key == 'QUIET':
 */
  }

  /* "colibricore_wrapper.pyx":3969
 *         elif key == 'DEBUG':
 *             return self.coptions.DEBUG
 *         elif key == 'QUIET':             # <<<<<<<<<<<<<<
 *             return self.coptions.QUIET
 *         elif key == 'PRUNENONSUBSUMED':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_QUIET, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3969, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3970
 *             return self.coptions.DEBUG
 *         elif key == 'QUIET':
 *             return self.coptions.QUIET             # <<<<<<<<<<<<<<
 *         elif key == 'PRUNENONSUBSUMED':
 *             return self.coptions.PRUNENONSUBSUMED
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->coptions.QUIET); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3969
 *         elif key == 'DEBUG':
 *             return self.coptions.DEBUG
 *         elif key == 'QUIET':             # <<<<<<<<<<<<<<
 *             return self.coptions.QUIET
 *         elif key == 'PRUNENONSUBSUMED':
 */
  }

  /* "colibricore_wrapper.pyx":3971
 *         elif key == 'QUIET':
 *             return self.coptions.QUIET
 *         elif key == 'PRUNENONSUBSUMED':             # <<<<<<<<<<<<<<
 *             return self.coptions.PRUNENONSUBSUMED
 *         elif key == 'PRUNESUBSUMED':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_PRUNENONSUBSUMED, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3971, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3972
 *             return self.coptions.QUIET
 *         elif key == 'PRUNENONSUBSUMED':
 *             return self.coptions.PRUNENONSUBSUMED             # <<<<<<<<<<<<<<
 *         elif key == 'PRUNESUBSUMED':
 *             return self.coptions.PRUNESUBSUMED
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.PRUNENONSUBSUMED); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3971
 *         elif key == 'QUIET':
 *             return self.coptions.QUIET
 *         elif key == 'PRUNENONSUBSUMED':             # <<<<<<<<<<<<<<
 *             return self.coptions.PRUNENONSUBSUMED
 *         elif key == 'PRUNESUBSUMED':
 */
  }

  /* "colibricore_wrapper.pyx":3973
 *         elif key == 'PRUNENONSUBSUMED':
 *             return self.coptions.PRUNENONSUBSUMED
 *         elif key == 'PRUNESUBSUMED':             # <<<<<<<<<<<<<<
 *             return self.coptions.PRUNESUBSUMED
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_PRUNESUBSUMED, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 3973, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":3974
 *             return self.coptions.PRUNENONSUBSUMED
 *         elif key == 'PRUNESUBSUMED':
 *             return self.coptions.PRUNESUBSUMED             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->coptions.PRUNESUBSUMED); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":3973
 *         elif key == 'PRUNENONSUBSUMED':
 *             return self.coptions.PRUNENONSUBSUMED
 *         elif key == 'PRUNESUBSUMED':             # <<<<<<<<<<<<<<
 *             return self.coptions.PRUNESUBSUMED
 *         else:
 */
  }

  /* "colibricore_wrapper.pyx":3976
 *             return self.coptions.PRUNESUBSUMED
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 * cdef class IndexedCorpus:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 3976, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":3936
 *             raise KeyError
 * 
 *     def __getattr__(self,key):             # <<<<<<<<<<<<<<
 *         if key == 'MINTOKENS':
 *             return self.coptions.MINTOKENS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("colibricore.PatternModelOptions.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19PatternModelOptions_6__reduce_cython__(((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternModelOptions.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_19PatternModelOptions_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_19PatternModelOptions_8__setstate_cython__(((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_19PatternModelOptions_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternModelOptions.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3987
 * 
 * 
 *     def __init__(self, str filename=""):             # <<<<<<<<<<<<<<
 *         """:param filename: The name of the colibri.dat file to load"""
 *         self._filename = filename
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_13IndexedCorpus_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus___init__[] = ":param filename: The name of the colibri.dat file to load";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_13IndexedCorpus___init__;
#endif
static int __pyx_pw_11colibricore_13IndexedCorpus_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 3987, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3987, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 3987, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus___init__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_13IndexedCorpus___init__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":3989
 *     def __init__(self, str filename=""):
 *         """:param filename: The name of the colibri.dat file to load"""
 *         self._filename = filename             # <<<<<<<<<<<<<<
 *         self.data = new cIndexedCorpus()
 *         if filename:
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->_filename);
  __Pyx_DECREF(__pyx_v_self->_filename);
  __pyx_v_self->_filename = __pyx_v_filename;

  /* "colibricore_wrapper.pyx":3990
 *         """:param filename: The name of the colibri.dat file to load"""
 *         self._filename = filename
 *         self.data = new cIndexedCorpus()             # <<<<<<<<<<<<<<
 *         if filename:
 *             self.data.load(encode(filename), True) #last bool is debug
 */
  __pyx_v_self->data = new IndexedCorpus();

  /* "colibricore_wrapper.pyx":3991
 *         self._filename = filename
 *         self.data = new cIndexedCorpus()
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.load(encode(filename), True) #last bool is debug
 *         self.unload = True
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3992
 *         self.data = new cIndexedCorpus()
 *         if filename:
 *             self.data.load(encode(filename), True) #last bool is debug             # <<<<<<<<<<<<<<
 *         self.unload = True
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3992, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->data->load(__pyx_t_5, 1);

    /* "colibricore_wrapper.pyx":3991
 *         self._filename = filename
 *         self.data = new cIndexedCorpus()
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.data.load(encode(filename), True) #last bool is debug
 *         self.unload = True
 */
  }

  /* "colibricore_wrapper.pyx":3993
 *         if filename:
 *             self.data.load(encode(filename), True) #last bool is debug
 *         self.unload = True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->unload = 1;

  /* "colibricore_wrapper.pyx":3987
 * 
 * 
 *     def __init__(self, str filename=""):             # <<<<<<<<<<<<<<
 *         """:param filename: The name of the colibri.dat file to load"""
 *         self._filename = filename
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":3996
 * 
 * 
 *     cdef bind(self, cIndexedCorpus * d, unload=False):             # <<<<<<<<<<<<<<
 *         if self.data != NULL and self.unload:
 *             del self.data
 */

static PyObject *__pyx_f_11colibricore_13IndexedCorpus_bind(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, IndexedCorpus *__pyx_v_d, struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind *__pyx_optional_args) {
  PyObject *__pyx_v_unload = ((PyObject *)Py_False);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  bool __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bind", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_unload = __pyx_optional_args->unload;
    }
  }

  /* "colibricore_wrapper.pyx":3997
 * 
 *     cdef bind(self, cIndexedCorpus * d, unload=False):
 *         if self.data != NULL and self.unload:             # <<<<<<<<<<<<<<
 *             del self.data
 *         self.data = d
 */
  __pyx_t_2 = ((__pyx_v_self->data != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->unload != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":3998
 *     cdef bind(self, cIndexedCorpus * d, unload=False):
 *         if self.data != NULL and self.unload:
 *             del self.data             # <<<<<<<<<<<<<<
 *         self.data = d
 *         self.unload = unload
 */
    delete __pyx_v_self->data;

    /* "colibricore_wrapper.pyx":3997
 * 
 *     cdef bind(self, cIndexedCorpus * d, unload=False):
 *         if self.data != NULL and self.unload:             # <<<<<<<<<<<<<<
 *             del self.data
 *         self.data = d
 */
  }

  /* "colibricore_wrapper.pyx":3999
 *         if self.data != NULL and self.unload:
 *             del self.data
 *         self.data = d             # <<<<<<<<<<<<<<
 *         self.unload = unload
 * 
 */
  __pyx_v_self->data = __pyx_v_d;

  /* "colibricore_wrapper.pyx":4000
 *             del self.data
 *         self.data = d
 *         self.unload = unload             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_unload); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 4000, __pyx_L1_error)
  __pyx_v_self->unload = __pyx_t_3;

  /* "colibricore_wrapper.pyx":3996
 * 
 * 
 *     cdef bind(self, cIndexedCorpus * d, unload=False):             # <<<<<<<<<<<<<<
 *         if self.data != NULL and self.unload:
 *             del self.data
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4002
 *         self.unload = unload
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.data != NULL and self.unload:
 *             del self.data
 */

/* Python wrapper */
static void __pyx_pw_11colibricore_13IndexedCorpus_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_11colibricore_13IndexedCorpus_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_11colibricore_13IndexedCorpus_2__dealloc__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_11colibricore_13IndexedCorpus_2__dealloc__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "colibricore_wrapper.pyx":4003
 * 
 *     def __dealloc__(self):
 *         if self.data != NULL and self.unload:             # <<<<<<<<<<<<<<
 *             del self.data
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->data != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->unload != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":4004
 *     def __dealloc__(self):
 *         if self.data != NULL and self.unload:
 *             del self.data             # <<<<<<<<<<<<<<
 * 
 *     def filename(self):
 */
    delete __pyx_v_self->data;

    /* "colibricore_wrapper.pyx":4003
 * 
 *     def __dealloc__(self):
 *         if self.data != NULL and self.unload:             # <<<<<<<<<<<<<<
 *             del self.data
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4002
 *         self.unload = unload
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.data != NULL and self.unload:
 *             del self.data
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "colibricore_wrapper.pyx":4006
 *             del self.data
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_5filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_5filename(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_4filename(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_4filename(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filename", 0);

  /* "colibricore_wrapper.pyx":4007
 * 
 *     def filename(self):
 *         return self._filename             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4006
 *             del self.data
 * 
 *     def filename(self):             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4009
 *         return self._filename
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of tokens in the corpus"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_13IndexedCorpus_7__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_6__len__[] = "Return the total number of tokens in the corpus";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_13IndexedCorpus_6__len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_13IndexedCorpus_7__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_6__len__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_13IndexedCorpus_6__len__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":4011
 *     def __len__(self):
 *         """Return the total number of tokens in the corpus"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     cdef has(self,tuple item):
 */
  __pyx_r = __pyx_v_self->data->size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4009
 *         return self._filename
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the total number of tokens in the corpus"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4013
 *         return self.data.size()
 * 
 *     cdef has(self,tuple item):             # <<<<<<<<<<<<<<
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 */

static PyObject *__pyx_f_11colibricore_13IndexedCorpus_has(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_v_sentence;
  int __pyx_v_token;
  IndexReference __pyx_v_ref;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":4014
 * 
 *     cdef has(self,tuple item):
 *         cdef int sentence = item[0]             # <<<<<<<<<<<<<<
 *         cdef int token = item[1]
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 */
  if (unlikely(__pyx_v_item == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4014, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4014, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sentence = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4015
 *     cdef has(self,tuple item):
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 *         return self.data.has(ref)
 */
  if (unlikely(__pyx_v_item == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4015, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_token = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4016
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 *         cdef cIndexReference ref = cIndexReference(sentence,token)             # <<<<<<<<<<<<<<
 *         return self.data.has(ref)
 * 
 */
  __pyx_v_ref = IndexReference(__pyx_v_sentence, __pyx_v_token);

  /* "colibricore_wrapper.pyx":4017
 *         cdef int token = item[1]
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 *         return self.data.has(ref)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data->has(__pyx_v_ref)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4013
 *         return self.data.size()
 * 
 *     cdef has(self,tuple item):             # <<<<<<<<<<<<<<
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4020
 * 
 * 
 *     cdef get(self,tuple item):             # <<<<<<<<<<<<<<
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 */

static PyObject *__pyx_f_11colibricore_13IndexedCorpus_get(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_v_sentence;
  int __pyx_v_token;
  IndexReference __pyx_v_ref;
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Pattern __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "colibricore_wrapper.pyx":4021
 * 
 *     cdef get(self,tuple item):
 *         cdef int sentence = item[0]             # <<<<<<<<<<<<<<
 *         cdef int token = item[1]
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 */
  if (unlikely(__pyx_v_item == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4021, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4021, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sentence = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4022
 *     cdef get(self,tuple item):
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 *         cdef cPattern cpattern
 */
  if (unlikely(__pyx_v_item == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4022, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4022, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_token = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4023
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 *         cdef cIndexReference ref = cIndexReference(sentence,token)             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cpattern = self.data.getpattern(ref,1)
 */
  __pyx_v_ref = IndexReference(__pyx_v_sentence, __pyx_v_token);

  /* "colibricore_wrapper.pyx":4025
 *         cdef cIndexReference ref = cIndexReference(sentence,token)
 *         cdef cPattern cpattern
 *         cpattern = self.data.getpattern(ref,1)             # <<<<<<<<<<<<<<
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 */
  try {
    __pyx_t_3 = __pyx_v_self->data->getpattern(__pyx_v_ref, 1);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 4025, __pyx_L1_error)
  }
  __pyx_v_cpattern = __pyx_t_3;

  /* "colibricore_wrapper.pyx":4026
 *         cdef cPattern cpattern
 *         cpattern = self.data.getpattern(ref,1)
 *         pattern = Pattern()             # <<<<<<<<<<<<<<
 *         pattern.bind(cpattern)
 *         return pattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4027
 *         cpattern = self.data.getpattern(ref,1)
 *         pattern = Pattern()
 *         pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *         return pattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_pattern->__pyx_vtab)->bind(__pyx_v_pattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4028
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 *         return pattern             # <<<<<<<<<<<<<<
 * 
 *     cdef getslice(self,tuple start, tuple stop):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
  __pyx_r = ((PyObject *)__pyx_v_pattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4020
 * 
 * 
 *     cdef get(self,tuple item):             # <<<<<<<<<<<<<<
 *         cdef int sentence = item[0]
 *         cdef int token = item[1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4030
 *         return pattern
 * 
 *     cdef getslice(self,tuple start, tuple stop):             # <<<<<<<<<<<<<<
 *         cdef int startsentence = start[0]
 *         cdef int starttoken = start[1]
 */

static PyObject *__pyx_f_11colibricore_13IndexedCorpus_getslice(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop) {
  int __pyx_v_startsentence;
  int __pyx_v_starttoken;
  IndexReference __pyx_v_startref;
  int __pyx_v_stopsentence;
  int __pyx_v_stoptoken;
  IndexReference __pyx_v_stopref;
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Pattern __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getslice", 0);

  /* "colibricore_wrapper.pyx":4031
 * 
 *     cdef getslice(self,tuple start, tuple stop):
 *         cdef int startsentence = start[0]             # <<<<<<<<<<<<<<
 *         cdef int starttoken = start[1]
 *         cdef cIndexReference startref = cIndexReference(startsentence,starttoken)
 */
  if (unlikely(__pyx_v_start == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4031, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_start, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_startsentence = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4032
 *     cdef getslice(self,tuple start, tuple stop):
 *         cdef int startsentence = start[0]
 *         cdef int starttoken = start[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference startref = cIndexReference(startsentence,starttoken)
 *         cdef int stopsentence = stop[0]
 */
  if (unlikely(__pyx_v_start == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4032, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_start, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_starttoken = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4033
 *         cdef int startsentence = start[0]
 *         cdef int starttoken = start[1]
 *         cdef cIndexReference startref = cIndexReference(startsentence,starttoken)             # <<<<<<<<<<<<<<
 *         cdef int stopsentence = stop[0]
 *         cdef int stoptoken = stop[1]
 */
  __pyx_v_startref = IndexReference(__pyx_v_startsentence, __pyx_v_starttoken);

  /* "colibricore_wrapper.pyx":4034
 *         cdef int starttoken = start[1]
 *         cdef cIndexReference startref = cIndexReference(startsentence,starttoken)
 *         cdef int stopsentence = stop[0]             # <<<<<<<<<<<<<<
 *         cdef int stoptoken = stop[1]
 *         cdef cIndexReference stopref = cIndexReference(stopsentence,stoptoken)
 */
  if (unlikely(__pyx_v_stop == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4034, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_stop, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4034, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_stopsentence = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4035
 *         cdef cIndexReference startref = cIndexReference(startsentence,starttoken)
 *         cdef int stopsentence = stop[0]
 *         cdef int stoptoken = stop[1]             # <<<<<<<<<<<<<<
 *         cdef cIndexReference stopref = cIndexReference(stopsentence,stoptoken)
 *         cdef cPattern cpattern = self.data.getpattern(startref, stopref.token - startref.token)
 */
  if (unlikely(__pyx_v_stop == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4035, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_stop, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4035, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_stoptoken = __pyx_t_2;

  /* "colibricore_wrapper.pyx":4036
 *         cdef int stopsentence = stop[0]
 *         cdef int stoptoken = stop[1]
 *         cdef cIndexReference stopref = cIndexReference(stopsentence,stoptoken)             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern = self.data.getpattern(startref, stopref.token - startref.token)
 *         pattern = Pattern()
 */
  __pyx_v_stopref = IndexReference(__pyx_v_stopsentence, __pyx_v_stoptoken);

  /* "colibricore_wrapper.pyx":4037
 *         cdef int stoptoken = stop[1]
 *         cdef cIndexReference stopref = cIndexReference(stopsentence,stoptoken)
 *         cdef cPattern cpattern = self.data.getpattern(startref, stopref.token - startref.token)             # <<<<<<<<<<<<<<
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 */
  try {
    __pyx_t_3 = __pyx_v_self->data->getpattern(__pyx_v_startref, (__pyx_v_stopref.token - __pyx_v_startref.token));
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 4037, __pyx_L1_error)
  }
  __pyx_v_cpattern = __pyx_t_3;

  /* "colibricore_wrapper.pyx":4038
 *         cdef cIndexReference stopref = cIndexReference(stopsentence,stoptoken)
 *         cdef cPattern cpattern = self.data.getpattern(startref, stopref.token - startref.token)
 *         pattern = Pattern()             # <<<<<<<<<<<<<<
 *         pattern.bind(cpattern)
 *         return pattern
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4039
 *         cdef cPattern cpattern = self.data.getpattern(startref, stopref.token - startref.token)
 *         pattern = Pattern()
 *         pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *         return pattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_pattern->__pyx_vtab)->bind(__pyx_v_pattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4040
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 *         return pattern             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, tuple indexreference):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
  __pyx_r = ((PyObject *)__pyx_v_pattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4030
 *         return pattern
 * 
 *     cdef getslice(self,tuple start, tuple stop):             # <<<<<<<<<<<<<<
 *         cdef int startsentence = start[0]
 *         cdef int starttoken = start[1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.getslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4042
 *         return pattern
 * 
 *     def __contains__(self, tuple indexreference):             # <<<<<<<<<<<<<<
 *         """Test if the indexreference, a (sentence,tokenoffset) tuple is in the corpus."""
 *         return self.has(indexreference)
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_13IndexedCorpus_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_8__contains__[] = "Test if the indexreference, a (sentence,tokenoffset) tuple is in the corpus.";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_13IndexedCorpus_8__contains__;
#endif
static int __pyx_pw_11colibricore_13IndexedCorpus_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexreference), (&PyTuple_Type), 1, "indexreference", 1))) __PYX_ERR(1, 4042, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_8__contains__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), ((PyObject*)__pyx_v_indexreference));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_13IndexedCorpus_8__contains__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_indexreference) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":4044
 *     def __contains__(self, tuple indexreference):
 *         """Test if the indexreference, a (sentence,tokenoffset) tuple is in the corpus."""
 *         return self.has(indexreference)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_IndexedCorpus *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_indexreference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4044, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4042
 *         return pattern
 * 
 *     def __contains__(self, tuple indexreference):             # <<<<<<<<<<<<<<
 *         """Test if the indexreference, a (sentence,tokenoffset) tuple is in the corpus."""
 *         return self.has(indexreference)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_12generator67(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4046
 *         return self.has(indexreference)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples"""
 *         cdef cIndexedCorpus.iterator it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_11__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_10__iter__[] = "Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_13IndexedCorpus_10__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_10__iter__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_10__iter__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_67___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_67___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4046, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_13IndexedCorpus_12generator67, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_IndexedCorpus___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4046, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_12generator67(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 4046, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4048
 *     def __iter__(self):
 *         """Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples"""
 *         cdef cIndexedCorpus.iterator it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cIndexedCorpus.iterator endit = self.data.end()
 *         while it != endit:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data->begin();

  /* "colibricore_wrapper.pyx":4049
 *         """Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples"""
 *         cdef cIndexedCorpus.iterator it = self.data.begin()
 *         cdef cIndexedCorpus.iterator endit = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != endit:
 *             yield (it.index().sentence, it.index().token)
 */
  __pyx_cur_scope->__pyx_v_endit = __pyx_cur_scope->__pyx_v_self->data->end();

  /* "colibricore_wrapper.pyx":4050
 *         cdef cIndexedCorpus.iterator it = self.data.begin()
 *         cdef cIndexedCorpus.iterator endit = self.data.end()
 *         while it != endit:             # <<<<<<<<<<<<<<
 *             yield (it.index().sentence, it.index().token)
 *             inc(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_endit) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4051
 *         cdef cIndexedCorpus.iterator endit = self.data.end()
 *         while it != endit:
 *             yield (it.index().sentence, it.index().token)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_it.index().sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_it.index().token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4051, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4052
 *         while it != endit:
 *             yield (it.index().sentence, it.index().token)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4046
 *         return self.has(indexreference)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes in the corpus, generator over (sentence, tokenoffset) tuples"""
 *         cdef cIndexedCorpus.iterator it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4054
 *             inc(it)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieve the token Pattern given a (sentence, tokenoffset) tuple """
 *         if isinstance(item, slice):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_14__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_13__getitem__[] = "Retrieve the token Pattern given a (sentence, tokenoffset) tuple ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_13IndexedCorpus_13__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_14__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_13__getitem__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_13__getitem__(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":4056
 *     def __getitem__(self, item):
 *         """Retrieve the token Pattern given a (sentence, tokenoffset) tuple """
 *         if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *             start = item.start
 *             stop = item.stop
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_item); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4057
 *         """Retrieve the token Pattern given a (sentence, tokenoffset) tuple """
 *         if isinstance(item, slice):
 *             start = item.start             # <<<<<<<<<<<<<<
 *             stop = item.stop
 *             if not isinstance(start, tuple):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_start = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4058
 *         if isinstance(item, slice):
 *             start = item.start
 *             stop = item.stop             # <<<<<<<<<<<<<<
 *             if not isinstance(start, tuple):
 *                 raise ValueError("Expected tuple for start of slice")
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_stop = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4059
 *             start = item.start
 *             stop = item.stop
 *             if not isinstance(start, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):
 */
    __pyx_t_2 = PyTuple_Check(__pyx_v_start); 
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "colibricore_wrapper.pyx":4060
 *             stop = item.stop
 *             if not isinstance(start, tuple):
 *                 raise ValueError("Expected tuple for start of slice")             # <<<<<<<<<<<<<<
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4060, __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_ERR(1, 4060, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4059
 *             start = item.start
 *             stop = item.stop
 *             if not isinstance(start, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):
 */
    }

    /* "colibricore_wrapper.pyx":4061
 *             if not isinstance(start, tuple):
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:
 */
    __pyx_t_1 = PyTuple_Check(__pyx_v_stop); 
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4062
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")             # <<<<<<<<<<<<<<
 *             if start[0] != stop[0]:
 *                 raise ValueError("Slices only supported within the same sentence")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4062, __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_ERR(1, 4062, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4061
 *             if not isinstance(start, tuple):
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:
 */
    }

    /* "colibricore_wrapper.pyx":4063
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Slices only supported within the same sentence")
 *             return self.getslice(start, stop)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_start, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_stop, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 4063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4064
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:
 *                 raise ValueError("Slices only supported within the same sentence")             # <<<<<<<<<<<<<<
 *             return self.getslice(start, stop)
 *         else:
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 4064, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4063
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Slices only supported within the same sentence")
 *             return self.getslice(start, stop)
 */
    }

    /* "colibricore_wrapper.pyx":4065
 *             if start[0] != stop[0]:
 *                 raise ValueError("Slices only supported within the same sentence")
 *             return self.getslice(start, stop)             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, tuple):
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyTuple_CheckExact(__pyx_v_start))||((__pyx_v_start) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_start)->tp_name), 0))) __PYX_ERR(1, 4065, __pyx_L1_error)
    if (!(likely(PyTuple_CheckExact(__pyx_v_stop))||((__pyx_v_stop) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_stop)->tp_name), 0))) __PYX_ERR(1, 4065, __pyx_L1_error)
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_IndexedCorpus *)__pyx_v_self->__pyx_vtab)->getslice(__pyx_v_self, ((PyObject*)__pyx_v_start), ((PyObject*)__pyx_v_stop)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4056
 *     def __getitem__(self, item):
 *         """Retrieve the token Pattern given a (sentence, tokenoffset) tuple """
 *         if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *             start = item.start
 *             stop = item.stop
 */
  }

  /* "colibricore_wrapper.pyx":4067
 *             return self.getslice(start, stop)
 *         else:
 *             if not isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple")
 *             return self.get(item)
 */
  /*else*/ {
    __pyx_t_2 = PyTuple_Check(__pyx_v_item); 
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "colibricore_wrapper.pyx":4068
 *         else:
 *             if not isinstance(item, tuple):
 *                 raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *             return self.get(item)
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 4068, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4067
 *             return self.getslice(start, stop)
 *         else:
 *             if not isinstance(item, tuple):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected tuple")
 *             return self.get(item)
 */
    }

    /* "colibricore_wrapper.pyx":4069
 *             if not isinstance(item, tuple):
 *                 raise ValueError("Expected tuple")
 *             return self.get(item)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyTuple_CheckExact(__pyx_v_item))||((__pyx_v_item) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_item)->tp_name), 0))) __PYX_ERR(1, 4069, __pyx_L1_error)
    __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_IndexedCorpus *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, ((PyObject*)__pyx_v_item)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "colibricore_wrapper.pyx":4054
 *             inc(it)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         """Retrieve the token Pattern given a (sentence, tokenoffset) tuple """
 *         if isinstance(item, slice):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_17generator68(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4072
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes and their unigram patterns. Yields ((sentence,tokenoffset), unigrampattern) tuples"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_16items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_15items[] = "Iterate over all indexes and their unigram patterns. Yields ((sentence,tokenoffset), unigrampattern) tuples";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_16items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_15items(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_15items(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_68_items(__pyx_ptype_11colibricore___pyx_scope_struct_68_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4072, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_13IndexedCorpus_17generator68, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_IndexedCorpus_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4072, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_17generator68(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 4072, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4074
 *     def items(self):
 *         """Iterate over all indexes and their unigram patterns. Yields ((sentence,tokenoffset), unigrampattern) tuples"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cIndexReference ref
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data->begin();

  /* "colibricore_wrapper.pyx":4077
 *         cdef cPattern cpattern
 *         cdef cIndexReference ref
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = it.pattern()
 *             ref = it.index()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data->end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4078
 *         cdef cIndexReference ref
 *         while it != self.data.end():
 *             cpattern = it.pattern()             # <<<<<<<<<<<<<<
 *             ref = it.index()
 *             pattern = Pattern()
 */
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_cur_scope->__pyx_v_it.pattern();

    /* "colibricore_wrapper.pyx":4079
 *         while it != self.data.end():
 *             cpattern = it.pattern()
 *             ref = it.index()             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_ref = __pyx_cur_scope->__pyx_v_it.index();

    /* "colibricore_wrapper.pyx":4080
 *             cpattern = it.pattern()
 *             ref = it.index()
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield ( (ref.sentence, ref.token), pattern )
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4081
 *             ref = it.index()
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield ( (ref.sentence, ref.token), pattern )
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4082
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield ( (ref.sentence, ref.token), pattern )             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_ref.sentence); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_ref.token); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4082, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4083
 *             pattern.bind(cpattern)
 *             yield ( (ref.sentence, ref.token), pattern )
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def findpattern(self, Pattern pattern, int sentence = 0, bool instantiate = False):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4072
 * 
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all indexes and their unigram patterns. Yields ((sentence,tokenoffset), unigrampattern) tuples"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_20generator69(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4085
 *             inc(it)
 * 
 *     def findpattern(self, Pattern pattern, int sentence = 0, bool instantiate = False):             # <<<<<<<<<<<<<<
 *         """Generator over the indexes in the corpus where this pattern is found. Note that this is much slower than using the forward index on an IndexedPatternModel!!!
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_19findpattern(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_18findpattern[] = "Generator over the indexes in the corpus where this pattern is found. Note that this is much slower than using the forward index on an IndexedPatternModel!!!\n\n        :param pattern: The pattern to find\n        :type pattern: Pattern\n        :param sentence: Set to a non-zero value to limit the search to a single sentence (default: 0, search entire corpus)\n        :type sentence: int\n        :param instantiate: Instantiate all skipgrams and flexgrams (i.e, return n-grams) (default: False)\n        :type instantiate: bool\n        :rtype: generator over ((sentence, tokenoffset),pattern) tuples\n        ";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_19findpattern(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_v_sentence;
  bool __pyx_v_instantiate;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findpattern (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_sentence,&__pyx_n_s_instantiate,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentence);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_instantiate);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findpattern") < 0)) __PYX_ERR(1, 4085, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    if (values[1]) {
      __pyx_v_sentence = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4085, __pyx_L3_error)
    } else {
      __pyx_v_sentence = ((int)0);
    }
    if (values[2]) {
      __pyx_v_instantiate = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_instantiate == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 4085, __pyx_L3_error)
    } else {
      __pyx_v_instantiate = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findpattern", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4085, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.findpattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4085, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_18findpattern(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), __pyx_v_pattern, __pyx_v_sentence, __pyx_v_instantiate);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_18findpattern(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, int __pyx_v_sentence, bool __pyx_v_instantiate) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findpattern", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)__pyx_tp_new_11colibricore___pyx_scope_struct_69_findpattern(__pyx_ptype_11colibricore___pyx_scope_struct_69_findpattern, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4085, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
  __pyx_cur_scope->__pyx_v_sentence = __pyx_v_sentence;
  __pyx_cur_scope->__pyx_v_instantiate = __pyx_v_instantiate;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_13IndexedCorpus_20generator69, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_findpattern, __pyx_n_s_IndexedCorpus_findpattern, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4085, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.findpattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_20generator69(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  IndexReference __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findpattern", 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_ERR(1, 4085, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4099
 *         cdef cPattern cpattern
 *         cdef cIndexReference ref
 *         matches = self.data.findpattern(pattern.cpattern,sentence,instantiate)             # <<<<<<<<<<<<<<
 *         it = matches.begin()
 *         while it != matches.end():
 */
  __pyx_cur_scope->__pyx_v_matches = __pyx_cur_scope->__pyx_v_self->data->findpattern(__pyx_cur_scope->__pyx_v_pattern->cpattern, __pyx_cur_scope->__pyx_v_sentence, __pyx_cur_scope->__pyx_v_instantiate);

  /* "colibricore_wrapper.pyx":4100
 *         cdef cIndexReference ref
 *         matches = self.data.findpattern(pattern.cpattern,sentence,instantiate)
 *         it = matches.begin()             # <<<<<<<<<<<<<<
 *         while it != matches.end():
 *             ref = deref(it).first
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_matches.begin();

  /* "colibricore_wrapper.pyx":4101
 *         matches = self.data.findpattern(pattern.cpattern,sentence,instantiate)
 *         it = matches.begin()
 *         while it != matches.end():             # <<<<<<<<<<<<<<
 *             ref = deref(it).first
 *             cpattern = deref(it).second.pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_matches.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4102
 *         it = matches.begin()
 *         while it != matches.end():
 *             ref = deref(it).first             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).second.pattern()
 *             foundpattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_ref = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4103
 *         while it != matches.end():
 *             ref = deref(it).first
 *             cpattern = deref(it).second.pattern()             # <<<<<<<<<<<<<<
 *             foundpattern = Pattern()
 *             foundpattern.bind(cpattern)
 */
    __pyx_cur_scope->__pyx_v_cpattern = (*__pyx_cur_scope->__pyx_v_it).second.pattern();

    /* "colibricore_wrapper.pyx":4104
 *             ref = deref(it).first
 *             cpattern = deref(it).second.pattern()
 *             foundpattern = Pattern()             # <<<<<<<<<<<<<<
 *             foundpattern.bind(cpattern)
 *             yield ((ref.sentence, ref.token), foundpattern)
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_foundpattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_foundpattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4105
 *             cpattern = deref(it).second.pattern()
 *             foundpattern = Pattern()
 *             foundpattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield ((ref.sentence, ref.token), foundpattern)
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_foundpattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_foundpattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4106
 *             foundpattern = Pattern()
 *             foundpattern.bind(cpattern)
 *             yield ((ref.sentence, ref.token), foundpattern)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_ref.sentence); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_uint16_t(__pyx_cur_scope->__pyx_v_ref.token); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_foundpattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_foundpattern));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_foundpattern));
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4106, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4107
 *             foundpattern.bind(cpattern)
 *             yield ((ref.sentence, ref.token), foundpattern)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4085
 *             inc(it)
 * 
 *     def findpattern(self, Pattern pattern, int sentence = 0, bool instantiate = False):             # <<<<<<<<<<<<<<
 *         """Generator over the indexes in the corpus where this pattern is found. Note that this is much slower than using the forward index on an IndexedPatternModel!!!
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("findpattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4109
 *             inc(it)
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         cdef cIndexReference ref = cIndexReference(pos[0],pos[1])
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_22getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_21getinstance[] = "Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found.";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_22getinstance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinstance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, 1); __PYX_ERR(1, 4109, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getinstance") < 0)) __PYX_ERR(1, 4109, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pos = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getinstance", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4109, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(1, 4109, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4109, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_21getinstance(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), __pyx_v_pos, __pyx_v_pattern);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_21getinstance(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, PyObject *__pyx_v_pos, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  IndexReference __pyx_v_ref;
  PatternPointer __pyx_v_ppin;
  PatternPointer __pyx_v_ppout;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_foundpattern = NULL;
  Pattern __pyx_v_cpattern;
  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("getinstance", 0);

  /* "colibricore_wrapper.pyx":4111
 *     def getinstance(self, tuple pos, Pattern pattern):
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         cdef cIndexReference ref = cIndexReference(pos[0],pos[1])             # <<<<<<<<<<<<<<
 *         cdef cPatternPointer ppin = pattern.cpattern.getpointer()
 *         cdef cPatternPointer ppout = self.data.getinstance(ref,ppin)
 */
  if (unlikely(__pyx_v_pos == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4111, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_pos == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4111, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ref = IndexReference(__pyx_t_2, __pyx_t_3);

  /* "colibricore_wrapper.pyx":4112
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         cdef cIndexReference ref = cIndexReference(pos[0],pos[1])
 *         cdef cPatternPointer ppin = pattern.cpattern.getpointer()             # <<<<<<<<<<<<<<
 *         cdef cPatternPointer ppout = self.data.getinstance(ref,ppin)
 *         foundpattern = Pattern()
 */
  __pyx_v_ppin = __pyx_v_pattern->cpattern.getpointer();

  /* "colibricore_wrapper.pyx":4113
 *         cdef cIndexReference ref = cIndexReference(pos[0],pos[1])
 *         cdef cPatternPointer ppin = pattern.cpattern.getpointer()
 *         cdef cPatternPointer ppout = self.data.getinstance(ref,ppin)             # <<<<<<<<<<<<<<
 *         foundpattern = Pattern()
 *         cdef cPattern cpattern = ppout.pattern()
 */
  __pyx_v_ppout = __pyx_v_self->data->getinstance(__pyx_v_ref, __pyx_v_ppin);

  /* "colibricore_wrapper.pyx":4114
 *         cdef cPatternPointer ppin = pattern.cpattern.getpointer()
 *         cdef cPatternPointer ppout = self.data.getinstance(ref,ppin)
 *         foundpattern = Pattern()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern = ppout.pattern()
 *         foundpattern.bind(cpattern)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_foundpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4115
 *         cdef cPatternPointer ppout = self.data.getinstance(ref,ppin)
 *         foundpattern = Pattern()
 *         cdef cPattern cpattern = ppout.pattern()             # <<<<<<<<<<<<<<
 *         foundpattern.bind(cpattern)
 *         return foundpattern
 */
  __pyx_v_cpattern = __pyx_v_ppout.pattern();

  /* "colibricore_wrapper.pyx":4116
 *         foundpattern = Pattern()
 *         cdef cPattern cpattern = ppout.pattern()
 *         foundpattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *         return foundpattern
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_foundpattern->__pyx_vtab)->bind(__pyx_v_foundpattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4117
 *         cdef cPattern cpattern = ppout.pattern()
 *         foundpattern.bind(cpattern)
 *         return foundpattern             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_foundpattern));
  __pyx_r = ((PyObject *)__pyx_v_foundpattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4109
 *             inc(it)
 * 
 *     def getinstance(self, tuple pos, Pattern pattern):             # <<<<<<<<<<<<<<
 *         """Gets a specific instance of a pattern (skipgram or flexgram), at the specified position. Raises a KeyError when not found."""
 *         cdef cIndexReference ref = cIndexReference(pos[0],pos[1])
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.getinstance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_foundpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4120
 * 
 * 
 *     def sentencecount(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of sentences. ( The C++ equivalent is called sentences() ) """
 *         return self.data.sentences()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_24sentencecount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_23sentencecount[] = "Returns the number of sentences. ( The C++ equivalent is called sentences() ) ";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_24sentencecount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sentencecount (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_23sentencecount(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_23sentencecount(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sentencecount", 0);

  /* "colibricore_wrapper.pyx":4122
 *     def sentencecount(self):
 *         """Returns the number of sentences. ( The C++ equivalent is called sentences() ) """
 *         return self.data.sentences()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data->sentences()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4120
 * 
 * 
 *     def sentencecount(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of sentences. ( The C++ equivalent is called sentences() ) """
 *         return self.data.sentences()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.sentencecount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4125
 * 
 * 
 *     def getsentence(self, int i):             # <<<<<<<<<<<<<<
 *         """Get the specified sentence as a pattern, raises KeyError when the sentence, or tokens therein, does not exist"""
 *         cdef cPattern cpattern = self.data.getsentence(i)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_26getsentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_25getsentence[] = "Get the specified sentence as a pattern, raises KeyError when the sentence, or tokens therein, does not exist";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_26getsentence(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getsentence (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4125, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.getsentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_25getsentence(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_25getsentence(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, int __pyx_v_i) {
  Pattern __pyx_v_cpattern;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Pattern __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getsentence", 0);

  /* "colibricore_wrapper.pyx":4127
 *     def getsentence(self, int i):
 *         """Get the specified sentence as a pattern, raises KeyError when the sentence, or tokens therein, does not exist"""
 *         cdef cPattern cpattern = self.data.getsentence(i)             # <<<<<<<<<<<<<<
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 */
  try {
    __pyx_t_1 = __pyx_v_self->data->getsentence(__pyx_v_i);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_KeyError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_KeyError); }
    __PYX_ERR(1, 4127, __pyx_L1_error)
  }
  __pyx_v_cpattern = __pyx_t_1;

  /* "colibricore_wrapper.pyx":4128
 *         """Get the specified sentence as a pattern, raises KeyError when the sentence, or tokens therein, does not exist"""
 *         cdef cPattern cpattern = self.data.getsentence(i)
 *         pattern = Pattern()             # <<<<<<<<<<<<<<
 *         pattern.bind(cpattern)
 *         return pattern
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "colibricore_wrapper.pyx":4129
 *         cdef cPattern cpattern = self.data.getsentence(i)
 *         pattern = Pattern()
 *         pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *         return pattern
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_pattern->__pyx_vtab)->bind(__pyx_v_pattern, __pyx_v_cpattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "colibricore_wrapper.pyx":4130
 *         pattern = Pattern()
 *         pattern.bind(cpattern)
 *         return pattern             # <<<<<<<<<<<<<<
 * 
 *     def sentences(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
  __pyx_r = ((PyObject *)__pyx_v_pattern);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4125
 * 
 * 
 *     def getsentence(self, int i):             # <<<<<<<<<<<<<<
 *         """Get the specified sentence as a pattern, raises KeyError when the sentence, or tokens therein, does not exist"""
 *         cdef cPattern cpattern = self.data.getsentence(i)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.getsentence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_29generator70(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4132
 *         return pattern
 * 
 *     def sentences(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all sentences, returning each as a pattern"""
 *         cdef int sentencecount = self.data.sentences()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_28sentences(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_27sentences[] = "Iterates over all sentences, returning each as a pattern";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_28sentences(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sentences (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_27sentences(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_27sentences(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sentences", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)__pyx_tp_new_11colibricore___pyx_scope_struct_70_sentences(__pyx_ptype_11colibricore___pyx_scope_struct_70_sentences, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4132, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_13IndexedCorpus_29generator70, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_sentences, __pyx_n_s_IndexedCorpus_sentences, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.sentences", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_13IndexedCorpus_29generator70(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sentences", 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_ERR(1, 4132, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4134
 *     def sentences(self):
 *         """Iterates over all sentences, returning each as a pattern"""
 *         cdef int sentencecount = self.data.sentences()             # <<<<<<<<<<<<<<
 *         for i in range(1, sentencecount+1):
 *             yield self.getsentence(i)
 */
  __pyx_cur_scope->__pyx_v_sentencecount = __pyx_cur_scope->__pyx_v_self->data->sentences();

  /* "colibricore_wrapper.pyx":4135
 *         """Iterates over all sentences, returning each as a pattern"""
 *         cdef int sentencecount = self.data.sentences()
 *         for i in range(1, sentencecount+1):             # <<<<<<<<<<<<<<
 *             yield self.getsentence(i)
 * 
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_sentencecount + 1);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;

    /* "colibricore_wrapper.pyx":4136
 *         cdef int sentencecount = self.data.sentences()
 *         for i in range(1, sentencecount+1):
 *             yield self.getsentence(i)             # <<<<<<<<<<<<<<
 * 
 *     def sentencelength(self,int sentence):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_getsentence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4136, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4132
 *         return pattern
 * 
 *     def sentences(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all sentences, returning each as a pattern"""
 *         cdef int sentencecount = self.data.sentences()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("sentences", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4138
 *             yield self.getsentence(i)
 * 
 *     def sentencelength(self,int sentence):             # <<<<<<<<<<<<<<
 *         """Returns the length of the specified sentences, raises KeyError when it doesn't exist"""
 *         return self.data.sentencelength(sentence)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_31sentencelength(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence); /*proto*/
static char __pyx_doc_11colibricore_13IndexedCorpus_30sentencelength[] = "Returns the length of the specified sentences, raises KeyError when it doesn't exist";
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_31sentencelength(PyObject *__pyx_v_self, PyObject *__pyx_arg_sentence) {
  int __pyx_v_sentence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sentencelength (wrapper)", 0);
  assert(__pyx_arg_sentence); {
    __pyx_v_sentence = __Pyx_PyInt_As_int(__pyx_arg_sentence); if (unlikely((__pyx_v_sentence == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4138, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.IndexedCorpus.sentencelength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_30sentencelength(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), ((int)__pyx_v_sentence));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_30sentencelength(struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, int __pyx_v_sentence) {
  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("sentencelength", 0);

  /* "colibricore_wrapper.pyx":4140
 *     def sentencelength(self,int sentence):
 *         """Returns the length of the specified sentences, raises KeyError when it doesn't exist"""
 *         return self.data.sentencelength(sentence)             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternVector:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data->sentencelength(__pyx_v_sentence)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4138
 *             yield self.getsentence(i)
 * 
 *     def sentencelength(self,int sentence):             # <<<<<<<<<<<<<<
 *         """Returns the length of the specified sentences, raises KeyError when it doesn't exist"""
 *         return self.data.sentencelength(sentence)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.sentencelength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_33__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_33__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_32__reduce_cython__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_35__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_13IndexedCorpus_35__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13IndexedCorpus_34__setstate_cython__(((struct __pyx_obj_11colibricore_IndexedCorpus *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13IndexedCorpus_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_IndexedCorpus *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.IndexedCorpus.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4145
 *     cdef cPatternVector data
 * 
 *     cdef bind(self, cPatternVector & cvec):             # <<<<<<<<<<<<<<
 *         self.data = cvec
 * 
 */

static PyObject *__pyx_f_11colibricore_13PatternVector_bind(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, PatternVector &__pyx_v_cvec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":4146
 * 
 *     cdef bind(self, cPatternVector & cvec):
 *         self.data = cvec             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_v_self->data = __pyx_v_cvec;

  /* "colibricore_wrapper.pyx":4145
 *     cdef cPatternVector data
 * 
 *     cdef bind(self, cPatternVector & cvec):             # <<<<<<<<<<<<<<
 *         self.data = cvec
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4148
 *         self.data = cvec
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_13PatternVector_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_11colibricore_13PatternVector_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13PatternVector___len__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_13PatternVector___len__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":4149
 * 
 *     def __len__(self):
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4148
 *         self.data = cvec
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4151
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_13PatternVector_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_13PatternVector_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13PatternVector_2__bool__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_13PatternVector_2__bool__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":4152
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     cdef has(self, Pattern pattern):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4151
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4154
 *         return self.data.size() > 0
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_f_11colibricore_13PatternVector_has(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);

  /* "colibricore_wrapper.pyx":4155
 * 
 *     cdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4154
 *         return self.data.size() > 0
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternVector.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4157
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_13PatternVector_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static int __pyx_pw_11colibricore_13PatternVector_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4157, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_13PatternVector_4__contains__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_13PatternVector_4__contains__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":4158
 * 
 *     def __contains__(self, Pattern pattern):
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     cdef append(self, Pattern pattern):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_PatternVector *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4157
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternVector.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4160
 *         return self.has(pattern)
 * 
 *     cdef append(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         self.data.insert(pattern.cpattern)
 * 
 */

static PyObject *__pyx_f_11colibricore_13PatternVector_append(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append", 0);

  /* "colibricore_wrapper.pyx":4161
 * 
 *     cdef append(self, Pattern pattern):
 *         self.data.insert(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->data.insert(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":4160
 *         return self.has(pattern)
 * 
 *     cdef append(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         self.data.insert(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_13PatternVector_8generator71(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4163
 *         self.data.insert(pattern.cpattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternVector.iterator it_end = self.data.end()
 *         cdef cPatternVector.iterator it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13PatternVector_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_11colibricore_13PatternVector_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13PatternVector_6__iter__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13PatternVector_6__iter__(struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_71___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_71___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4163, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_13PatternVector_8generator71, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternVector___iter, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_13PatternVector_8generator71(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 4163, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4164
 * 
 *     def __iter__(self):
 *         cdef cPatternVector.iterator it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         cdef cPatternVector.iterator it = self.data.begin()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4165
 *     def __iter__(self):
 *         cdef cPatternVector.iterator it_end = self.data.end()
 *         cdef cPatternVector.iterator it = self.data.begin()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             pattern = Pattern()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4166
 *         cdef cPatternVector.iterator it_end = self.data.end()
 *         cdef cPatternVector.iterator it = self.data.begin()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(deref(it))
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4167
 *         cdef cPatternVector.iterator it = self.data.begin()
 *         while it != it_end:
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(deref(it))
 *             yield pattern
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4168
 *         while it != it_end:
 *             pattern = Pattern()
 *             pattern.bind(deref(it))             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, (*__pyx_cur_scope->__pyx_v_it)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4169
 *             pattern = Pattern()
 *             pattern.bind(deref(it))
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4169, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4170
 *             pattern.bind(deref(it))
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * cdef class PatternFeatureVectorMap_float:
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4163
 *         self.data.insert(pattern.cpattern)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternVector.iterator it_end = self.data.end()
 *         cdef cPatternVector.iterator it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13PatternVector_10__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_13PatternVector_10__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13PatternVector_9__reduce_cython__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13PatternVector_9__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternVector.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_13PatternVector_12__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_13PatternVector_12__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_13PatternVector_11__setstate_cython__(((struct __pyx_obj_11colibricore_PatternVector *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_13PatternVector_11__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternVector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternVector.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4176
 *     cdef cPatternFeatureVectorMap[double].iterator it
 * 
 *     cdef bind(self, cPatternFeatureVectorMap[double] & cmap):             # <<<<<<<<<<<<<<
 *         self.data = cmap
 * 
 */

static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_bind(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PatternFeatureVectorMap<double>  &__pyx_v_cmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);

  /* "colibricore_wrapper.pyx":4177
 * 
 *     cdef bind(self, cPatternFeatureVectorMap[double] & cmap):
 *         self.data = cmap             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_v_self->data = __pyx_v_cmap;

  /* "colibricore_wrapper.pyx":4176
 *     cdef cPatternFeatureVectorMap[double].iterator it
 * 
 *     cdef bind(self, cPatternFeatureVectorMap[double] & cmap):             # <<<<<<<<<<<<<<
 *         self.data = cmap
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4179
 *         self.data = cmap
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float___len__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_29PatternFeatureVectorMap_float___len__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":4180
 * 
 *     def __len__(self):
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4179
 *         self.data = cmap
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4183
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_2__bool__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_2__bool__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":4184
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     cdef has(self, Pattern pattern):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4183
 * 
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4186
 *         return self.data.size() > 0
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_has(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  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("has", 0);

  /* "colibricore_wrapper.pyx":4187
 * 
 *     cdef has(self, Pattern pattern):
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4186
 *         return self.data.size() > 0
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4189
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4189, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_4__contains__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_4__contains__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":4190
 * 
 *     def __contains__(self, Pattern pattern):
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     cdef getdata(self, Pattern pattern):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, __pyx_v_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4189
 *         return self.data.has(pattern.cpattern)
 * 
 *     def __contains__(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         return self.has(pattern)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4192
 *         return self.has(pattern)
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         targetpattern = Pattern()
 */

static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_getdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PatternFeatureVector<double>  *__pyx_v_v;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_targetpattern = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);

  /* "colibricore_wrapper.pyx":4193
 * 
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)             # <<<<<<<<<<<<<<
 *         targetpattern = Pattern()
 *         targetpattern.bind(v.pattern)
 */
  __pyx_v_v = __pyx_v_self->data.getdata(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":4194
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         targetpattern = Pattern()             # <<<<<<<<<<<<<<
 *         targetpattern.bind(v.pattern)
 *         return (targetpattern, v.data)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_targetpattern = ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4195
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         targetpattern = Pattern()
 *         targetpattern.bind(v.pattern)             # <<<<<<<<<<<<<<
 *         return (targetpattern, v.data)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_v_targetpattern->__pyx_vtab)->bind(__pyx_v_targetpattern, __pyx_v_v->pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4196
 *         targetpattern = Pattern()
 *         targetpattern.bind(v.pattern)
 *         return (targetpattern, v.data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_double(__pyx_v_v->data); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_targetpattern));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_targetpattern));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_targetpattern));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4192
 *         return self.has(pattern)
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         targetpattern = Pattern()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_targetpattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4198
 *         return (targetpattern, v.data)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Argument must be Pattern instance")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_6__getitem__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_6__getitem__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":4199
 * 
 *     def __getitem__(self, pattern):
 *         if not isinstance(pattern,Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument must be Pattern instance")
 *         return self.getdata(pattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4200
 *     def __getitem__(self, pattern):
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Argument must be Pattern instance")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4200, __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_ERR(1, 4200, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4199
 * 
 *     def __getitem__(self, pattern):
 *         if not isinstance(pattern,Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument must be Pattern instance")
 *         return self.getdata(pattern)
 */
  }

  /* "colibricore_wrapper.pyx":4201
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Argument must be Pattern instance")
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 *     cpdef setdata(self, Pattern pattern, tuple features):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4201, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4198
 *         return (targetpattern, v.data)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Argument must be Pattern instance")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4203
 *         return self.getdata(pattern)
 * 
 *     cpdef setdata(self, Pattern pattern, tuple features):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         v.data.clear()
 */

static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_9setdata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_29PatternFeatureVectorMap_float_setdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_features, int __pyx_skip_dispatch) {
  PatternFeatureVector<double>  *__pyx_v_v;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setdata", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setdata); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_9setdata)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_features};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4203, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), __pyx_v_features};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4203, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(__pyx_v_features);
          __Pyx_GIVEREF(__pyx_v_features);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_features);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":4204
 * 
 *     cpdef setdata(self, Pattern pattern, tuple features):
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)             # <<<<<<<<<<<<<<
 *         v.data.clear()
 *         for e in features:
 */
  __pyx_v_v = __pyx_v_self->data.getdata(__pyx_v_pattern->cpattern);

  /* "colibricore_wrapper.pyx":4205
 *     cpdef setdata(self, Pattern pattern, tuple features):
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         v.data.clear()             # <<<<<<<<<<<<<<
 *         for e in features:
 *             if isinstance(e,float) or isinstance(e, int):
 */
  __pyx_v_v->data.clear();

  /* "colibricore_wrapper.pyx":4206
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         v.data.clear()
 *         for e in features:             # <<<<<<<<<<<<<<
 *             if isinstance(e,float) or isinstance(e, int):
 *                 v.data.push_back(e)
 */
  if (unlikely(__pyx_v_features == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 4206, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_features; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
  for (;;) {
    if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 4206, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4207
 *         v.data.clear()
 *         for e in features:
 *             if isinstance(e,float) or isinstance(e, int):             # <<<<<<<<<<<<<<
 *                 v.data.push_back(e)
 *             else:
 */
    __pyx_t_9 = PyFloat_Check(__pyx_v_e); 
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_10 = PyInt_Check(__pyx_v_e); 
    __pyx_t_9 = (__pyx_t_10 != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L6_bool_binop_done:;
    if (likely(__pyx_t_8)) {

      /* "colibricore_wrapper.pyx":4208
 *         for e in features:
 *             if isinstance(e,float) or isinstance(e, int):
 *                 v.data.push_back(e)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError
 */
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_e); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 4208, __pyx_L1_error)
      try {
        __pyx_v_v->data.push_back(__pyx_t_11);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(1, 4208, __pyx_L1_error)
      }

      /* "colibricore_wrapper.pyx":4207
 *         v.data.clear()
 *         for e in features:
 *             if isinstance(e,float) or isinstance(e, int):             # <<<<<<<<<<<<<<
 *                 v.data.push_back(e)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "colibricore_wrapper.pyx":4210
 *                 v.data.push_back(e)
 *             else:
 *                 raise ValueError             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, pattern, value):
 */
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      __PYX_ERR(1, 4210, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "colibricore_wrapper.pyx":4206
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         v.data.clear()
 *         for e in features:             # <<<<<<<<<<<<<<
 *             if isinstance(e,float) or isinstance(e, int):
 *                 v.data.push_back(e)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4203
 *         return self.getdata(pattern)
 * 
 *     cpdef setdata(self, Pattern pattern, tuple features):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v = self.data.getdata(pattern.cpattern)
 *         v.data.clear()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.setdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_9setdata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_9setdata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  PyObject *__pyx_v_features = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setdata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_features,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_features)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setdata", 1, 2, 2, 1); __PYX_ERR(1, 4203, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdata") < 0)) __PYX_ERR(1, 4203, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_features = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setdata", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.setdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4203, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_features), (&PyTuple_Type), 1, "features", 1))) __PYX_ERR(1, 4203, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_8setdata(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self), __pyx_v_pattern, __pyx_v_features);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_8setdata(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, PyObject *__pyx_v_features) {
  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("setdata", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_29PatternFeatureVectorMap_float_setdata(__pyx_v_self, __pyx_v_pattern, __pyx_v_features, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.setdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4212
 *                 raise ValueError
 * 
 *     def __setitem__(self, pattern, value):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_10__setitem__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self), ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_10__setitem__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_value) {
  PyObject *__pyx_7genexpr__pyx_v_x = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "colibricore_wrapper.pyx":4213
 * 
 *     def __setitem__(self, pattern, value):
 *         if not isinstance(pattern,Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4214
 *     def __setitem__(self, pattern, value):
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")             # <<<<<<<<<<<<<<
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 *             raise ValueError("Value must be tuple containing floats")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4214, __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_ERR(1, 4214, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4213
 * 
 *     def __setitem__(self, pattern, value):
 *         if not isinstance(pattern,Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 */
  }

  /* "colibricore_wrapper.pyx":4215
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):             # <<<<<<<<<<<<<<
 *             raise ValueError("Value must be tuple containing floats")
 *         self.setdata(pattern, value)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_4 = ((!(__pyx_t_1 != 0)) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4215, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) {
      __pyx_t_5 = __pyx_v_value; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4215, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4215, __pyx_L9_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 4215, __pyx_L9_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4215, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 4215, __pyx_L9_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4215, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 4215, __pyx_L9_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_4 = PyFloat_Check(__pyx_7genexpr__pyx_v_x); 
      if (!__pyx_t_4) {
      } else {
        __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4215, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_4 = PyInt_Check(__pyx_7genexpr__pyx_v_x); 
      __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4215, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_L12_bool_binop_done:;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(1, 4215, __pyx_L9_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
    goto __pyx_L14_exit_scope;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
    goto __pyx_L1_error;
    __pyx_L14_exit_scope:;
  } /* exit inner scope */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 4215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4216
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 *             raise ValueError("Value must be tuple containing floats")             # <<<<<<<<<<<<<<
 *         self.setdata(pattern, value)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(1, 4216, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4215
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):             # <<<<<<<<<<<<<<
 *             raise ValueError("Value must be tuple containing floats")
 *         self.setdata(pattern, value)
 */
  }

  /* "colibricore_wrapper.pyx":4217
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 *             raise ValueError("Value must be tuple containing floats")
 *         self.setdata(pattern, value)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4217, __pyx_L1_error)
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 4217, __pyx_L1_error)
  __pyx_t_5 = ((struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self->__pyx_vtab)->setdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern), ((PyObject*)__pyx_v_value), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "colibricore_wrapper.pyx":4212
 *                 raise ValueError
 * 
 *     def __setitem__(self, pattern, value):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_29PatternFeatureVectorMap_float_14generator72(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4219
 *         self.setdata(pattern, value)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_13items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_13items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_12items(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_12items(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_72_items(__pyx_ptype_11colibricore___pyx_scope_struct_72_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4219, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_29PatternFeatureVectorMap_float_14generator72, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_PatternFeatureVectorMap_float_it, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_29PatternFeatureVectorMap_float_14generator72(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 4219, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4221
 *     def items(self):
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4222
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             v  = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4223
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             v  = deref(it)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4224
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:
 *             v  = deref(it)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)
 */
    __pyx_cur_scope->__pyx_v_v = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":4225
 *         while it != it_end:
 *             v  = deref(it)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(v.pattern)
 *             yield (pattern, v.data)
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4226
 *             v  = deref(it)
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)             # <<<<<<<<<<<<<<
 *             yield (pattern, v.data)
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_v->pattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4227
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)
 *             yield (pattern, v.data)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_2 = __pyx_convert_vector_to_py_double(__pyx_cur_scope->__pyx_v_v->data); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4227, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4228
 *             pattern.bind(v.pattern)
 *             yield (pattern, v.data)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4219
 *         self.setdata(pattern, value)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_29PatternFeatureVectorMap_float_17generator73(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4230
 *             inc(it)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_16__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_16__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_15__iter__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_15__iter__(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_73___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_73___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4230, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_29PatternFeatureVectorMap_float_17generator73, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternFeatureVectorMap_float, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4230, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_29PatternFeatureVectorMap_float_17generator73(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 4230, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4232
 *     def __iter__(self):
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4233
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         while it != it_end:
 *             v  = deref(it)
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4234
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             v  = deref(it)
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4235
 *         cdef cPatternFeatureVectorMap[double].iterator it_end = self.data.end()
 *         while it != it_end:
 *             v  = deref(it)             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)
 */
    __pyx_cur_scope->__pyx_v_v = (*__pyx_cur_scope->__pyx_v_it);

    /* "colibricore_wrapper.pyx":4236
 *         while it != it_end:
 *             v  = deref(it)
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(v.pattern)
 *             yield pattern
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_2));
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4237
 *             v  = deref(it)
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_v->pattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4238
 *             pattern = Pattern()
 *             pattern.bind(v.pattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4238, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4239
 *             pattern.bind(v.pattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4230
 *             inc(it)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * v
 *         cdef cPatternFeatureVectorMap[double].iterator it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_18__reduce_cython__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_29PatternFeatureVectorMap_float_20__setstate_cython__(((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_29PatternFeatureVectorMap_float_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternFeatureVectorMap_float.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4249
 *     cdef cPatternAlignmentModel[double].iterator it
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_27PatternAlignmentModel_float_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_27PatternAlignmentModel_float_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float___len__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_27PatternAlignmentModel_float___len__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":4251
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4249
 *     cdef cPatternAlignmentModel[double].iterator it
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4253
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_2__bool__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_2__bool__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":4254
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4253
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4256
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_4types(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_4types(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":4258
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4256
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4260
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_6tokens(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_6tokens(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":4262
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4260
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4264
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_8minlength(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_8minlength(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":4266
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4264
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4268
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_10maxlength(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_10maxlength(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":4270
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4268
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4272
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_12type(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_12type(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":4274
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.getmodeltype()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4272
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4276
 *         return self.data.getmodeltype()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_14version(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_14version(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":4278
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()             # <<<<<<<<<<<<<<
 * 
 *     cdef has(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.getmodelversion()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4276
 *         return self.data.getmodeltype()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4280
 *         return self.data.getmodelversion()
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_has(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":4281
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4282
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4282, __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_ERR(1, 4282, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4281
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":4283
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4280
 *         return self.data.getmodelversion()
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4285
 *         return self.data.has(pattern.cpattern)
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_hastuple(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hastuple", 0);

  /* "colibricore_wrapper.pyx":4286
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4287
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4287, __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_ERR(1, 4287, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4286
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":4288
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4285
 *         return self.data.has(pattern.cpattern)
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.hastuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4290
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_16__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern or a pair of patterns\n        :type pattern: Pattern or 2-tuple of patterns\n        :rtype: bool\n    \n        Example::\n    \n            sourcepattern in alignmodel\n            (sourcepattern, targetpattern) in alignmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_16__contains__;
#endif
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_16__contains__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_16__contains__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":4302
 *             (sourcepattern, targetpattern) in alignmodel
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_pattern); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4303
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 4303, __pyx_L1_error)
    __pyx_t_1 = ((__pyx_t_3 != 2) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4304
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4304, __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_ERR(1, 4304, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4303
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])
 */
    }

    /* "colibricore_wrapper.pyx":4305
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(pattern, Pattern):
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4305, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4305, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_self->__pyx_vtab)->hastuple(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4302
 *             (sourcepattern, targetpattern) in alignmodel
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":4307
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":4308
 * 
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 *         return self.has(pattern)
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(1, 4308, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4307
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4310
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4310, __pyx_L1_error)
  __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_8;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4290
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4312
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_18__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_18__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_18__getitem__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_18__getitem__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":4323
 *             occurrences = model[pattern]
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_pattern); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4324
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 4324, __pyx_L1_error)
    __pyx_t_1 = ((__pyx_t_3 != 2) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4325
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4325, __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_ERR(1, 4325, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4324
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])
 */
    }

    /* "colibricore_wrapper.pyx":4326
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(pattern, Pattern):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4326, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4326, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_self->__pyx_vtab)->getdatatuple(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4323
 *             occurrences = model[pattern]
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":4328
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":4329
 * 
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 *         return self.getdata(pattern)
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(1, 4329, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4328
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4331
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4331, __pyx_L1_error)
  __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4312
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__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_11colibricore_27PatternAlignmentModel_float_22generator74(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4335
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_21__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_20__iter__[] = "Iterates over all source patterns in the model.\n    \n        Example::\n    \n            for sourcepattern in alignmodel:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_20__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_21__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_20__iter__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_20__iter__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_74___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_74___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4335, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_27PatternAlignmentModel_float_22generator74, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PatternAlignmentModel_float___it, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4335, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_27PatternAlignmentModel_float_22generator74(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 4335, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4344
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4346
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4347
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4348
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4349
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4350
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4350, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4351
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4335
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4353
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise an alignment model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_24__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_23__init__[] = "Initialise an alignment model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri alignmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_23__init__;
#endif
static int __pyx_pw_11colibricore_27PatternAlignmentModel_float_24__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 4353, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4353, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4353, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_23__init__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_27PatternAlignmentModel_float_23__init__(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":4362
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.load(filename,options)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":4363
 *         """
 *         if filename:
 *             self.load(filename,options)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4363, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4363, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4362
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.load(filename,options)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4353
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise an alignment model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4365
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load an alignment model from file
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_26load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_25load[] = "Load an alignment model from file\n    \n        :param filename: The name of the file to load, must be a valid colibri alignmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_26load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 4365, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4365, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4365, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_25load(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_25load(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":4373
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_options) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4374
 *         """
 *         if options is None:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4373
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  }

  /* "colibricore_wrapper.pyx":4375
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 4375, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4376
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename), options.coptions)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 4376, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4375
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  }

  /* "colibricore_wrapper.pyx":4377
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 4377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 4377, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4365
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load an alignment model from file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4379
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_28read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_27read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_28read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 4379, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4379, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4379, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_27read(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_27read(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":4381
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4381, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4381, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4379
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4383
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write an alignment model to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_write(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_27PatternAlignmentModel_float_30write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4383, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":4389
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 4389, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 4389, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4383
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write an alignment model to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_29write[] = "Write an alignment model to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4383, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_29write(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_29write(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_27PatternAlignmentModel_float_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4391
 *         self.data.write(encode(filename))
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_27PatternAlignmentModel_float_getinterface(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":4392
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cdef getdata(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4391
 *         self.data.write(encode(filename))
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4394
 *         return self.data.getinterface()
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         if pattern in self:
 */

static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getdata(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PatternFeatureVectorMap<double>  __pyx_v_cmap;
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *__pyx_v_pmap = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);

  /* "colibricore_wrapper.pyx":4396
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cmap = deref(self.data.getdata(pattern.cpattern))
 *             pmap = PatternFeatureVectorMap_float()
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 4396, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4397
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         if pattern in self:
 *             cmap = deref(self.data.getdata(pattern.cpattern))             # <<<<<<<<<<<<<<
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)
 */
    __pyx_v_cmap = (*__pyx_v_self->data.getdata(__pyx_v_pattern->cpattern, NULL));

    /* "colibricore_wrapper.pyx":4398
 *         if pattern in self:
 *             cmap = deref(self.data.getdata(pattern.cpattern))
 *             pmap = PatternFeatureVectorMap_float()             # <<<<<<<<<<<<<<
 *             pmap.bind(cmap)
 *             return pmap
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternFeatureVectorMap_float)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_pmap = ((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4399
 *             cmap = deref(self.data.getdata(pattern.cpattern))
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)             # <<<<<<<<<<<<<<
 *             return pmap
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *)__pyx_v_pmap->__pyx_vtab)->bind(__pyx_v_pmap, __pyx_v_cmap); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4400
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)
 *             return pmap             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_pmap));
    __pyx_r = ((PyObject *)__pyx_v_pmap);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4396
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cmap = deref(self.data.getdata(pattern.cpattern))
 *             pmap = PatternFeatureVectorMap_float()
 */
  }

  /* "colibricore_wrapper.pyx":4402
 *             return pmap
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     cdef getfeatures(self, cPatternFeatureVector[double] * cvec):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 4402, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4394
 *         return self.data.getinterface()
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         if pattern in self:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pmap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4404
 *             raise KeyError
 * 
 *     cdef getfeatures(self, cPatternFeatureVector[double] * cvec):             # <<<<<<<<<<<<<<
 *         return cvec.data
 * 
 */

static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getfeatures(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, PatternFeatureVector<double>  *__pyx_v_cvec) {
  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("getfeatures", 0);

  /* "colibricore_wrapper.pyx":4405
 * 
 *     cdef getfeatures(self, cPatternFeatureVector[double] * cvec):
 *         return cvec.data             # <<<<<<<<<<<<<<
 * 
 *     cdef getdatatuple(self, Pattern pattern, Pattern pattern2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_double(__pyx_v_cvec->data); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4404
 *             raise KeyError
 * 
 *     cdef getfeatures(self, cPatternFeatureVector[double] * cvec):             # <<<<<<<<<<<<<<
 *         return cvec.data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.getfeatures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4407
 *         return cvec.data
 * 
 *     cdef getdatatuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * cvec
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):
 */

static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_getdatatuple(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  PatternFeatureVector<double>  *__pyx_v_cvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdatatuple", 0);

  /* "colibricore_wrapper.pyx":4409
 *     cdef getdatatuple(self, Pattern pattern, Pattern pattern2):
 *         cdef cPatternFeatureVector[double] * cvec
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):             # <<<<<<<<<<<<<<
 *             cvec = self.data.getfeaturevector(pattern.cpattern, pattern2.cpattern)
 *             return self.getfeatures(cvec)
 */
  __pyx_t_1 = (__pyx_v_self->data.has(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern) != 0);
  if (likely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":4410
 *         cdef cPatternFeatureVector[double] * cvec
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):
 *             cvec = self.data.getfeaturevector(pattern.cpattern, pattern2.cpattern)             # <<<<<<<<<<<<<<
 *             return self.getfeatures(cvec)
 *         else:
 */
    __pyx_v_cvec = __pyx_v_self->data.getfeaturevector(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern, NULL);

    /* "colibricore_wrapper.pyx":4411
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):
 *             cvec = self.data.getfeaturevector(pattern.cpattern, pattern2.cpattern)
 *             return self.getfeatures(cvec)             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_v_self->__pyx_vtab)->getfeatures(__pyx_v_self, __pyx_v_cvec); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4409
 *     cdef getdatatuple(self, Pattern pattern, Pattern pattern2):
 *         cdef cPatternFeatureVector[double] * cvec
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):             # <<<<<<<<<<<<<<
 *             cvec = self.data.getfeaturevector(pattern.cpattern, pattern2.cpattern)
 *             return self.getfeatures(cvec)
 */
  }

  /* "colibricore_wrapper.pyx":4413
 *             return self.getfeatures(cvec)
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 4413, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4407
 *         return cvec.data
 * 
 *     cdef getdatatuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         cdef cPatternFeatureVector[double] * cvec
 *         if self.data.has(pattern.cpattern, pattern2.cpattern):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.getdatatuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_27PatternAlignmentModel_float_33generator75(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4415
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternFeatureVectorMaps in this model"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_32items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_31items[] = "Iterate over all patterns and PatternFeatureVectorMaps in this model";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_32items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_31items(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_31items(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_75_items(__pyx_ptype_11colibricore___pyx_scope_struct_75_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4415, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_27PatternAlignmentModel_float_33generator75, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_PatternAlignmentModel_float_item, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4415, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_27PatternAlignmentModel_float_33generator75(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PatternFeatureVectorMap<double>  __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 4415, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4417
 *     def items(self):
 *         """Iterate over all patterns and PatternFeatureVectorMaps in this model"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         it_end = self.data.end()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4418
 *         """Iterate over all patterns and PatternFeatureVectorMaps in this model"""
 *         it = self.data.begin()
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cPatternFeatureVectorMap[double] cmap
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4421
 *         cdef cPattern cpattern
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cmap = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4422
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cmap = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4423
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             cmap = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cmap = __pyx_t_3;

    /* "colibricore_wrapper.pyx":4424
 *             cpattern = deref(it).first
 *             cmap = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             pmap = PatternFeatureVectorMap_float()
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4425
 *             cmap = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4426
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             pmap = PatternFeatureVectorMap_float()             # <<<<<<<<<<<<<<
 *             pmap.bind(cmap)
 *             yield (pattern,pmap)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternFeatureVectorMap_float)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pmap));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pmap, ((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4427
 *             pattern.bind(cpattern)
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)             # <<<<<<<<<<<<<<
 *             yield (pattern,pmap)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float *)__pyx_cur_scope->__pyx_v_pmap->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pmap, __pyx_cur_scope->__pyx_v_cmap); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4428
 *             pmap = PatternFeatureVectorMap_float()
 *             pmap.bind(cmap)
 *             yield (pattern,pmap)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pmap));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pmap));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pmap));
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4428, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4429
 *             pmap.bind(cmap)
 *             yield (pattern,pmap)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def triples(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4415
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternFeatureVectorMaps in this model"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_27PatternAlignmentModel_float_36generator76(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4431
 *             inc(it)
 * 
 *     def triples(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern, feature triples"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_35triples(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_34triples[] = "Iterate over sourcepattern, targetpattern, feature triples";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_35triples(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("triples (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_34triples(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_34triples(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("triples", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)__pyx_tp_new_11colibricore___pyx_scope_struct_76_triples(__pyx_ptype_11colibricore___pyx_scope_struct_76_triples, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4431, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_27PatternAlignmentModel_float_36generator76, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_triples, __pyx_n_s_PatternAlignmentModel_float_trip, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4431, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_27PatternAlignmentModel_float_36generator76(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PatternFeatureVectorMap<double>  __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("triples", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4431, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4433
 *     def triples(self):
 *         """Iterate over sourcepattern, targetpattern, feature triples"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         it_end = self.data.end()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4434
 *         """Iterate over sourcepattern, targetpattern, feature triples"""
 *         it = self.data.begin()
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cPatternFeatureVectorMap[double] cmap
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4437
 *         cdef cPattern cpattern
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cmap = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4438
 *         cdef cPatternFeatureVectorMap[double] cmap
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cmap = deref(it).second
 *             sourcepattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4439
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             cmap = deref(it).second             # <<<<<<<<<<<<<<
 *             sourcepattern = Pattern()
 *             sourcepattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cmap = __pyx_t_3;

    /* "colibricore_wrapper.pyx":4440
 *             cpattern = deref(it).first
 *             cmap = deref(it).second
 *             sourcepattern = Pattern()             # <<<<<<<<<<<<<<
 *             sourcepattern.bind(cpattern)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sourcepattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4441
 *             cmap = deref(it).second
 *             sourcepattern = Pattern()
 *             sourcepattern.bind(cpattern)             # <<<<<<<<<<<<<<
 * 
 *             it2 = cmap.begin()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_sourcepattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_sourcepattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4443
 *             sourcepattern.bind(cpattern)
 * 
 *             it2 = cmap.begin()             # <<<<<<<<<<<<<<
 *             it2_end = cmap.end()
 *             while it2 != it2_end:
 */
    __pyx_cur_scope->__pyx_v_it2 = __pyx_cur_scope->__pyx_v_cmap.begin();

    /* "colibricore_wrapper.pyx":4444
 * 
 *             it2 = cmap.begin()
 *             it2_end = cmap.end()             # <<<<<<<<<<<<<<
 *             while it2 != it2_end:
 *                 cvec = deref(it2)
 */
    __pyx_cur_scope->__pyx_v_it2_end = __pyx_cur_scope->__pyx_v_cmap.end();

    /* "colibricore_wrapper.pyx":4445
 *             it2 = cmap.begin()
 *             it2_end = cmap.end()
 *             while it2 != it2_end:             # <<<<<<<<<<<<<<
 *                 cvec = deref(it2)
 *                 targetpattern = Pattern()
 */
    while (1) {
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it2 != __pyx_cur_scope->__pyx_v_it2_end) != 0);
      if (!__pyx_t_1) break;

      /* "colibricore_wrapper.pyx":4446
 *             it2_end = cmap.end()
 *             while it2 != it2_end:
 *                 cvec = deref(it2)             # <<<<<<<<<<<<<<
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(cvec.pattern)
 */
      __pyx_cur_scope->__pyx_v_cvec = (*__pyx_cur_scope->__pyx_v_it2);

      /* "colibricore_wrapper.pyx":4447
 *             while it2 != it2_end:
 *                 cvec = deref(it2)
 *                 targetpattern = Pattern()             # <<<<<<<<<<<<<<
 *                 targetpattern.bind(cvec.pattern)
 *                 yield (sourcepattern, targetpattern, self.getfeatures(cvec) )
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_targetpattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":4448
 *                 cvec = deref(it2)
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(cvec.pattern)             # <<<<<<<<<<<<<<
 *                 yield (sourcepattern, targetpattern, self.getfeatures(cvec) )
 *                 inc(it2)
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_targetpattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_targetpattern, __pyx_cur_scope->__pyx_v_cvec->pattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":4449
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(cvec.pattern)
 *                 yield (sourcepattern, targetpattern, self.getfeatures(cvec) )             # <<<<<<<<<<<<<<
 *                 inc(it2)
 *             inc(it)
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->getfeatures(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_cvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L8_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4449, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4450
 *                 targetpattern.bind(cvec.pattern)
 *                 yield (sourcepattern, targetpattern, self.getfeatures(cvec) )
 *                 inc(it2)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
      (void)((++__pyx_cur_scope->__pyx_v_it2));
    }

    /* "colibricore_wrapper.pyx":4451
 *                 yield (sourcepattern, targetpattern, self.getfeatures(cvec) )
 *                 inc(it2)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2, tuple l):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4431
 *             inc(it)
 * 
 *     def triples(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern, feature triples"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4453
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2, tuple l):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_27PatternAlignmentModel_float_add(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, PyObject *__pyx_v_l, int __pyx_skip_dispatch) {
  std::vector<double>  __pyx_v_v;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4453, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_27PatternAlignmentModel_float_38add)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2), __pyx_v_l};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4453, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2), __pyx_v_l};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4453, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern2));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern2));
          __Pyx_INCREF(__pyx_v_l);
          __Pyx_GIVEREF(__pyx_v_l);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_l);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":4465
 *         """
 *         cdef vector[double] v
 *         for e in l:             # <<<<<<<<<<<<<<
 *             if not isinstance(e, float) and not isinstance(e, int):
 *                 raise ValueError("Expected list with instances of float")
 */
  if (unlikely(__pyx_v_l == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 4465, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_l; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
  for (;;) {
    if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 4465, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4466
 *         cdef vector[double] v
 *         for e in l:
 *             if not isinstance(e, float) and not isinstance(e, int):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected list with instances of float")
 *             v.push_back(e)
 */
    __pyx_t_9 = PyFloat_Check(__pyx_v_e); 
    __pyx_t_10 = ((!(__pyx_t_9 != 0)) != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_10 = PyInt_Check(__pyx_v_e); 
    __pyx_t_9 = ((!(__pyx_t_10 != 0)) != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L6_bool_binop_done:;
    if (unlikely(__pyx_t_8)) {

      /* "colibricore_wrapper.pyx":4467
 *         for e in l:
 *             if not isinstance(e, float) and not isinstance(e, int):
 *                 raise ValueError("Expected list with instances of float")             # <<<<<<<<<<<<<<
 *             v.push_back(e)
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 4467, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4466
 *         cdef vector[double] v
 *         for e in l:
 *             if not isinstance(e, float) and not isinstance(e, int):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected list with instances of float")
 *             v.push_back(e)
 */
    }

    /* "colibricore_wrapper.pyx":4468
 *             if not isinstance(e, float) and not isinstance(e, int):
 *                 raise ValueError("Expected list with instances of float")
 *             v.push_back(e)             # <<<<<<<<<<<<<<
 * 
 *         self.data.add(pattern.cpattern,pattern2.cpattern, v)
 */
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_e); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 4468, __pyx_L1_error)
    try {
      __pyx_v_v.push_back(__pyx_t_11);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 4468, __pyx_L1_error)
    }

    /* "colibricore_wrapper.pyx":4465
 *         """
 *         cdef vector[double] v
 *         for e in l:             # <<<<<<<<<<<<<<
 *             if not isinstance(e, float) and not isinstance(e, int):
 *                 raise ValueError("Expected list with instances of float")
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4470
 *             v.push_back(e)
 * 
 *         self.data.add(pattern.cpattern,pattern2.cpattern, v)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->data.add(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern, __pyx_v_v);

  /* "colibricore_wrapper.pyx":4453
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2, tuple l):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_27PatternAlignmentModel_float_37add[] = "Add a pattern to the unindexed model\n\n        :param pattern: The source pattern to add\n        :type pattern: Pattern\n        :param pattern: The target pattern to add\n        :type pattern: Pattern\n        :param l: Feature tuple (homogenously typed)\n        :type l: tuple (of floats)\n        :type count: int\n        ";
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2 = 0;
  PyObject *__pyx_v_l = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_pattern2,&__pyx_n_s_l,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 3, 3, 1); __PYX_ERR(1, 4453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 3, 3, 2); __PYX_ERR(1, 4453, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 4453, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_pattern2 = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
    __pyx_v_l = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4453, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern2), __pyx_ptype_11colibricore_Pattern, 1, "pattern2", 0))) __PYX_ERR(1, 4453, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l), (&PyTuple_Type), 1, "l", 1))) __PYX_ERR(1, 4453, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_37add(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), __pyx_v_pattern, __pyx_v_pattern2, __pyx_v_l);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_37add(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, PyObject *__pyx_v_l) {
  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("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_27PatternAlignmentModel_float_add(__pyx_v_self, __pyx_v_pattern, __pyx_v_pattern2, __pyx_v_l, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_40__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_40__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_39__reduce_cython__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_42__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_27PatternAlignmentModel_float_42__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_27PatternAlignmentModel_float_41__setstate_cython__(((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_27PatternAlignmentModel_float_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_PatternAlignmentModel_float *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.PatternAlignmentModel_float.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4479
 *     cdef cBasicPatternAlignmentModel.iterator it_end
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_11colibricore_26BasicPatternAlignmentModel_1__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel___len__[] = "Returns the total number of distinct patterns in the model";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel___len__;
#endif
static Py_ssize_t __pyx_pw_11colibricore_26BasicPatternAlignmentModel_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel___len__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_11colibricore_26BasicPatternAlignmentModel___len__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "colibricore_wrapper.pyx":4481
 *     def __len__(self):
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->data.size();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4479
 *     cdef cBasicPatternAlignmentModel.iterator it_end
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct patterns in the model"""
 *         return self.data.size()
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4483
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_2__bool__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_2__bool__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "colibricore_wrapper.pyx":4484
 * 
 *     def __bool__(self):
 *         return self.data.size() > 0             # <<<<<<<<<<<<<<
 * 
 *     def types(self):
 */
  __pyx_r = (__pyx_v_self->data.size() > 0);
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4483
 *         return self.data.size()
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.data.size() > 0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4486
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_4types[] = "Returns the total number of distinct word types in the training data";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_5types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("types (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_4types(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_4types(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("types", 0);

  /* "colibricore_wrapper.pyx":4488
 *     def types(self):
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()             # <<<<<<<<<<<<<<
 * 
 *     def tokens(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.types()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4486
 *         return self.data.size() > 0
 * 
 *     def types(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of distinct word types in the training data"""
 *         return self.data.types()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4490
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_6tokens[] = "Returns the total number of tokens in the training data";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_7tokens(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tokens (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_6tokens(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_6tokens(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tokens", 0);

  /* "colibricore_wrapper.pyx":4492
 *     def tokens(self):
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()             # <<<<<<<<<<<<<<
 * 
 *     def minlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->data.tokens()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4490
 *         return self.data.types()
 * 
 *     def tokens(self):             # <<<<<<<<<<<<<<
 *         """Returns the total number of tokens in the training data"""
 *         return self.data.tokens()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4494
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_8minlength[] = "Returns the minimum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_9minlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_8minlength(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_8minlength(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minlength", 0);

  /* "colibricore_wrapper.pyx":4496
 *     def minlength(self):
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()             # <<<<<<<<<<<<<<
 * 
 *     def maxlength(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.minlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4494
 *         return self.data.tokens()
 * 
 *     def minlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the minimum pattern length in the model"""
 *         return self.data.minlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.minlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4498
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_10maxlength[] = "Returns the maximum pattern length in the model";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_11maxlength(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxlength (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_10maxlength(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_10maxlength(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("maxlength", 0);

  /* "colibricore_wrapper.pyx":4500
 *     def maxlength(self):
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.maxlength()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4498
 *         return self.data.minlength()
 * 
 *     def maxlength(self):             # <<<<<<<<<<<<<<
 *         """Returns the maximum pattern length in the model"""
 *         return self.data.maxlength()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.maxlength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4502
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_12type[] = "Returns the model type (10 = UNINDEXED, 20 = INDEXED)";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_13type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_12type(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_12type(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("type", 0);

  /* "colibricore_wrapper.pyx":4504
 *     def type(self):
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.getmodeltype()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4502
 *         return self.data.maxlength()
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """Returns the model type (10 = UNINDEXED, 20 = INDEXED)"""
 *         return self.data.getmodeltype()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4506
 *         return self.data.getmodeltype()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_14version[] = "Return the version of the model type";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_15version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_14version(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_14version(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("version", 0);

  /* "colibricore_wrapper.pyx":4508
 *     def version(self):
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()             # <<<<<<<<<<<<<<
 * 
 *     cdef has(self, Pattern pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->data.getmodelversion()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4506
 *         return self.data.getmodeltype()
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         """Return the version of the model type"""
 *         return self.data.getmodelversion()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4510
 *         return self.data.getmodelversion()
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_has(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has", 0);

  /* "colibricore_wrapper.pyx":4511
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4512
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4512, __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_ERR(1, 4512, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4511
 * 
 *     cdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":4513
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4510
 *         return self.data.getmodelversion()
 * 
 *     cdef has(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4515
 *         return self.data.has(pattern.cpattern)
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_hastuple(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hastuple", 0);

  /* "colibricore_wrapper.pyx":4516
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4517
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4517, __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_ERR(1, 4517, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4516
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 */
  }

  /* "colibricore_wrapper.pyx":4518
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->data.has(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4515
 *         return self.data.has(pattern.cpattern)
 * 
 *     cdef hastuple(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.hastuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4520
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_16__contains__[] = "Tests if a pattern is in the model:\n    \n        :param pattern: A pattern or a pair of patterns\n        :type pattern: Pattern or 2-tuple of patterns\n        :rtype: bool\n    \n        Example::\n    \n            sourcepattern in alignmodel\n            (sourcepattern, targetpattern) in alignmodel\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_16__contains__;
#endif
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_16__contains__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_16__contains__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "colibricore_wrapper.pyx":4532
 *             (sourcepattern, targetpattern) in alignmodel
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_pattern); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4533
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 4533, __pyx_L1_error)
    __pyx_t_1 = ((__pyx_t_3 != 2) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4534
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4534, __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_ERR(1, 4534, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4533
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])
 */
    }

    /* "colibricore_wrapper.pyx":4535
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.hastuple(pattern[0], pattern[1])             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(pattern, Pattern):
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4535, __pyx_L1_error)
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4535, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self->__pyx_vtab)->hastuple(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4), ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4535, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4532
 *             (sourcepattern, targetpattern) in alignmodel
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":4537
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":4538
 * 
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 *         return self.has(pattern)
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(1, 4538, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4537
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4540
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 *         return self.has(pattern)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, pattern):
 */
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4540, __pyx_L1_error)
  __pyx_t_7 = ((struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self->__pyx_vtab)->has(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_8;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4520
 *         return self.data.has(pattern.cpattern, pattern2.cpattern)
 * 
 *     def __contains__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Tests if a pattern is in the model:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4542
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_18__getitem__[] = "Retrieves the value for the pattern\n    \n        :param pattern: A pattern\n        :type pattern: Pattern\n        :rtype: int (for Unindexed Models), IndexData (for Indexed models)\n    \n        Example (unindexed model)::\n    \n            occurrences = model[pattern]\n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_18__getitem__;
#endif
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_18__getitem__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_18__getitem__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "colibricore_wrapper.pyx":4553
 *             occurrences = model[pattern]
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_pattern); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4554
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 4554, __pyx_L1_error)
    __pyx_t_1 = ((__pyx_t_3 != 2) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = ((!(__pyx_t_1 != 0)) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_11colibricore_Pattern); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "colibricore_wrapper.pyx":4555
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4555, __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_ERR(1, 4555, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4554
 *         """
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])
 */
    }

    /* "colibricore_wrapper.pyx":4556
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 *             return self.getdatatuple(pattern[0], pattern[1])             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(pattern, Pattern):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getdatatuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_pattern, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_pattern, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4556, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4556, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4553
 *             occurrences = model[pattern]
 *         """
 *         if isinstance(pattern, tuple):             # <<<<<<<<<<<<<<
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 */
  }

  /* "colibricore_wrapper.pyx":4558
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "colibricore_wrapper.pyx":4559
 * 
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 * 
 *         return self.getdata(pattern)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4559, __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_ERR(1, 4559, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4558
 *             return self.getdatatuple(pattern[0], pattern[1])
 * 
 *         if not isinstance(pattern, Pattern):             # <<<<<<<<<<<<<<
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4561
 *             raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")
 * 
 *         return self.getdata(pattern)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_pattern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pattern, __pyx_ptype_11colibricore_Pattern))))) __PYX_ERR(1, 4561, __pyx_L1_error)
  __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self->__pyx_vtab)->getdata(__pyx_v_self, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_v_pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4542
 *         return self.has(pattern)
 * 
 *     def __getitem__(self, pattern):             # <<<<<<<<<<<<<<
 *         """Retrieves the value for the pattern
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__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_11colibricore_26BasicPatternAlignmentModel_22generator77(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4565
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_21__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_20__iter__[] = "Iterates over all source patterns in the model.\n    \n        Example::\n    \n            for sourcepattern in alignmodel:\n                print(pattern.tostring(classdecoder))\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_20__iter__;
#endif
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_21__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_20__iter__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_20__iter__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)__pyx_tp_new_11colibricore___pyx_scope_struct_77___iter__(__pyx_ptype_11colibricore___pyx_scope_struct_77___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4565, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_26BasicPatternAlignmentModel_22generator77, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_BasicPatternAlignmentModel___ite, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4565, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_26BasicPatternAlignmentModel_22generator77(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_ERR(1, 4565, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4574
 * 
 *         """
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4576
 *         it = self.data.begin()
 *         cdef cPattern cpattern
 *         while it != self.data.end():             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->data.end()) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4577
 *         cdef cPattern cpattern
 *         while it != self.data.end():
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4578
 *         while it != self.data.end():
 *             cpattern = deref(it).first
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             yield pattern
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4579
 *             cpattern = deref(it).first
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             yield pattern
 *             inc(it)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4580
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             yield pattern             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pattern);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4580, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4581
 *             pattern.bind(cpattern)
 *             yield pattern
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4565
 * 
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """Iterates over all source patterns in the model.
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4583
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise an alignment model. Either an empty one or loading from file.
 * 
 */

/* Python wrapper */
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_24__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_23__init__[] = "Initialise an alignment model. Either an empty one or loading from file.\n    \n        :param filename: The name of the file to load, must be a valid colibri alignmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n    \n        ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_23__init__;
#endif
static int __pyx_pw_11colibricore_26BasicPatternAlignmentModel_24__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject*)__pyx_kp_u_);
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 4583, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4583, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4583, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4583, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_23__init__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11colibricore_26BasicPatternAlignmentModel_23__init__(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "colibricore_wrapper.pyx":4592
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.load(filename,options)
 * 
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {

    /* "colibricore_wrapper.pyx":4593
 *         """
 *         if filename:
 *             self.load(filename,options)             # <<<<<<<<<<<<<<
 * 
 *     def load(self, str filename, PatternModelOptions options=None):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4593, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4593, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_filename);
      __Pyx_INCREF(((PyObject *)__pyx_v_options));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_options));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "colibricore_wrapper.pyx":4592
 * 
 *         """
 *         if filename:             # <<<<<<<<<<<<<<
 *             self.load(filename,options)
 * 
 */
  }

  /* "colibricore_wrapper.pyx":4583
 *             inc(it)
 * 
 *     def __init__(self, str filename = "",PatternModelOptions options = None):             # <<<<<<<<<<<<<<
 *         """Initialise an alignment model. Either an empty one or loading from file.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4595
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load an alignment model from file
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_26load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_25load[] = "Load an alignment model from file\n    \n        :param filename: The name of the file to load, must be a valid colibri alignmodel file\n        :type filename: str\n        :param options: An instance of PatternModelOptions, containing the options used for loading\n        :type options: PatternModelOptions\n        ";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_26load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(1, 4595, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4595, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4595, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4595, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_25load(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_25load(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_options);

  /* "colibricore_wrapper.pyx":4603
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_options) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "colibricore_wrapper.pyx":4604
 *         """
 *         if options is None:
 *             options = PatternModelOptions()             # <<<<<<<<<<<<<<
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternModelOptions)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_options, ((struct __pyx_obj_11colibricore_PatternModelOptions *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4603
 *         :type options: PatternModelOptions
 *         """
 *         if options is None:             # <<<<<<<<<<<<<<
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 */
  }

  /* "colibricore_wrapper.pyx":4605
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_filename) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 4605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4606
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)             # <<<<<<<<<<<<<<
 *         self.data.load(encode(filename), options.coptions)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(1, 4606, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4605
 *         if options is None:
 *             options = PatternModelOptions()
 *         if filename and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)
 */
  }

  /* "colibricore_wrapper.pyx":4607
 *         if filename and not os.path.exists(filename):
 *             raise FileNotFoundError(filename)
 *         self.data.load(encode(filename), options.coptions)             # <<<<<<<<<<<<<<
 * 
 *     def read(self, str filename, PatternModelOptions options=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 4607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  try {
    __pyx_v_self->data.load(__pyx_t_7, __pyx_v_options->coptions);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 4607, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4595
 *             self.load(filename,options)
 * 
 *     def load(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Load an alignment model from file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4609
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_28read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_27read[] = "Alias for load";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_28read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_11colibricore_PatternModelOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(1, 4609, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = ((PyObject*)values[0]);
    __pyx_v_options = ((struct __pyx_obj_11colibricore_PatternModelOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4609, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4609, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_11colibricore_PatternModelOptions, 1, "options", 0))) __PYX_ERR(1, 4609, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_27read(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), __pyx_v_filename, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_27read(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, struct __pyx_obj_11colibricore_PatternModelOptions *__pyx_v_options) {
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "colibricore_wrapper.pyx":4611
 *     def read(self, str filename, PatternModelOptions options=None):
 *         """Alias for load"""
 *         self.load(filename, options)             # <<<<<<<<<<<<<<
 * 
 *     cpdef write(self, str filename):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, ((PyObject *)__pyx_v_options)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_filename);
    __Pyx_INCREF(((PyObject *)__pyx_v_options));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_options));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_options));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4609
 *         self.data.load(encode(filename), options.coptions)
 * 
 *     def read(self, str filename, PatternModelOptions options=None):             # <<<<<<<<<<<<<<
 *         """Alias for load"""
 *         self.load(filename, options)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4613
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write an alignment model to file
 * 
 */

static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_write(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4613, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_30write)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":4619
 *         :type filename: str
 *         """
 *         self.data.write(encode(filename))             # <<<<<<<<<<<<<<
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 4619, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_v_self->data.write(__pyx_t_5);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString(__pyx_builtin_IOError, exn.what());} catch(...) { PyErr_SetNone(__pyx_builtin_IOError); }
    __PYX_ERR(1, 4619, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4613
 *         self.load(filename, options)
 * 
 *     cpdef write(self, str filename):             # <<<<<<<<<<<<<<
 *         """Write an alignment model to file
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_29write[] = "Write an alignment model to file\n    \n        :param filename: The name of the file to write to\n        :type filename: str\n        ";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_30write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(1, 4613, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_29write(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), ((PyObject*)__pyx_v_filename));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_29write(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_26BasicPatternAlignmentModel_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4621
 *         self.data.write(encode(filename))
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

static PatternModelInterface *__pyx_f_11colibricore_26BasicPatternAlignmentModel_getinterface(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PatternModelInterface *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getinterface", 0);

  /* "colibricore_wrapper.pyx":4622
 * 
 *     cdef cPatternModelInterface* getinterface(self):
 *         return self.data.getinterface()             # <<<<<<<<<<<<<<
 * 
 *     cdef getdata(self, Pattern pattern):
 */
  __pyx_r = __pyx_v_self->data.getinterface();
  goto __pyx_L0;

  /* "colibricore_wrapper.pyx":4621
 *         self.data.write(encode(filename))
 * 
 *     cdef cPatternModelInterface* getinterface(self):             # <<<<<<<<<<<<<<
 *         return self.data.getinterface()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4624
 *         return self.data.getinterface()
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternVector cvec
 *         if pattern in self:
 */

static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_getdata(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern) {
  PatternVector __pyx_v_cvec;
  struct __pyx_obj_11colibricore_PatternVector *__pyx_v_pvec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdata", 0);

  /* "colibricore_wrapper.pyx":4626
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternVector cvec
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvec = deref(self.data.getdata(pattern.cpattern))
 *             pvec = PatternVector()
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 4626, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "colibricore_wrapper.pyx":4627
 *         cdef cPatternVector cvec
 *         if pattern in self:
 *             cvec = deref(self.data.getdata(pattern.cpattern))             # <<<<<<<<<<<<<<
 *             pvec = PatternVector()
 *             pvec.bind(cvec)
 */
    __pyx_v_cvec = (*__pyx_v_self->data.getdata(__pyx_v_pattern->cpattern, NULL));

    /* "colibricore_wrapper.pyx":4628
 *         if pattern in self:
 *             cvec = deref(self.data.getdata(pattern.cpattern))
 *             pvec = PatternVector()             # <<<<<<<<<<<<<<
 *             pvec.bind(cvec)
 *             return pvec
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternVector)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_pvec = ((struct __pyx_obj_11colibricore_PatternVector *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4629
 *             cvec = deref(self.data.getdata(pattern.cpattern))
 *             pvec = PatternVector()
 *             pvec.bind(cvec)             # <<<<<<<<<<<<<<
 *             return pvec
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_11colibricore_PatternVector *)__pyx_v_pvec->__pyx_vtab)->bind(__pyx_v_pvec, __pyx_v_cvec); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "colibricore_wrapper.pyx":4630
 *             pvec = PatternVector()
 *             pvec.bind(cvec)
 *             return pvec             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_pvec));
    __pyx_r = ((PyObject *)__pyx_v_pvec);
    goto __pyx_L0;

    /* "colibricore_wrapper.pyx":4626
 *     cdef getdata(self, Pattern pattern):
 *         cdef cPatternVector cvec
 *         if pattern in self:             # <<<<<<<<<<<<<<
 *             cvec = deref(self.data.getdata(pattern.cpattern))
 *             pvec = PatternVector()
 */
  }

  /* "colibricore_wrapper.pyx":4632
 *             return pvec
 *         else:
 *             raise KeyError             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
    __PYX_ERR(1, 4632, __pyx_L1_error)
  }

  /* "colibricore_wrapper.pyx":4624
 *         return self.data.getinterface()
 * 
 *     cdef getdata(self, Pattern pattern):             # <<<<<<<<<<<<<<
 *         cdef cPatternVector cvec
 *         if pattern in self:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.getdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pvec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_26BasicPatternAlignmentModel_33generator78(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4634
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_32items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_31items[] = "Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_32items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_31items(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_31items(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)__pyx_tp_new_11colibricore___pyx_scope_struct_78_items(__pyx_ptype_11colibricore___pyx_scope_struct_78_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4634, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_26BasicPatternAlignmentModel_33generator78, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_BasicPatternAlignmentModel_items, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4634, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_26BasicPatternAlignmentModel_33generator78(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PatternVector __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 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_ERR(1, 4634, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4636
 *     def items(self):
 *         """Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         it_end = self.data.end()
 *         cdef cPatternVector cvec
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4637
 *         """Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs"""
 *         it = self.data.begin()
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         cdef cPatternVector cvec
 *         while it != it_end:
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4639
 *         it_end = self.data.end()
 *         cdef cPatternVector cvec
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cvec = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4640
 *         cdef cPatternVector cvec
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cvec = deref(it).second
 *             pattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4641
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             cvec = deref(it).second             # <<<<<<<<<<<<<<
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cvec = __pyx_t_3;

    /* "colibricore_wrapper.pyx":4642
 *             cpattern = deref(it).first
 *             cvec = deref(it).second
 *             pattern = Pattern()             # <<<<<<<<<<<<<<
 *             pattern.bind(cpattern)
 *             pvec = PatternVector()
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4643
 *             cvec = deref(it).second
 *             pattern = Pattern()
 *             pattern.bind(cpattern)             # <<<<<<<<<<<<<<
 *             pvec = PatternVector()
 *             pvec.bind(cvec)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_pattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4644
 *             pattern = Pattern()
 *             pattern.bind(cpattern)
 *             pvec = PatternVector()             # <<<<<<<<<<<<<<
 *             pvec.bind(cvec)
 *             yield (pattern,pvec)
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_PatternVector)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pvec));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pvec, ((struct __pyx_obj_11colibricore_PatternVector *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4645
 *             pattern.bind(cpattern)
 *             pvec = PatternVector()
 *             pvec.bind(cvec)             # <<<<<<<<<<<<<<
 *             yield (pattern,pvec)
 *             inc(it)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_PatternVector *)__pyx_cur_scope->__pyx_v_pvec->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_pvec, __pyx_cur_scope->__pyx_v_cvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4646
 *             pvec = PatternVector()
 *             pvec.bind(cvec)
 *             yield (pattern,pvec)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_pattern));
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pvec));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_pvec));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_pvec));
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4646, __pyx_L1_error)

    /* "colibricore_wrapper.pyx":4647
 *             pvec.bind(cvec)
 *             yield (pattern,pvec)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     def pairs(self):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4634
 *             raise KeyError
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Iterate over all patterns and PatternVectors in this model, yields (Pattern, PatternVector) pairs"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_11colibricore_26BasicPatternAlignmentModel_36generator79(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "colibricore_wrapper.pyx":4649
 *             inc(it)
 * 
 *     def pairs(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern pairs"""
 *         it = self.data.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_35pairs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_34pairs[] = "Iterate over sourcepattern, targetpattern pairs";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_35pairs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pairs (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_34pairs(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_34pairs(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pairs", 0);
  __pyx_cur_scope = (struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)__pyx_tp_new_11colibricore___pyx_scope_struct_79_pairs(__pyx_ptype_11colibricore___pyx_scope_struct_79_pairs, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 4649, __pyx_L1_error)
  } else {
    __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11colibricore_26BasicPatternAlignmentModel_36generator79, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_pairs, __pyx_n_s_BasicPatternAlignmentModel_pairs, __pyx_n_s_colibricore); if (unlikely(!gen)) __PYX_ERR(1, 4649, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.pairs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_11colibricore_26BasicPatternAlignmentModel_36generator79(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *__pyx_cur_scope = ((struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Pattern __pyx_t_2;
  PatternVector __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pairs", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4649, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":4651
 *     def pairs(self):
 *         """Iterate over sourcepattern, targetpattern pairs"""
 *         it = self.data.begin()             # <<<<<<<<<<<<<<
 *         it_end = self.data.end()
 *         cdef cPattern cpattern
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->data.begin();

  /* "colibricore_wrapper.pyx":4652
 *         """Iterate over sourcepattern, targetpattern pairs"""
 *         it = self.data.begin()
 *         it_end = self.data.end()             # <<<<<<<<<<<<<<
 *         cdef cPattern cpattern
 *         cdef cPattern ctargetpattern
 */
  __pyx_cur_scope->__pyx_v_it_end = __pyx_cur_scope->__pyx_v_self->data.end();

  /* "colibricore_wrapper.pyx":4656
 *         cdef cPattern ctargetpattern
 *         cdef cPatternVector cvec
 *         while it != it_end:             # <<<<<<<<<<<<<<
 *             cpattern = deref(it).first
 *             cvec = deref(it).second
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_it_end) != 0);
    if (!__pyx_t_1) break;

    /* "colibricore_wrapper.pyx":4657
 *         cdef cPatternVector cvec
 *         while it != it_end:
 *             cpattern = deref(it).first             # <<<<<<<<<<<<<<
 *             cvec = deref(it).second
 *             sourcepattern = Pattern()
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).first;
    __pyx_cur_scope->__pyx_v_cpattern = __pyx_t_2;

    /* "colibricore_wrapper.pyx":4658
 *         while it != it_end:
 *             cpattern = deref(it).first
 *             cvec = deref(it).second             # <<<<<<<<<<<<<<
 *             sourcepattern = Pattern()
 *             sourcepattern.bind(cpattern)
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).second;
    __pyx_cur_scope->__pyx_v_cvec = __pyx_t_3;

    /* "colibricore_wrapper.pyx":4659
 *             cpattern = deref(it).first
 *             cvec = deref(it).second
 *             sourcepattern = Pattern()             # <<<<<<<<<<<<<<
 *             sourcepattern.bind(cpattern)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sourcepattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4660
 *             cvec = deref(it).second
 *             sourcepattern = Pattern()
 *             sourcepattern.bind(cpattern)             # <<<<<<<<<<<<<<
 * 
 *             it2 = cvec.begin()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_sourcepattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_sourcepattern, __pyx_cur_scope->__pyx_v_cpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "colibricore_wrapper.pyx":4662
 *             sourcepattern.bind(cpattern)
 * 
 *             it2 = cvec.begin()             # <<<<<<<<<<<<<<
 *             it2_end = cvec.end()
 *             while it2 != it2_end:
 */
    __pyx_cur_scope->__pyx_v_it2 = __pyx_cur_scope->__pyx_v_cvec.begin();

    /* "colibricore_wrapper.pyx":4663
 * 
 *             it2 = cvec.begin()
 *             it2_end = cvec.end()             # <<<<<<<<<<<<<<
 *             while it2 != it2_end:
 *                 ctargetpattern = deref(it2)
 */
    __pyx_cur_scope->__pyx_v_it2_end = __pyx_cur_scope->__pyx_v_cvec.end();

    /* "colibricore_wrapper.pyx":4664
 *             it2 = cvec.begin()
 *             it2_end = cvec.end()
 *             while it2 != it2_end:             # <<<<<<<<<<<<<<
 *                 ctargetpattern = deref(it2)
 *                 targetpattern = Pattern()
 */
    while (1) {
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it2 != __pyx_cur_scope->__pyx_v_it2_end) != 0);
      if (!__pyx_t_1) break;

      /* "colibricore_wrapper.pyx":4665
 *             it2_end = cvec.end()
 *             while it2 != it2_end:
 *                 ctargetpattern = deref(it2)             # <<<<<<<<<<<<<<
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(ctargetpattern)
 */
      __pyx_cur_scope->__pyx_v_ctargetpattern = (*__pyx_cur_scope->__pyx_v_it2);

      /* "colibricore_wrapper.pyx":4666
 *             while it2 != it2_end:
 *                 ctargetpattern = deref(it2)
 *                 targetpattern = Pattern()             # <<<<<<<<<<<<<<
 *                 targetpattern.bind(ctargetpattern)
 *                 yield (sourcepattern, targetpattern)
 */
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_targetpattern, ((struct __pyx_obj_11colibricore_Pattern *)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":4667
 *                 ctargetpattern = deref(it2)
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(ctargetpattern)             # <<<<<<<<<<<<<<
 *                 yield (sourcepattern, targetpattern)
 *                 inc(it2)
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_11colibricore_Pattern *)__pyx_cur_scope->__pyx_v_targetpattern->__pyx_vtab)->bind(__pyx_cur_scope->__pyx_v_targetpattern, __pyx_cur_scope->__pyx_v_ctargetpattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "colibricore_wrapper.pyx":4668
 *                 targetpattern = Pattern()
 *                 targetpattern.bind(ctargetpattern)
 *                 yield (sourcepattern, targetpattern)             # <<<<<<<<<<<<<<
 *                 inc(it2)
 *             inc(it)
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_sourcepattern));
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_targetpattern));
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L8_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 4668, __pyx_L1_error)

      /* "colibricore_wrapper.pyx":4669
 *                 targetpattern.bind(ctargetpattern)
 *                 yield (sourcepattern, targetpattern)
 *                 inc(it2)             # <<<<<<<<<<<<<<
 *             inc(it)
 * 
 */
      (void)((++__pyx_cur_scope->__pyx_v_it2));
    }

    /* "colibricore_wrapper.pyx":4670
 *                 yield (sourcepattern, targetpattern)
 *                 inc(it2)
 *             inc(it)             # <<<<<<<<<<<<<<
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2):
 */
    (void)((++__pyx_cur_scope->__pyx_v_it));
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "colibricore_wrapper.pyx":4649
 *             inc(it)
 * 
 *     def pairs(self):             # <<<<<<<<<<<<<<
 *         """Iterate over sourcepattern, targetpattern pairs"""
 *         it = self.data.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pairs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "colibricore_wrapper.pyx":4672
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11colibricore_26BasicPatternAlignmentModel_add(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_38add)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4672, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_pattern), ((PyObject *)__pyx_v_pattern2)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4672, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4672, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_pattern));
          __Pyx_INCREF(((PyObject *)__pyx_v_pattern2));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern2));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_pattern2));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4672, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "colibricore_wrapper.pyx":4681
 *         :type count: int
 *         """
 *         self.data.add(pattern.cpattern,pattern2.cpattern)             # <<<<<<<<<<<<<<
 * 
 * UNKPATTERN = Pattern()
 */
  __pyx_v_self->data.add(__pyx_v_pattern->cpattern, __pyx_v_pattern2->cpattern);

  /* "colibricore_wrapper.pyx":4672
 *             inc(it)
 * 
 *     cpdef add(self, Pattern pattern, Pattern pattern2):             # <<<<<<<<<<<<<<
 *         """Add a pattern to the unindexed model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_11colibricore_26BasicPatternAlignmentModel_37add[] = "Add a pattern to the unindexed model\n\n        :param pattern: The source pattern to add\n        :type pattern: Pattern\n        :param pattern: The target pattern to add\n        :type pattern: Pattern\n        :type count: int\n        ";
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_38add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern = 0;
  struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_pattern2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(1, 4672, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(1, 4672, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pattern = ((struct __pyx_obj_11colibricore_Pattern *)values[0]);
    __pyx_v_pattern2 = ((struct __pyx_obj_11colibricore_Pattern *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 4672, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_11colibricore_Pattern, 1, "pattern", 0))) __PYX_ERR(1, 4672, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern2), __pyx_ptype_11colibricore_Pattern, 1, "pattern2", 0))) __PYX_ERR(1, 4672, __pyx_L1_error)
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_37add(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), __pyx_v_pattern, __pyx_v_pattern2);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_37add(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern, struct __pyx_obj_11colibricore_Pattern *__pyx_v_pattern2) {
  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("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11colibricore_26BasicPatternAlignmentModel_add(__pyx_v_self, __pyx_v_pattern, __pyx_v_pattern2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_40__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_40__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_39__reduce_cython__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_ERR(0, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_42__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11colibricore_26BasicPatternAlignmentModel_42__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11colibricore_26BasicPatternAlignmentModel_41__setstate_cython__(((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11colibricore_26BasicPatternAlignmentModel_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __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_ERR(0, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("colibricore.BasicPatternAlignmentModel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":14
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0             # <<<<<<<<<<<<<<
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)
 */
  __pyx_v_length = 0;

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(0, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__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_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__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_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__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_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__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_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__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_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector<unsigned int>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __Pyx_PyInt_From_unsigned_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __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_11colibricore_ClassEncoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_ClassEncoder *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_ClassEncoder *)o);
  new((void*)&(p->data)) ClassEncoder();
  new((void*)&(p->freqlist)) std::unordered_map<std::string,unsigned int> ();
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_ClassEncoder(PyObject *o) {
  struct __pyx_obj_11colibricore_ClassEncoder *p = (struct __pyx_obj_11colibricore_ClassEncoder *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->freqlist);
  Py_CLEAR(p->_filename);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_ClassEncoder[] = {
  {"filename", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_3filename, METH_NOARGS, 0},
  {"buildpattern", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_12ClassEncoder_7buildpattern, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_12ClassEncoder_6buildpattern},
  {"processcorpus", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_9processcorpus, METH_O, __pyx_doc_11colibricore_12ClassEncoder_8processcorpus},
  {"buildclasses", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_11buildclasses, METH_NOARGS, __pyx_doc_11colibricore_12ClassEncoder_10buildclasses},
  {"build", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_13build, METH_O, __pyx_doc_11colibricore_12ClassEncoder_12build},
  {"encodefile", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_12ClassEncoder_15encodefile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_12ClassEncoder_14encodefile},
  {"save", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_17save, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_19__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_12ClassEncoder_21__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_ClassEncoder = {
  __pyx_pw_11colibricore_12ClassEncoder_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ClassEncoder = {
  __pyx_pw_11colibricore_12ClassEncoder_5__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_ClassEncoder = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.ClassEncoder", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_ClassEncoder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_ClassEncoder, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_ClassEncoder, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ClassEncoder, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "The class encoder allows patterns to be built from their string representation. Load in a class file and invoke the ``buildpattern()`` method", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_ClassEncoder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_12ClassEncoder_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_ClassEncoder, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static PyObject *__pyx_tp_new_11colibricore_ClassDecoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_ClassDecoder *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_ClassDecoder *)o);
  new((void*)&(p->data)) ClassDecoder();
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_ClassDecoder(PyObject *o) {
  struct __pyx_obj_11colibricore_ClassDecoder *p = (struct __pyx_obj_11colibricore_ClassDecoder *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  Py_CLEAR(p->_filename);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_ClassDecoder[] = {
  {"decodefile", (PyCFunction)__pyx_pw_11colibricore_12ClassDecoder_5decodefile, METH_O, 0},
  {"filename", (PyCFunction)__pyx_pw_11colibricore_12ClassDecoder_7filename, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_12ClassDecoder_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_12ClassDecoder_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_ClassDecoder = {
  __pyx_pw_11colibricore_12ClassDecoder_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ClassDecoder = {
  __pyx_pw_11colibricore_12ClassDecoder_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_ClassDecoder = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.ClassDecoder", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_ClassDecoder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_ClassDecoder, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_ClassDecoder, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ClassDecoder, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "The Class Decoder allows Patterns to be decoded back to their string representation. An instance of ClassDecoder is passed to Pattern.tostring()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_ClassDecoder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_12ClassDecoder_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_ClassDecoder, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_Pattern __pyx_vtable_11colibricore_Pattern;

static PyObject *__pyx_tp_new_11colibricore_Pattern(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_Pattern *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_Pattern *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_Pattern;
  new((void*)&(p->cpattern)) Pattern();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_Pattern(PyObject *o) {
  struct __pyx_obj_11colibricore_Pattern *p = (struct __pyx_obj_11colibricore_Pattern *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->cpattern);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_Pattern(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_Pattern[] = {
  {"bindunk", (PyCFunction)__pyx_pw_11colibricore_7Pattern_1bindunk, METH_NOARGS, 0},
  {"bindskip", (PyCFunction)__pyx_pw_11colibricore_7Pattern_3bindskip, METH_NOARGS, 0},
  {"bindflex", (PyCFunction)__pyx_pw_11colibricore_7Pattern_5bindflex, METH_NOARGS, 0},
  {"bindboundary", (PyCFunction)__pyx_pw_11colibricore_7Pattern_7bindboundary, METH_NOARGS, 0},
  {"tostring", (PyCFunction)__pyx_pw_11colibricore_7Pattern_9tostring, METH_O, __pyx_doc_11colibricore_7Pattern_8tostring},
  {"unknown", (PyCFunction)__pyx_pw_11colibricore_7Pattern_11unknown, METH_NOARGS, 0},
  {"__copy__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_19__copy__, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_18__copy__},
  {"__deepcopy__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_21__deepcopy__, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_20__deepcopy__},
  {"concat", (PyCFunction)__pyx_pw_11colibricore_7Pattern_23concat, METH_O, 0},
  {"bytesize", (PyCFunction)__pyx_pw_11colibricore_7Pattern_32bytesize, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_31bytesize},
  {"skipcount", (PyCFunction)__pyx_pw_11colibricore_7Pattern_34skipcount, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_33skipcount},
  {"category", (PyCFunction)__pyx_pw_11colibricore_7Pattern_36category, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_35category},
  {"reverse", (PyCFunction)__pyx_pw_11colibricore_7Pattern_42reverse, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_41reverse},
  {"ngrams", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_7Pattern_44ngrams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_7Pattern_43ngrams},
  {"_ngrams_aux", (PyCFunction)__pyx_pw_11colibricore_7Pattern_46_ngrams_aux, METH_O, 0},
  {"parts", (PyCFunction)__pyx_pw_11colibricore_7Pattern_49parts, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_48parts},
  {"gaps", (PyCFunction)__pyx_pw_11colibricore_7Pattern_52gaps, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_51gaps},
  {"toflexgram", (PyCFunction)__pyx_pw_11colibricore_7Pattern_55toflexgram, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_54toflexgram},
  {"subngrams", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_7Pattern_57subngrams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_7Pattern_56subngrams},
  {"tolist", (PyCFunction)__pyx_pw_11colibricore_7Pattern_60tolist, METH_NOARGS, __pyx_doc_11colibricore_7Pattern_59tolist},
  {"__bytes__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_62__bytes__, METH_NOARGS, 0},
  {"__getstate__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_64__getstate__, METH_NOARGS, 0},
  {"__setstate__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_66__setstate__, METH_O, 0},
  {"isgap", (PyCFunction)__pyx_pw_11colibricore_7Pattern_68isgap, METH_O, 0},
  {"isskipgram", (PyCFunction)__pyx_pw_11colibricore_7Pattern_70isskipgram, METH_NOARGS, 0},
  {"isflexgram", (PyCFunction)__pyx_pw_11colibricore_7Pattern_72isflexgram, METH_NOARGS, 0},
  {"instanceof", (PyCFunction)__pyx_pw_11colibricore_7Pattern_74instanceof, METH_O, __pyx_doc_11colibricore_7Pattern_73instanceof},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_76__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_7Pattern_78__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Pattern = {
  __pyx_pw_11colibricore_7Pattern_25__add__, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_7Pattern_15__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Pattern = {
  __pyx_pw_11colibricore_7Pattern_17__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_Pattern, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_7Pattern_13__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Pattern = {
  __pyx_pw_11colibricore_7Pattern_17__len__, /*mp_length*/
  __pyx_pw_11colibricore_7Pattern_27__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_Pattern = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.Pattern", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_Pattern), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_Pattern, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Pattern, /*tp_as_number*/
  &__pyx_tp_as_sequence_Pattern, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Pattern, /*tp_as_mapping*/
  __pyx_pw_11colibricore_7Pattern_38__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "The Pattern class contains an ngram, skipgram or flexgram, and allows a wide variety of actions to be performed on it. It is stored in a memory-efficient fashion and facilitating fast operation and comparison. Use ClassEncoder.buildpattern to build a pattern.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_11colibricore_7Pattern_40__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_7Pattern_29__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_Pattern, /*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_11colibricore_Pattern, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_IndexedData __pyx_vtable_11colibricore_IndexedData;

static PyObject *__pyx_tp_new_11colibricore_IndexedData(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_IndexedData *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_IndexedData *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_IndexedData;
  new((void*)&(p->data)) IndexedData();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_IndexedData(PyObject *o) {
  struct __pyx_obj_11colibricore_IndexedData *p = (struct __pyx_obj_11colibricore_IndexedData *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_IndexedData[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_11IndexedData_12__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_11IndexedData_14__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_IndexedData = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_11IndexedData_8__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  __pyx_pw_11colibricore_11IndexedData_10__int__, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_11colibricore_11IndexedData_10__int__, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_IndexedData = {
  __pyx_pw_11colibricore_11IndexedData_6__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_11colibricore_11IndexedData_1__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_IndexedData = {
  __pyx_pw_11colibricore_11IndexedData_6__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_IndexedData = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.IndexedData", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_IndexedData), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_IndexedData, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_IndexedData, /*tp_as_number*/
  &__pyx_tp_as_sequence_IndexedData, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IndexedData, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "IndexedData is essentially a set of indexes in the form of (sentence,token) tuples, sentence is generally 1-indexed, token is always 0-indexed. It is used by Indexed Pattern Models to keep track of exact occurrences of all the patterns. Use len() to if you're merely interested in the number of occurrences, rather than their exact wherabouts.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_11IndexedData_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_IndexedData, /*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_11colibricore_IndexedData, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternSet __pyx_vtable_11colibricore_PatternSet;

static PyObject *__pyx_tp_new_11colibricore_PatternSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternSet *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternSet *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternSet;
  new((void*)&(p->data)) PatternSet<unsigned int> ();
  new((void*)&(p->it)) PatternSet<unsigned int> ::iterator();
  new((void*)&(p->it_end)) PatternSet<unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternSet(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternSet *p = (struct __pyx_obj_11colibricore_PatternSet *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_PatternSet[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_10PatternSet_5has, METH_O, 0},
  {"add", (PyCFunction)__pyx_pw_11colibricore_10PatternSet_12add, METH_O, __pyx_doc_11colibricore_10PatternSet_11add},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_10PatternSet_14__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_10PatternSet_16__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternSet = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_10PatternSet_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternSet = {
  __pyx_pw_11colibricore_10PatternSet_3__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_11colibricore_10PatternSet_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternSet = {
  __pyx_pw_11colibricore_10PatternSet_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternSet = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternSet", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternSet), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternSet, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternSet, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternSet, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternSet, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level set that contains Pattern instances", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_10PatternSet_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternSet, /*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_11colibricore_PatternSet, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_int32 __pyx_vtable_11colibricore_PatternDict_int32;

static PyObject *__pyx_tp_new_11colibricore_PatternDict_int32(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternDict_int32 *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternDict_int32 *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternDict_int32;
  new((void*)&(p->data)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ();
  new((void*)&(p->it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternDict_int32(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternDict_int32 *p = (struct __pyx_obj_11colibricore_PatternDict_int32 *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_PatternDict_int32(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_11colibricore_PatternDict_int32(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_17PatternDict_int32_21__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_PatternDict_int32[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_5has, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_14items, METH_NOARGS, __pyx_doc_11colibricore_17PatternDict_int32_13items},
  {"read", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_17read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_19write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_int32_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternDict_int32 = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_17PatternDict_int32_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternDict_int32 = {
  __pyx_pw_11colibricore_17PatternDict_int32_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_PatternDict_int32, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_17PatternDict_int32_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternDict_int32 = {
  __pyx_pw_11colibricore_17PatternDict_int32_3__len__, /*mp_length*/
  __pyx_pw_11colibricore_17PatternDict_int32_12__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_PatternDict_int32, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternDict_int32 = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternDict_int32", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternDict_int32), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternDict_int32, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternDict_int32, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternDict_int32, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternDict_int32, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_17PatternDict_int32_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternDict_int32, /*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_11colibricore_PatternDict_int32, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_SmallPatternDict_int32 __pyx_vtable_11colibricore_SmallPatternDict_int32;

static PyObject *__pyx_tp_new_11colibricore_SmallPatternDict_int32(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_SmallPatternDict_int32 *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_SmallPatternDict_int32;
  new((void*)&(p->data)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ();
  new((void*)&(p->it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  new((void*)&(p->it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_SmallPatternDict_int32(PyObject *o) {
  struct __pyx_obj_11colibricore_SmallPatternDict_int32 *p = (struct __pyx_obj_11colibricore_SmallPatternDict_int32 *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_SmallPatternDict_int32(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_11colibricore_SmallPatternDict_int32(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_22SmallPatternDict_int32_21__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_SmallPatternDict_int32[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_5has, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_14items, METH_NOARGS, __pyx_doc_11colibricore_22SmallPatternDict_int32_13items},
  {"read", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_17read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_19write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_22SmallPatternDict_int32_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SmallPatternDict_int32 = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_22SmallPatternDict_int32_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SmallPatternDict_int32 = {
  __pyx_pw_11colibricore_22SmallPatternDict_int32_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_SmallPatternDict_int32, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_22SmallPatternDict_int32_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SmallPatternDict_int32 = {
  __pyx_pw_11colibricore_22SmallPatternDict_int32_3__len__, /*mp_length*/
  __pyx_pw_11colibricore_22SmallPatternDict_int32_12__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_SmallPatternDict_int32, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_SmallPatternDict_int32 = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.SmallPatternDict_int32", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_SmallPatternDict_int32), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_SmallPatternDict_int32, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_SmallPatternDict_int32, /*tp_as_number*/
  &__pyx_tp_as_sequence_SmallPatternDict_int32, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SmallPatternDict_int32, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a Small version taht allows at most 65536 patterns.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_22SmallPatternDict_int32_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_SmallPatternDict_int32, /*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_11colibricore_SmallPatternDict_int32, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_TinyPatternDict_int32 __pyx_vtable_11colibricore_TinyPatternDict_int32;

static PyObject *__pyx_tp_new_11colibricore_TinyPatternDict_int32(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_TinyPatternDict_int32 *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_TinyPatternDict_int32;
  new((void*)&(p->data)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ();
  new((void*)&(p->it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  new((void*)&(p->it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_TinyPatternDict_int32(PyObject *o) {
  struct __pyx_obj_11colibricore_TinyPatternDict_int32 *p = (struct __pyx_obj_11colibricore_TinyPatternDict_int32 *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_TinyPatternDict_int32(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_11colibricore_TinyPatternDict_int32(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_21TinyPatternDict_int32_21__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_TinyPatternDict_int32[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_5has, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_14items, METH_NOARGS, __pyx_doc_11colibricore_21TinyPatternDict_int32_13items},
  {"read", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_17read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_19write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_21TinyPatternDict_int32_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_TinyPatternDict_int32 = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_21TinyPatternDict_int32_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_TinyPatternDict_int32 = {
  __pyx_pw_11colibricore_21TinyPatternDict_int32_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_TinyPatternDict_int32, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_21TinyPatternDict_int32_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_TinyPatternDict_int32 = {
  __pyx_pw_11colibricore_21TinyPatternDict_int32_3__len__, /*mp_length*/
  __pyx_pw_11colibricore_21TinyPatternDict_int32_12__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_TinyPatternDict_int32, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_TinyPatternDict_int32 = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.TinyPatternDict_int32", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_TinyPatternDict_int32), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_TinyPatternDict_int32, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_TinyPatternDict_int32, /*tp_as_number*/
  &__pyx_tp_as_sequence_TinyPatternDict_int32, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_TinyPatternDict_int32, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and integer (max 32 bit, unsigned) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead. This is a tiny version that allow only up to 256 patterns.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_21TinyPatternDict_int32_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_TinyPatternDict_int32, /*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_11colibricore_TinyPatternDict_int32, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_int __pyx_vtable_11colibricore_PatternDict_int;

static PyObject *__pyx_tp_new_11colibricore_PatternDict_int(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternDict_int *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternDict_int *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternDict_int;
  new((void*)&(p->data)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ();
  new((void*)&(p->it)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  new((void*)&(p->it_end)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternDict_int(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternDict_int *p = (struct __pyx_obj_11colibricore_PatternDict_int *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_PatternDict_int(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_11colibricore_PatternDict_int(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_15PatternDict_int_21__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_PatternDict_int[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_5has, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_14items, METH_NOARGS, __pyx_doc_11colibricore_15PatternDict_int_13items},
  {"read", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_17read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_19write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_15PatternDict_int_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternDict_int = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_15PatternDict_int_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternDict_int = {
  __pyx_pw_11colibricore_15PatternDict_int_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_PatternDict_int, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_15PatternDict_int_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternDict_int = {
  __pyx_pw_11colibricore_15PatternDict_int_3__len__, /*mp_length*/
  __pyx_pw_11colibricore_15PatternDict_int_12__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_PatternDict_int, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternDict_int = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternDict_int", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternDict_int), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternDict_int, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternDict_int, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternDict_int, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternDict_int, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_15PatternDict_int_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternDict_int, /*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_11colibricore_PatternDict_int, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternDict_float __pyx_vtable_11colibricore_PatternDict_float;

static PyObject *__pyx_tp_new_11colibricore_PatternDict_float(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternDict_float *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternDict_float *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternDict_float;
  new((void*)&(p->data)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ();
  new((void*)&(p->it)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  new((void*)&(p->it_end)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternDict_float(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternDict_float *p = (struct __pyx_obj_11colibricore_PatternDict_float *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_PatternDict_float(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_11colibricore_PatternDict_float(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_17PatternDict_float_21__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_PatternDict_float[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_5has, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_14items, METH_NOARGS, __pyx_doc_11colibricore_17PatternDict_float_13items},
  {"read", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_17read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_19write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_17PatternDict_float_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternDict_float = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_17PatternDict_float_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternDict_float = {
  __pyx_pw_11colibricore_17PatternDict_float_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_PatternDict_float, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_17PatternDict_float_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternDict_float = {
  __pyx_pw_11colibricore_17PatternDict_float_3__len__, /*mp_length*/
  __pyx_pw_11colibricore_17PatternDict_float_12__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_PatternDict_float, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternDict_float = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternDict_float", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternDict_float), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternDict_float, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternDict_float, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternDict_float, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternDict_float, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and float (double) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_17PatternDict_float_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternDict_float, /*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_11colibricore_PatternDict_float, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_AlignedPatternDict_int32 __pyx_vtable_11colibricore_AlignedPatternDict_int32;

static PyObject *__pyx_tp_new_11colibricore_AlignedPatternDict_int32(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_AlignedPatternDict_int32;
  new((void*)&(p->data)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ();
  new((void*)&(p->it)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->it_end)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_AlignedPatternDict_int32(PyObject *o) {
  struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *p = (struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_AlignedPatternDict_int32(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_11colibricore_AlignedPatternDict_int32(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_24AlignedPatternDict_int32_26__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_AlignedPatternDict_int32[] = {
  {"childcount", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_3childcount, METH_O, __pyx_doc_11colibricore_24AlignedPatternDict_int32_2childcount},
  {"has", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_5has, METH_O, 0},
  {"haspair", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_24AlignedPatternDict_int32_7haspair, METH_VARARGS|METH_KEYWORDS, 0},
  {"children", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_14children, METH_O, __pyx_doc_11colibricore_24AlignedPatternDict_int32_13children},
  {"items", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_17items, METH_NOARGS, __pyx_doc_11colibricore_24AlignedPatternDict_int32_16items},
  {"getpair", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_24AlignedPatternDict_int32_20getpair, METH_VARARGS|METH_KEYWORDS, 0},
  {"setpair", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_24AlignedPatternDict_int32_22setpair, METH_VARARGS|METH_KEYWORDS, 0},
  {"read", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_28read, METH_O, 0},
  {"write", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_30write, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_32__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_24AlignedPatternDict_int32_34__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_AlignedPatternDict_int32 = {
  __pyx_pw_11colibricore_24AlignedPatternDict_int32_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_AlignedPatternDict_int32, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_24AlignedPatternDict_int32_9__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_AlignedPatternDict_int32 = {
  __pyx_pw_11colibricore_24AlignedPatternDict_int32_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_24AlignedPatternDict_int32_24__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_AlignedPatternDict_int32, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_AlignedPatternDict_int32 = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.AlignedPatternDict_int32", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_AlignedPatternDict_int32), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_AlignedPatternDict_int32, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_AlignedPatternDict_int32, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_AlignedPatternDict_int32, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This is a simple low-level dictionary that takes Pattern instances as keys, and integer (unsigned 64 bit) as value. For complete pattern models, use IndexedPatternModel or UnindexPatternModel instead.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_24AlignedPatternDict_int32_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_AlignedPatternDict_int32, /*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_11colibricore_AlignedPatternDict_int32, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_IndexedPatternModel __pyx_vtable_11colibricore_IndexedPatternModel;

static PyObject *__pyx_tp_new_11colibricore_IndexedPatternModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_IndexedPatternModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_IndexedPatternModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_IndexedPatternModel;
  new((void*)&(p->data)) IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ();
  new((void*)&(p->it)) PatternModel<IndexedData,IndexedDataHandler,PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  p->corpus = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_IndexedPatternModel(PyObject *o) {
  struct __pyx_obj_11colibricore_IndexedPatternModel *p = (struct __pyx_obj_11colibricore_IndexedPatternModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  Py_CLEAR(p->corpus);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11colibricore_IndexedPatternModel(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore_IndexedPatternModel *p = (struct __pyx_obj_11colibricore_IndexedPatternModel *)o;
  if (p->corpus) {
    e = (*v)(p->corpus, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11colibricore_IndexedPatternModel(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_11colibricore_IndexedPatternModel *p = (struct __pyx_obj_11colibricore_IndexedPatternModel *)o;
  tmp = ((PyObject*)p->corpus);
  p->corpus = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_11colibricore_IndexedPatternModel(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_IndexedPatternModel[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_5types, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_7tokens, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_9minlength, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_13type, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_15version, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_14version},
  {"occurrencecount", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_17occurrencecount, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_16occurrencecount},
  {"coveragecount", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_19coveragecount, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_18coveragecount},
  {"coverage", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_21coverage, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_20coverage},
  {"frequency", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_23frequency, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_22frequency},
  {"totaloccurrencesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_25totaloccurrencesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_24totaloccurrencesingroup},
  {"totalpatternsingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_27totalpatternsingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_26totalpatternsingroup},
  {"totaltokensingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_29totaltokensingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_28totaltokensingroup},
  {"totalwordtypesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_31totalwordtypesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_30totalwordtypesingroup},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_42load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_41load},
  {"loadreverseindex", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_44loadreverseindex, METH_O, 0},
  {"loadconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_46loadconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_48loadconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbysetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_50loadconstrainedbysetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_52read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_51read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_54write, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_53write},
  {"printmodel", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_56printmodel, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_55printmodel},
  {"train", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_58train, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_57train},
  {"train_filtered", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_60train_filtered, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_59train_filtered},
  {"trainconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_62trainconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_64trainconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbypatternsetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_66trainconstrainedbypatternsetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyalignmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_68trainconstrainedbyalignmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"report", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_70report, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_69report},
  {"printhistogram", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_72printhistogram, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_71printhistogram},
  {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_74prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_73prune},
  {"reverseindex", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_76reverseindex, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_75reverseindex},
  {"getreverseindex", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_78getreverseindex, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_77getreverseindex},
  {"getreverseindex_bysentence", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_81getreverseindex_bysentence, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_80getreverseindex_bysentence},
  {"histogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_84histogram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_83histogram},
  {"top", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_87top, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_86top},
  {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_89filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_88filter},
  {"getinstance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_92getinstance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_91getinstance},
  {"getdata", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_94getdata, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_93getdata},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_96add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_95add},
  {"items", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_101items, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_100items},
  {"covered", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_104covered, METH_O, 0},
  {"outputrelations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_106outputrelations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_105outputrelations},
  {"getsubchildren", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_108getsubchildren, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_107getsubchildren},
  {"getsubparents", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_111getsubparents, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_110getsubparents},
  {"getleftneighbours", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_114getleftneighbours, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_113getleftneighbours},
  {"getrightneighbours", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_117getrightneighbours, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_116getrightneighbours},
  {"getskipcontent", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_120getskipcontent, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_119getskipcontent},
  {"gettemplates", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_123gettemplates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_122gettemplates},
  {"getinstances", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_126getinstances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_125getinstances},
  {"getcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_129getcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_128getcooc},
  {"getleftcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_132getleftcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_131getleftcooc},
  {"getrightcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_19IndexedPatternModel_135getrightcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_19IndexedPatternModel_134getrightcooc},
  {"computeflexgrams_fromskipgrams", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_138computeflexgrams_fromskipgrams, METH_NOARGS, __pyx_doc_11colibricore_19IndexedPatternModel_137computeflexgrams_fromskipgrams},
  {"computeflexgrams_fromcooc", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_140computeflexgrams_fromcooc, METH_O, __pyx_doc_11colibricore_19IndexedPatternModel_139computeflexgrams_fromcooc},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_142__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_19IndexedPatternModel_144__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_IndexedPatternModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_19IndexedPatternModel_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_IndexedPatternModel = {
  __pyx_pw_11colibricore_19IndexedPatternModel_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_IndexedPatternModel, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_19IndexedPatternModel_33__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_IndexedPatternModel = {
  __pyx_pw_11colibricore_19IndexedPatternModel_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_19IndexedPatternModel_35__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_IndexedPatternModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.IndexedPatternModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_IndexedPatternModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_IndexedPatternModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_IndexedPatternModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_IndexedPatternModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IndexedPatternModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Indexed Pattern Model. Implemented using a hash map (dictionary)", /*tp_doc*/
  __pyx_tp_traverse_11colibricore_IndexedPatternModel, /*tp_traverse*/
  __pyx_tp_clear_11colibricore_IndexedPatternModel, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_19IndexedPatternModel_98__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_IndexedPatternModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_19IndexedPatternModel_40__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_IndexedPatternModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_HashOrderedIndexedPatternModel __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel;

static PyObject *__pyx_tp_new_11colibricore_HashOrderedIndexedPatternModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel;
  new((void*)&(p->data)) IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ();
  new((void*)&(p->it)) PatternModel<IndexedData,IndexedDataHandler,HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  p->corpus = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_HashOrderedIndexedPatternModel(PyObject *o) {
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *p = (struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  Py_CLEAR(p->corpus);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11colibricore_HashOrderedIndexedPatternModel(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *p = (struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)o;
  if (p->corpus) {
    e = (*v)(p->corpus, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11colibricore_HashOrderedIndexedPatternModel(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *p = (struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *)o;
  tmp = ((PyObject*)p->corpus);
  p->corpus = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_11colibricore_HashOrderedIndexedPatternModel(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_HashOrderedIndexedPatternModel[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_5types, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_7tokens, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_9minlength, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_13type, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_15version, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_14version},
  {"occurrencecount", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_17occurrencecount, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_16occurrencecount},
  {"coveragecount", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_19coveragecount, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_18coveragecount},
  {"coverage", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_21coverage, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_20coverage},
  {"frequency", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_23frequency, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_22frequency},
  {"totaloccurrencesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_25totaloccurrencesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_24totaloccurrencesingroup},
  {"totalpatternsingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_27totalpatternsingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_26totalpatternsingroup},
  {"totaltokensingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_29totaltokensingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_28totaltokensingroup},
  {"totalwordtypesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_31totalwordtypesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_30totalwordtypesingroup},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_42load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_41load},
  {"loadreverseindex", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_44loadreverseindex, METH_O, 0},
  {"loadconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_46loadconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_48loadconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbysetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_50loadconstrainedbysetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_52read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_51read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_54write, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_53write},
  {"printmodel", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_56printmodel, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_55printmodel},
  {"train", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_58train, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_57train},
  {"train_filtered", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_60train_filtered, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_59train_filtered},
  {"trainconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_62trainconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_64trainconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbypatternsetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_66trainconstrainedbypatternsetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyalignmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_68trainconstrainedbyalignmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"report", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_70report, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_69report},
  {"printhistogram", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_72printhistogram, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_71printhistogram},
  {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_74prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_73prune},
  {"reverseindex", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_76reverseindex, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_75reverseindex},
  {"getreverseindex", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_78getreverseindex, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_77getreverseindex},
  {"getreverseindex_bysentence", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_81getreverseindex_bysentence, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_80getreverseindex_bysentence},
  {"histogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_84histogram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_83histogram},
  {"top", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_87top, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_86top},
  {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_89filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_88filter},
  {"getinstance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_92getinstance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_91getinstance},
  {"getdata", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_94getdata, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_93getdata},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_96add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_95add},
  {"items", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_101items, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_100items},
  {"covered", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_104covered, METH_O, 0},
  {"outputrelations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_106outputrelations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_105outputrelations},
  {"getsubchildren", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_108getsubchildren, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_107getsubchildren},
  {"getsubparents", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_111getsubparents, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_110getsubparents},
  {"getleftneighbours", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_114getleftneighbours, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_113getleftneighbours},
  {"getrightneighbours", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_117getrightneighbours, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_116getrightneighbours},
  {"getskipcontent", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_120getskipcontent, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_119getskipcontent},
  {"gettemplates", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_123gettemplates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_122gettemplates},
  {"getinstances", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_126getinstances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_125getinstances},
  {"getcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_129getcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_128getcooc},
  {"getleftcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_132getleftcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_131getleftcooc},
  {"getrightcooc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_135getrightcooc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_134getrightcooc},
  {"computeflexgrams_fromskipgrams", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_138computeflexgrams_fromskipgrams, METH_NOARGS, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_137computeflexgrams_fromskipgrams},
  {"computeflexgrams_fromcooc", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_140computeflexgrams_fromcooc, METH_O, __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_139computeflexgrams_fromcooc},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_142__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_144__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HashOrderedIndexedPatternModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HashOrderedIndexedPatternModel = {
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_HashOrderedIndexedPatternModel, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_33__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HashOrderedIndexedPatternModel = {
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_35__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_HashOrderedIndexedPatternModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.HashOrderedIndexedPatternModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_HashOrderedIndexedPatternModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_HashOrderedIndexedPatternModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_HashOrderedIndexedPatternModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HashOrderedIndexedPatternModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Indexed Pattern Model. Implemented using an ordered map", /*tp_doc*/
  __pyx_tp_traverse_11colibricore_HashOrderedIndexedPatternModel, /*tp_traverse*/
  __pyx_tp_clear_11colibricore_HashOrderedIndexedPatternModel, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_98__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_HashOrderedIndexedPatternModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_30HashOrderedIndexedPatternModel_40__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_HashOrderedIndexedPatternModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternSetModel __pyx_vtable_11colibricore_PatternSetModel;

static PyObject *__pyx_tp_new_11colibricore_PatternSetModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternSetModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternSetModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternSetModel;
  new((void*)&(p->data)) PatternSetModel();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternSetModel(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternSetModel *p = (struct __pyx_obj_11colibricore_PatternSetModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_PatternSetModel[] = {
  {"has", (PyCFunction)__pyx_pw_11colibricore_15PatternSetModel_5has, METH_O, 0},
  {"add", (PyCFunction)__pyx_pw_11colibricore_15PatternSetModel_12add, METH_O, __pyx_doc_11colibricore_15PatternSetModel_11add},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_15PatternSetModel_16load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_15PatternSetModel_15load},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_15PatternSetModel_18read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_15PatternSetModel_17read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_15PatternSetModel_20write, METH_O, __pyx_doc_11colibricore_15PatternSetModel_19write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_15PatternSetModel_22__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_15PatternSetModel_24__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternSetModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_15PatternSetModel_1__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternSetModel = {
  __pyx_pw_11colibricore_15PatternSetModel_3__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_11colibricore_15PatternSetModel_7__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternSetModel = {
  __pyx_pw_11colibricore_15PatternSetModel_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternSetModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternSetModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternSetModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternSetModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternSetModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternSetModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternSetModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_15PatternSetModel_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternSetModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_15PatternSetModel_14__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_PatternSetModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_UnindexedPatternModel __pyx_vtable_11colibricore_UnindexedPatternModel;

static PyObject *__pyx_tp_new_11colibricore_UnindexedPatternModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_UnindexedPatternModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_UnindexedPatternModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_UnindexedPatternModel;
  new((void*)&(p->data)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ();
  new((void*)&(p->it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  p->corpus = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_UnindexedPatternModel(PyObject *o) {
  struct __pyx_obj_11colibricore_UnindexedPatternModel *p = (struct __pyx_obj_11colibricore_UnindexedPatternModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  Py_CLEAR(p->corpus);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11colibricore_UnindexedPatternModel(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *p = (struct __pyx_obj_11colibricore_UnindexedPatternModel *)o;
  if (p->corpus) {
    e = (*v)(p->corpus, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11colibricore_UnindexedPatternModel(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_11colibricore_UnindexedPatternModel *p = (struct __pyx_obj_11colibricore_UnindexedPatternModel *)o;
  tmp = ((PyObject*)p->corpus);
  p->corpus = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_11colibricore_UnindexedPatternModel(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_UnindexedPatternModel[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_5types, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_7tokens, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_9minlength, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_13type, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_15version, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_14version},
  {"occurrencecount", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_17occurrencecount, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_16occurrencecount},
  {"coveragecount", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_19coveragecount, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_18coveragecount},
  {"coverage", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_21coverage, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_20coverage},
  {"frequency", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_23frequency, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_22frequency},
  {"totaloccurrencesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_25totaloccurrencesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_24totaloccurrencesingroup},
  {"totalpatternsingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_27totalpatternsingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_26totalpatternsingroup},
  {"totaltokensingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_29totaltokensingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_28totaltokensingroup},
  {"totalwordtypesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_31totalwordtypesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_30totalwordtypesingroup},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_42load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_41load},
  {"loadreverseindex", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_44loadreverseindex, METH_O, 0},
  {"loadconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_46loadconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_48loadconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbysetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_50loadconstrainedbysetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_52read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_51read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_54write, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_53write},
  {"printmodel", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_56printmodel, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_55printmodel},
  {"train", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_58train, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_57train},
  {"train_filtered", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_60train_filtered, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_59train_filtered},
  {"trainconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_62trainconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_64trainconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbypatternsetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_66trainconstrainedbypatternsetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyalignmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_68trainconstrainedbyalignmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"report", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_70report, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_69report},
  {"printhistogram", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_72printhistogram, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_71printhistogram},
  {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_74prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_73prune},
  {"reverseindex", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_76reverseindex, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_75reverseindex},
  {"getreverseindex", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_78getreverseindex, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_77getreverseindex},
  {"getreverseindex_bysentence", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_81getreverseindex_bysentence, METH_O, __pyx_doc_11colibricore_21UnindexedPatternModel_80getreverseindex_bysentence},
  {"histogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_84histogram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_83histogram},
  {"top", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_87top, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_86top},
  {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_89filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_88filter},
  {"getinstance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_92getinstance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_91getinstance},
  {"getdata", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_94getdata, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_96items, METH_NOARGS, __pyx_doc_11colibricore_21UnindexedPatternModel_95items},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_21UnindexedPatternModel_99add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_21UnindexedPatternModel_98add},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_101__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_21UnindexedPatternModel_103__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_UnindexedPatternModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_21UnindexedPatternModel_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_UnindexedPatternModel = {
  __pyx_pw_11colibricore_21UnindexedPatternModel_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_UnindexedPatternModel, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_21UnindexedPatternModel_33__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_UnindexedPatternModel = {
  __pyx_pw_11colibricore_21UnindexedPatternModel_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_21UnindexedPatternModel_35__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_UnindexedPatternModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.UnindexedPatternModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_UnindexedPatternModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_UnindexedPatternModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_UnindexedPatternModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_UnindexedPatternModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_UnindexedPatternModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Unindexed Pattern Model, less flexible and powerful than its indexed counterpart, but smaller memory footprint", /*tp_doc*/
  __pyx_tp_traverse_11colibricore_UnindexedPatternModel, /*tp_traverse*/
  __pyx_tp_clear_11colibricore_UnindexedPatternModel, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_21UnindexedPatternModel_37__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_UnindexedPatternModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_21UnindexedPatternModel_40__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_UnindexedPatternModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_OrderedUnindexedPatternModel __pyx_vtable_11colibricore_OrderedUnindexedPatternModel;

static PyObject *__pyx_tp_new_11colibricore_OrderedUnindexedPatternModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel;
  new((void*)&(p->data)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ();
  new((void*)&(p->it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  p->corpus = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_OrderedUnindexedPatternModel(PyObject *o) {
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *p = (struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  Py_CLEAR(p->corpus);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11colibricore_OrderedUnindexedPatternModel(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *p = (struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)o;
  if (p->corpus) {
    e = (*v)(p->corpus, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11colibricore_OrderedUnindexedPatternModel(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *p = (struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *)o;
  tmp = ((PyObject*)p->corpus);
  p->corpus = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_11colibricore_OrderedUnindexedPatternModel(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_OrderedUnindexedPatternModel[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_5types, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_7tokens, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_9minlength, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_13type, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_15version, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_14version},
  {"occurrencecount", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_17occurrencecount, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_16occurrencecount},
  {"coveragecount", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_19coveragecount, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_18coveragecount},
  {"coverage", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_21coverage, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_20coverage},
  {"frequency", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_23frequency, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_22frequency},
  {"totaloccurrencesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_25totaloccurrencesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_24totaloccurrencesingroup},
  {"totalpatternsingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_27totalpatternsingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_26totalpatternsingroup},
  {"totaltokensingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_29totaltokensingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_28totaltokensingroup},
  {"totalwordtypesingroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_31totalwordtypesingroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_30totalwordtypesingroup},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_42load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_41load},
  {"loadreverseindex", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_44loadreverseindex, METH_O, 0},
  {"loadconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_46loadconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_48loadconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"loadconstrainedbysetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_50loadconstrainedbysetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_52read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_51read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_54write, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_53write},
  {"printmodel", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_56printmodel, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_55printmodel},
  {"train", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_58train, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_57train},
  {"train_filtered", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_60train_filtered, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_59train_filtered},
  {"trainconstrainedbyindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_62trainconstrainedbyindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyunindexedmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_64trainconstrainedbyunindexedmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbypatternsetmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_66trainconstrainedbypatternsetmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"trainconstrainedbyalignmodel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_68trainconstrainedbyalignmodel, METH_VARARGS|METH_KEYWORDS, 0},
  {"report", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_70report, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_69report},
  {"printhistogram", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_72printhistogram, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_71printhistogram},
  {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_74prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_73prune},
  {"reverseindex", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_76reverseindex, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_75reverseindex},
  {"getreverseindex", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_78getreverseindex, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_77getreverseindex},
  {"getreverseindex_bysentence", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_81getreverseindex_bysentence, METH_O, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_80getreverseindex_bysentence},
  {"histogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_84histogram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_83histogram},
  {"top", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_87top, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_86top},
  {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_89filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_88filter},
  {"getinstance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_92getinstance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_91getinstance},
  {"getdata", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_94getdata, METH_O, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_96items, METH_NOARGS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_95items},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_99add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_98add},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_101__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_28OrderedUnindexedPatternModel_103__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_OrderedUnindexedPatternModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_OrderedUnindexedPatternModel = {
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_OrderedUnindexedPatternModel, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_33__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_OrderedUnindexedPatternModel = {
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_35__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_OrderedUnindexedPatternModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.OrderedUnindexedPatternModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_OrderedUnindexedPatternModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_OrderedUnindexedPatternModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_OrderedUnindexedPatternModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_OrderedUnindexedPatternModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Unindexed Pattern Model, implemented using an ordered map, less flexible and powerful than its indexed counterpart, but smaller memory footprint", /*tp_doc*/
  __pyx_tp_traverse_11colibricore_OrderedUnindexedPatternModel, /*tp_traverse*/
  __pyx_tp_clear_11colibricore_OrderedUnindexedPatternModel, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_37__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_OrderedUnindexedPatternModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_28OrderedUnindexedPatternModel_40__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_OrderedUnindexedPatternModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static PyObject *__pyx_tp_new_11colibricore_PatternModelOptions(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternModelOptions *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternModelOptions *)o);
  new((void*)&(p->coptions)) PatternModelOptions();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternModelOptions(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternModelOptions *p = (struct __pyx_obj_11colibricore_PatternModelOptions *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->coptions);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_getattro_11colibricore_PatternModelOptions(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_11colibricore_19PatternModelOptions_5__getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_11colibricore_PatternModelOptions(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_19PatternModelOptions_3__setattr__(o, n, v);
  }
  else {
    return PyObject_GenericSetAttr(o, n, 0);
  }
}

static PyMethodDef __pyx_methods_11colibricore_PatternModelOptions[] = {
  {"__getattr__", (PyCFunction)__pyx_pw_11colibricore_19PatternModelOptions_5__getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_19PatternModelOptions_7__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_19PatternModelOptions_9__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_11colibricore_PatternModelOptions = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternModelOptions", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternModelOptions), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternModelOptions, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_11colibricore_PatternModelOptions, /*tp_getattro*/
  __pyx_tp_setattro_11colibricore_PatternModelOptions, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Options for Pattern model, you can get and set the following attributes:\n\n    * MINTOKENS - The token threshold, patterns with an occurrence below this will be pruned\n    * MAXLENGTH - Maximum pattern length\n    * DOSKIPGRAMS - Compute skipgrams?\n    * DOSKIPGRAMS_EXHAUSTIVE - Compute skipgrams exhaustively?\n    * MINSKIPTYPES - Minimum amount of different skip content types\n    * MAXSKIPS - The maximum amount of skips in a skipgram\n    * DOREVERSEINDEX - Build reverse index? (default: True)\n    * DOPATTERNPERLINE - Assume each line holds one single pattern.\n    * MINTOKENS_UNIGRAMS - Word occurrence threshold (secondary threshold): only count patterns in which the words/unigrams occur at least this many times, only effective when the      primary\n    * MINTOKENS_SKIPGRAMS - The occurrence threshold for skipgrams, minimum amount of occurrences for a pattern to be included in a model. Defaults to the same value as MINTOKENS. Only used if DOSKIPGRAMS or DO_SKIPGRAMS_EXHAUSTIVE is set to true\n    * DOREMOVENGRAMS - Remove n-grams from the model\n    * DOREMOVESKIPGRAMS - Remove skipgrams from the model\n    * DOREMOVEFLEXGRAMS - Remove flexgrams from the model\n    * DORESET - Reset all counts before training\n    * PRUNENONSUBSUMED - Prune all n-grams up to this length that are *NOT* subsumed by higher-order ngrams\n    * PRUNESUBSUMED - Prune all n-grams up to this length that are subsumed by higher-order ngrams\n    * DEBUG\n    * QUIET (default: False)\n\n    These can also be passed at keyword arguments to the constructor, in a case insensitive fashion::\n\n        options = PatternModelOptions(mintokens=3)\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternModelOptions, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_19PatternModelOptions_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_PatternModelOptions, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_IndexedCorpus __pyx_vtable_11colibricore_IndexedCorpus;

static PyObject *__pyx_tp_new_11colibricore_IndexedCorpus(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_IndexedCorpus *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_IndexedCorpus *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_IndexedCorpus;
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->frommodel = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_11colibricore_IndexedCorpus(PyObject *o) {
  struct __pyx_obj_11colibricore_IndexedCorpus *p = (struct __pyx_obj_11colibricore_IndexedCorpus *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_11colibricore_13IndexedCorpus_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->frommodel);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_11colibricore_IndexedCorpus(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore_IndexedCorpus *p = (struct __pyx_obj_11colibricore_IndexedCorpus *)o;
  if (p->frommodel) {
    e = (*v)(p->frommodel, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_11colibricore_IndexedCorpus(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_11colibricore_IndexedCorpus *p = (struct __pyx_obj_11colibricore_IndexedCorpus *)o;
  tmp = ((PyObject*)p->frommodel);
  p->frommodel = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_11colibricore_IndexedCorpus(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_IndexedCorpus[] = {
  {"filename", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_5filename, METH_NOARGS, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_16items, METH_NOARGS, __pyx_doc_11colibricore_13IndexedCorpus_15items},
  {"findpattern", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_13IndexedCorpus_19findpattern, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_13IndexedCorpus_18findpattern},
  {"getinstance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_13IndexedCorpus_22getinstance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_13IndexedCorpus_21getinstance},
  {"sentencecount", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_24sentencecount, METH_NOARGS, __pyx_doc_11colibricore_13IndexedCorpus_23sentencecount},
  {"getsentence", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_26getsentence, METH_O, __pyx_doc_11colibricore_13IndexedCorpus_25getsentence},
  {"sentences", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_28sentences, METH_NOARGS, __pyx_doc_11colibricore_13IndexedCorpus_27sentences},
  {"sentencelength", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_31sentencelength, METH_O, __pyx_doc_11colibricore_13IndexedCorpus_30sentencelength},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_33__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_13IndexedCorpus_35__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_IndexedCorpus = {
  __pyx_pw_11colibricore_13IndexedCorpus_7__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_IndexedCorpus, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_13IndexedCorpus_9__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_IndexedCorpus = {
  __pyx_pw_11colibricore_13IndexedCorpus_7__len__, /*mp_length*/
  __pyx_pw_11colibricore_13IndexedCorpus_14__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_IndexedCorpus = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.IndexedCorpus", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_IndexedCorpus), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_IndexedCorpus, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_IndexedCorpus, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IndexedCorpus, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "An indexed version of a corpus, reads an entire corpus (colibri.dat file) in memory", /*tp_doc*/
  __pyx_tp_traverse_11colibricore_IndexedCorpus, /*tp_traverse*/
  __pyx_tp_clear_11colibricore_IndexedCorpus, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_13IndexedCorpus_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_IndexedCorpus, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_13IndexedCorpus_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_IndexedCorpus, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternVector __pyx_vtable_11colibricore_PatternVector;

static PyObject *__pyx_tp_new_11colibricore_PatternVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternVector *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternVector *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternVector;
  new((void*)&(p->data)) PatternVector();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternVector(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternVector *p = (struct __pyx_obj_11colibricore_PatternVector *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_11colibricore_PatternVector[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_13PatternVector_10__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_13PatternVector_12__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternVector = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_13PatternVector_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternVector = {
  __pyx_pw_11colibricore_13PatternVector_1__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_11colibricore_13PatternVector_5__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternVector = {
  __pyx_pw_11colibricore_13PatternVector_1__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternVector = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternVector", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternVector), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternVector, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternVector, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternVector, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternVector, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_13PatternVector_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternVector, /*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_11colibricore_PatternVector, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternFeatureVectorMap_float __pyx_vtable_11colibricore_PatternFeatureVectorMap_float;

static PyObject *__pyx_tp_new_11colibricore_PatternFeatureVectorMap_float(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternFeatureVectorMap_float;
  new((void*)&(p->data)) PatternFeatureVectorMap<double> ();
  new((void*)&(p->it)) PatternFeatureVectorMap<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternFeatureVectorMap_float(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *p = (struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_PatternFeatureVectorMap_float(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_11colibricore_PatternFeatureVectorMap_float(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_11__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_11colibricore_PatternFeatureVectorMap_float[] = {
  {"setdata", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_9setdata, METH_VARARGS|METH_KEYWORDS, 0},
  {"items", (PyCFunction)__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_13items, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_19__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_29PatternFeatureVectorMap_float_21__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternFeatureVectorMap_float = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternFeatureVectorMap_float = {
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_PatternFeatureVectorMap_float, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_5__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternFeatureVectorMap_float = {
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_11colibricore_PatternFeatureVectorMap_float, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternFeatureVectorMap_float = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternFeatureVectorMap_float", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternFeatureVectorMap_float, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternFeatureVectorMap_float, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternFeatureVectorMap_float, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternFeatureVectorMap_float, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_29PatternFeatureVectorMap_float_16__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternFeatureVectorMap_float, /*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_11colibricore_PatternFeatureVectorMap_float, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_PatternAlignmentModel_float __pyx_vtable_11colibricore_PatternAlignmentModel_float;

static PyObject *__pyx_tp_new_11colibricore_PatternAlignmentModel_float(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_PatternAlignmentModel_float;
  new((void*)&(p->data)) PatternAlignmentModel<double> ();
  new((void*)&(p->it)) PatternAlignmentModel<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_PatternAlignmentModel_float(PyObject *o) {
  struct __pyx_obj_11colibricore_PatternAlignmentModel_float *p = (struct __pyx_obj_11colibricore_PatternAlignmentModel_float *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_PatternAlignmentModel_float(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_PatternAlignmentModel_float[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_5types, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_7tokens, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_9minlength, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_13type, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_15version, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_14version},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_27PatternAlignmentModel_float_26load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_25load},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_27PatternAlignmentModel_float_28read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_27read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_30write, METH_O, __pyx_doc_11colibricore_27PatternAlignmentModel_float_29write},
  {"items", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_32items, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_31items},
  {"triples", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_35triples, METH_NOARGS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_34triples},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_27PatternAlignmentModel_float_38add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_27PatternAlignmentModel_float_37add},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_40__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_27PatternAlignmentModel_float_42__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PatternAlignmentModel_float = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PatternAlignmentModel_float = {
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_PatternAlignmentModel_float, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_17__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PatternAlignmentModel_float = {
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_19__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_PatternAlignmentModel_float = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.PatternAlignmentModel_float", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_PatternAlignmentModel_float), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_PatternAlignmentModel_float, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PatternAlignmentModel_float, /*tp_as_number*/
  &__pyx_tp_as_sequence_PatternAlignmentModel_float, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PatternAlignmentModel_float, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Pattern Alignment Model, maps patterns to pattern to score vectors (float)", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_21__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_PatternAlignmentModel_float, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_27PatternAlignmentModel_float_24__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_PatternAlignmentModel_float, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_11colibricore_BasicPatternAlignmentModel __pyx_vtable_11colibricore_BasicPatternAlignmentModel;

static PyObject *__pyx_tp_new_11colibricore_BasicPatternAlignmentModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)o);
  p->__pyx_vtab = __pyx_vtabptr_11colibricore_BasicPatternAlignmentModel;
  new((void*)&(p->data)) BasicPatternAlignmentModel();
  new((void*)&(p->it)) BasicPatternAlignmentModel::iterator();
  new((void*)&(p->it_end)) BasicPatternAlignmentModel::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore_BasicPatternAlignmentModel(PyObject *o) {
  struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *p = (struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->data);
  __Pyx_call_destructor(p->it);
  __Pyx_call_destructor(p->it_end);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_11colibricore_BasicPatternAlignmentModel(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_11colibricore_BasicPatternAlignmentModel[] = {
  {"types", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_5types, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_4types},
  {"tokens", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_7tokens, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_6tokens},
  {"minlength", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_9minlength, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_8minlength},
  {"maxlength", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_11maxlength, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_10maxlength},
  {"type", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_13type, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_12type},
  {"version", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_15version, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_14version},
  {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_26load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_25load},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_28read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_27read},
  {"write", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_30write, METH_O, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_29write},
  {"items", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_32items, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_31items},
  {"pairs", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_35pairs, METH_NOARGS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_34pairs},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_38add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_26BasicPatternAlignmentModel_37add},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_40__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_11colibricore_26BasicPatternAlignmentModel_42__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BasicPatternAlignmentModel = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_3__bool__, /*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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BasicPatternAlignmentModel = {
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_11colibricore_BasicPatternAlignmentModel, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_17__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BasicPatternAlignmentModel = {
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_1__len__, /*mp_length*/
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_19__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_11colibricore_BasicPatternAlignmentModel = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.BasicPatternAlignmentModel", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore_BasicPatternAlignmentModel, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_BasicPatternAlignmentModel, /*tp_as_number*/
  &__pyx_tp_as_sequence_BasicPatternAlignmentModel, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BasicPatternAlignmentModel, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Pattern Alignment Model, maps patterns to pattern to score vectors (float)", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_21__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11colibricore_BasicPatternAlignmentModel, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_11colibricore_26BasicPatternAlignmentModel_24__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore_BasicPatternAlignmentModel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *__pyx_freelist_11colibricore___pyx_scope_struct____iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct____iter__[--__pyx_freecount_11colibricore___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct____iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct____iter__[__pyx_freecount_11colibricore___pyx_scope_struct____iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct____iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct____iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct____iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *__pyx_freelist_11colibricore___pyx_scope_struct_1__ngrams_aux[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_1__ngrams_aux = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_1__ngrams_aux(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_1__ngrams_aux > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_1__ngrams_aux[--__pyx_freecount_11colibricore___pyx_scope_struct_1__ngrams_aux];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)o);
  new((void*)&(p->__pyx_v_cngram)) Pattern();
  new((void*)&(p->__pyx_v_it)) std::vector<Pattern> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) std::vector<Pattern> ::iterator();
  new((void*)&(p->__pyx_v_result)) std::vector<Pattern> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_1__ngrams_aux(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cngram);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  __Pyx_call_destructor(p->__pyx_v_result);
  Py_CLEAR(p->__pyx_v_ngram);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_1__ngrams_aux < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_1__ngrams_aux[__pyx_freecount_11colibricore___pyx_scope_struct_1__ngrams_aux++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_1__ngrams_aux(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux *)o;
  if (p->__pyx_v_ngram) {
    e = (*v)(((PyObject *)p->__pyx_v_ngram), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_1__ngrams_aux", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_1__ngrams_aux), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_1__ngrams_aux, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_1__ngrams_aux, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_1__ngrams_aux, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *__pyx_freelist_11colibricore___pyx_scope_struct_2_parts[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_2_parts = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_2_parts(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_2_parts > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_2_parts[--__pyx_freecount_11colibricore___pyx_scope_struct_2_parts];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)o);
  new((void*)&(p->__pyx_v_cngram)) Pattern();
  new((void*)&(p->__pyx_v_it)) std::vector<Pattern> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) std::vector<Pattern> ::iterator();
  new((void*)&(p->__pyx_v_result)) std::vector<Pattern> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_2_parts(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cngram);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  __Pyx_call_destructor(p->__pyx_v_result);
  Py_CLEAR(p->__pyx_v_ngram);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_2_parts < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_2_parts[__pyx_freecount_11colibricore___pyx_scope_struct_2_parts++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_2_parts(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts *)o;
  if (p->__pyx_v_ngram) {
    e = (*v)(((PyObject *)p->__pyx_v_ngram), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_2_parts = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_2_parts", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_2_parts), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_2_parts, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_2_parts, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_2_parts, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *__pyx_freelist_11colibricore___pyx_scope_struct_3_gaps[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_3_gaps = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_3_gaps(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_3_gaps > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_3_gaps[--__pyx_freecount_11colibricore___pyx_scope_struct_3_gaps];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)o);
  new((void*)&(p->__pyx_v_it)) std::vector<std::pair<int,int> > ::iterator();
  new((void*)&(p->__pyx_v_it_end)) std::vector<std::pair<int,int> > ::iterator();
  new((void*)&(p->__pyx_v_p)) std::pair<int,int> ();
  new((void*)&(p->__pyx_v_result)) std::vector<std::pair<int,int> > ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_3_gaps(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  __Pyx_call_destructor(p->__pyx_v_p);
  __Pyx_call_destructor(p->__pyx_v_result);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_3_gaps < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_3_gaps[__pyx_freecount_11colibricore___pyx_scope_struct_3_gaps++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_3_gaps(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_3_gaps = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_3_gaps", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_3_gaps), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_3_gaps, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_3_gaps, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_3_gaps, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *__pyx_freelist_11colibricore___pyx_scope_struct_4_subngrams[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_4_subngrams = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_4_subngrams(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_4_subngrams > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_4_subngrams[--__pyx_freecount_11colibricore___pyx_scope_struct_4_subngrams];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_4_subngrams(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_4);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_4_subngrams < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_4_subngrams[__pyx_freecount_11colibricore___pyx_scope_struct_4_subngrams++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_4_subngrams(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(p->__pyx_v_pattern, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_4_subngrams = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_4_subngrams", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_4_subngrams), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_4_subngrams, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_4_subngrams, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_4_subngrams, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_5___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_5___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_5___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_5___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_5___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_5___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)o);
  new((void*)&(p->__pyx_v_it)) IndexedData::iterator();
  new((void*)&(p->__pyx_v_it_end)) IndexedData::iterator();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_5___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  __Pyx_call_destructor(p->__pyx_v_ref);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_5___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_5___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_5___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_5___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_5___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_5___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_5___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_5___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_5___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_5___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_6___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_6___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_6___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_6___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_6___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_6___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternSet<unsigned int> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternSet<unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_6___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_6___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_6___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_6___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_6___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_6___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_6___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_6___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_6___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_6___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_6___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_7___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_7___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_7___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_7___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_7___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_7___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_7___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_7___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_7___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_7___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_7___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_7___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *__pyx_freelist_11colibricore___pyx_scope_struct_8_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_8_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_8_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_8_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_8_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_8_items[--__pyx_freecount_11colibricore___pyx_scope_struct_8_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_8_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_8_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_8_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_8_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_8_items[__pyx_freecount_11colibricore___pyx_scope_struct_8_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_8_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_8_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_8_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_8_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_8_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_8_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_8_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_8_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_9___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_9___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_9___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_9___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_9___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_9___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_9___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_9___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_9___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_9___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_9___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_9___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_9___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_9___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_9___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_9___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_9___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *__pyx_freelist_11colibricore___pyx_scope_struct_10_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_10_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_10_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_10_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_10_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_10_items[--__pyx_freecount_11colibricore___pyx_scope_struct_10_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_10_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_10_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_10_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_10_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_10_items[__pyx_freecount_11colibricore___pyx_scope_struct_10_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_10_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_10_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_10_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_10_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_10_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_10_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_10_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_10_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_11___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_11___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_11___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_11___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_11___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_11___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_11___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_11___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_11___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_11___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_11___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_11___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_11___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_11___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_11___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_11___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_11___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *__pyx_freelist_11colibricore___pyx_scope_struct_12_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_12_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_12_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_12_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_12_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_12_items[--__pyx_freecount_11colibricore___pyx_scope_struct_12_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_12_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_12_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_12_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_12_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_12_items[__pyx_freecount_11colibricore___pyx_scope_struct_12_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_12_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_12_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_12_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_12_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_12_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_12_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_12_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_12_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_13___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_13___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_13___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_13___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_13___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_13___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_13___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_13___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_13___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_13___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_13___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_13___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_13___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_13___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_13___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_13___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_13___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *__pyx_freelist_11colibricore___pyx_scope_struct_14_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_14_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_14_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_14_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_14_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_14_items[--__pyx_freecount_11colibricore___pyx_scope_struct_14_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_14_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<unsigned int,BaseValueHandler<unsigned int> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_14_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_14_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_14_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_14_items[__pyx_freecount_11colibricore___pyx_scope_struct_14_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_14_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_14_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_14_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_14_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_14_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_14_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_14_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_14_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_15___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_15___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_15___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_15___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_15___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_15___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_15___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_15___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_15___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_15___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_15___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_15___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_15___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_15___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_15___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_15___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_15___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *__pyx_freelist_11colibricore___pyx_scope_struct_16_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_16_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_16_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_16_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_16_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_16_items[--__pyx_freecount_11colibricore___pyx_scope_struct_16_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_16_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternMap<float,BaseValueHandler<float> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_16_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_value);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_16_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_16_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_16_items[__pyx_freecount_11colibricore___pyx_scope_struct_16_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_16_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_16_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_16_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_16_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_16_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_16_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_16_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_16_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_17___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_17___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_17___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_17___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_17___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_17___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_17___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_17___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_17___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_17___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_17___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_17___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_17___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_17___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_17___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_17___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_17___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *__pyx_freelist_11colibricore___pyx_scope_struct_18_children[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_18_children = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_18_children(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_18_children > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_18_children)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_18_children[--__pyx_freecount_11colibricore___pyx_scope_struct_18_children];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_18_children));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it2)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it2_end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_18_children(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it2);
  __Pyx_call_destructor(p->__pyx_v_it2_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_18_children < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_18_children)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_18_children[__pyx_freecount_11colibricore___pyx_scope_struct_18_children++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_18_children(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_18_children *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_18_children = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_18_children", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_18_children), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_18_children, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_18_children, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_18_children, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *__pyx_freelist_11colibricore___pyx_scope_struct_19_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_19_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_19_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_19_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_19_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_19_items[--__pyx_freecount_11colibricore___pyx_scope_struct_19_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_19_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it2)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it2end)) PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) AlignedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_19_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it2);
  __Pyx_call_destructor(p->__pyx_v_it2end);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_pattern2);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_19_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_19_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_19_items[__pyx_freecount_11colibricore___pyx_scope_struct_19_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_19_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_19_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_pattern2) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern2), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_19_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_19_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_19_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_19_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_19_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_19_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_20___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_20___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_20___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_20___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_20___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_20___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_20___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_20___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_20___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_20___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_20___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_20___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_20___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_20___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_20___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_20___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_20___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *__pyx_freelist_11colibricore___pyx_scope_struct_21_getreverseindex[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_21_getreverseindex = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_21_getreverseindex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_21_getreverseindex > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_21_getreverseindex[--__pyx_freecount_11colibricore___pyx_scope_struct_21_getreverseindex];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  new((void*)&(p->__pyx_v_resit)) std::unordered_set<PatternPointer> ::iterator();
  new((void*)&(p->__pyx_v_results)) std::unordered_set<PatternPointer> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_21_getreverseindex(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_ref);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_indexreference);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_21_getreverseindex < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_21_getreverseindex[__pyx_freecount_11colibricore___pyx_scope_struct_21_getreverseindex++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_21_getreverseindex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex *)o;
  if (p->__pyx_v_indexreference) {
    e = (*v)(p->__pyx_v_indexreference, a); if (e) return e;
  }
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_21_getreverseindex", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_21_getreverseindex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_21_getreverseindex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_21_getreverseindex, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_21_getreverseindex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *__pyx_freelist_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence[--__pyx_freecount_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_p)) std::pair<IndexReference,PatternPointer> ();
  new((void*)&(p->__pyx_v_resit)) std::vector<std::pair<IndexReference,PatternPointer> > ::iterator();
  new((void*)&(p->__pyx_v_results)) std::vector<std::pair<IndexReference,PatternPointer> > ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_p);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence[__pyx_freecount_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_22_getreverseindex_bysentence", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *__pyx_freelist_11colibricore___pyx_scope_struct_23_histogram[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_23_histogram = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_23_histogram(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_23_histogram > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_23_histogram[--__pyx_freecount_11colibricore___pyx_scope_struct_23_histogram];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)o);
  new((void*)&(p->__pyx_v_hist)) std::map<unsigned int,unsigned int> ();
  new((void*)&(p->__pyx_v_it)) std::map<unsigned int,unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_23_histogram(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_hist);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_23_histogram < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_23_histogram[__pyx_freecount_11colibricore___pyx_scope_struct_23_histogram++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_23_histogram(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_23_histogram = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_23_histogram", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_23_histogram), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_23_histogram, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_23_histogram, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_23_histogram, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *__pyx_freelist_11colibricore___pyx_scope_struct_24_filter[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_24_filter = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_24_filter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_24_filter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_24_filter[--__pyx_freecount_11colibricore___pyx_scope_struct_24_filter];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_24_filter(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_24_filter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_24_filter[__pyx_freecount_11colibricore___pyx_scope_struct_24_filter++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_24_filter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_24_filter = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_24_filter", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_24_filter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_24_filter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_24_filter, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_24_filter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_25___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_25___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_25___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_25___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_25___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_25___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_25___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_25___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_25___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_25___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_25___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_25___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_25___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_25___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_25___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_25___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_25___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *__pyx_freelist_11colibricore___pyx_scope_struct_26_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_26_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_26_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_26_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_26_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_26_items[--__pyx_freecount_11colibricore___pyx_scope_struct_26_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_26_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_cvalue)) IndexedData();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<PatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_26_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_cvalue);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_value);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_26_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_26_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_26_items[__pyx_freecount_11colibricore___pyx_scope_struct_26_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_26_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_26_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(((PyObject *)p->__pyx_v_value), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_26_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_26_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_26_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_26_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_26_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_26_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *__pyx_freelist_11colibricore___pyx_scope_struct_27_getsubchildren[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_27_getsubchildren = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_27_getsubchildren(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_27_getsubchildren > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_27_getsubchildren[--__pyx_freecount_11colibricore___pyx_scope_struct_27_getsubchildren];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_27_getsubchildren(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_27_getsubchildren < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_27_getsubchildren[__pyx_freecount_11colibricore___pyx_scope_struct_27_getsubchildren++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_27_getsubchildren(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_27_getsubchildren", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_27_getsubchildren), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_27_getsubchildren, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_27_getsubchildren, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_27_getsubchildren, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *__pyx_freelist_11colibricore___pyx_scope_struct_28_getsubparents[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_28_getsubparents = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_28_getsubparents(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_28_getsubparents > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_28_getsubparents[--__pyx_freecount_11colibricore___pyx_scope_struct_28_getsubparents];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_28_getsubparents(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_28_getsubparents < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_28_getsubparents[__pyx_freecount_11colibricore___pyx_scope_struct_28_getsubparents++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_28_getsubparents(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_28_getsubparents = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_28_getsubparents", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_28_getsubparents), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_28_getsubparents, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_28_getsubparents, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_28_getsubparents, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *__pyx_freelist_11colibricore___pyx_scope_struct_29_getleftneighbours[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_29_getleftneighbours = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_29_getleftneighbours(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_29_getleftneighbours > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_29_getleftneighbours[--__pyx_freecount_11colibricore___pyx_scope_struct_29_getleftneighbours];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_29_getleftneighbours(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_29_getleftneighbours < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_29_getleftneighbours[__pyx_freecount_11colibricore___pyx_scope_struct_29_getleftneighbours++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_29_getleftneighbours(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_29_getleftneighbours", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_29_getleftneighbours), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_29_getleftneighbours, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_29_getleftneighbours, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_29_getleftneighbours, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *__pyx_freelist_11colibricore___pyx_scope_struct_30_getrightneighbours[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_30_getrightneighbours = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_30_getrightneighbours(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_30_getrightneighbours > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_30_getrightneighbours[--__pyx_freecount_11colibricore___pyx_scope_struct_30_getrightneighbours];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_30_getrightneighbours(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_30_getrightneighbours < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_30_getrightneighbours[__pyx_freecount_11colibricore___pyx_scope_struct_30_getrightneighbours++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_30_getrightneighbours(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_30_getrightneighbours", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_30_getrightneighbours), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_30_getrightneighbours, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_30_getrightneighbours, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_30_getrightneighbours, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *__pyx_freelist_11colibricore___pyx_scope_struct_31_getskipcontent[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_31_getskipcontent = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_31_getskipcontent(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_31_getskipcontent > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_31_getskipcontent[--__pyx_freecount_11colibricore___pyx_scope_struct_31_getskipcontent];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_31_getskipcontent(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_31_getskipcontent < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_31_getskipcontent[__pyx_freecount_11colibricore___pyx_scope_struct_31_getskipcontent++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_31_getskipcontent(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_31_getskipcontent", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_31_getskipcontent), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_31_getskipcontent, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_31_getskipcontent, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_31_getskipcontent, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *__pyx_freelist_11colibricore___pyx_scope_struct_32_gettemplates[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_32_gettemplates = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_32_gettemplates(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_32_gettemplates > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_32_gettemplates[--__pyx_freecount_11colibricore___pyx_scope_struct_32_gettemplates];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_32_gettemplates(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_32_gettemplates < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_32_gettemplates[__pyx_freecount_11colibricore___pyx_scope_struct_32_gettemplates++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_32_gettemplates(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_32_gettemplates = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_32_gettemplates", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_32_gettemplates), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_32_gettemplates, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_32_gettemplates, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_32_gettemplates, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *__pyx_freelist_11colibricore___pyx_scope_struct_33_getinstances[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_33_getinstances = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_33_getinstances(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_33_getinstances > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_33_getinstances[--__pyx_freecount_11colibricore___pyx_scope_struct_33_getinstances];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_33_getinstances(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_33_getinstances < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_33_getinstances[__pyx_freecount_11colibricore___pyx_scope_struct_33_getinstances++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_33_getinstances(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_33_getinstances = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_33_getinstances", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_33_getinstances), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_33_getinstances, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_33_getinstances, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_33_getinstances, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *__pyx_freelist_11colibricore___pyx_scope_struct_34_getcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_34_getcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_34_getcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_34_getcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_34_getcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_34_getcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_34_getcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_34_getcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_34_getcooc[__pyx_freecount_11colibricore___pyx_scope_struct_34_getcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_34_getcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_34_getcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_34_getcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_34_getcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_34_getcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_34_getcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_34_getcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *__pyx_freelist_11colibricore___pyx_scope_struct_35_getleftcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_35_getleftcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_35_getleftcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_35_getleftcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_35_getleftcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_35_getleftcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_35_getleftcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_35_getleftcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_35_getleftcooc[__pyx_freecount_11colibricore___pyx_scope_struct_35_getleftcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_35_getleftcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_35_getleftcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_35_getleftcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_35_getleftcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_35_getleftcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_35_getleftcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *__pyx_freelist_11colibricore___pyx_scope_struct_36_getrightcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_36_getrightcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_36_getrightcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_36_getrightcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_36_getrightcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_36_getrightcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_36_getrightcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_36_getrightcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_36_getrightcooc[__pyx_freecount_11colibricore___pyx_scope_struct_36_getrightcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_36_getrightcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_36_getrightcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_36_getrightcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_36_getrightcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_36_getrightcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_36_getrightcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_37___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_37___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_37___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_37___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_37___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_37___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_37___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_37___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_37___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_37___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_37___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_37___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_37___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_37___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_37___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_37___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_37___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *__pyx_freelist_11colibricore___pyx_scope_struct_38_getreverseindex[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_38_getreverseindex = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_38_getreverseindex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_38_getreverseindex > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_38_getreverseindex[--__pyx_freecount_11colibricore___pyx_scope_struct_38_getreverseindex];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  new((void*)&(p->__pyx_v_resit)) std::unordered_set<PatternPointer> ::iterator();
  new((void*)&(p->__pyx_v_results)) std::unordered_set<PatternPointer> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_38_getreverseindex(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_ref);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_indexreference);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_38_getreverseindex < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_38_getreverseindex[__pyx_freecount_11colibricore___pyx_scope_struct_38_getreverseindex++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_38_getreverseindex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex *)o;
  if (p->__pyx_v_indexreference) {
    e = (*v)(p->__pyx_v_indexreference, a); if (e) return e;
  }
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_38_getreverseindex", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_38_getreverseindex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_38_getreverseindex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_38_getreverseindex, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_38_getreverseindex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *__pyx_freelist_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence[--__pyx_freecount_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_p)) std::pair<IndexReference,PatternPointer> ();
  new((void*)&(p->__pyx_v_resit)) std::vector<std::pair<IndexReference,PatternPointer> > ::iterator();
  new((void*)&(p->__pyx_v_results)) std::vector<std::pair<IndexReference,PatternPointer> > ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_p);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence[__pyx_freecount_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_39_getreverseindex_bysentence", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *__pyx_freelist_11colibricore___pyx_scope_struct_40_histogram[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_40_histogram = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_40_histogram(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_40_histogram > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_40_histogram[--__pyx_freecount_11colibricore___pyx_scope_struct_40_histogram];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)o);
  new((void*)&(p->__pyx_v_hist)) std::map<unsigned int,unsigned int> ();
  new((void*)&(p->__pyx_v_it)) std::map<unsigned int,unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_40_histogram(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_hist);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_40_histogram < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_40_histogram[__pyx_freecount_11colibricore___pyx_scope_struct_40_histogram++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_40_histogram(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_40_histogram = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_40_histogram", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_40_histogram), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_40_histogram, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_40_histogram, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_40_histogram, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *__pyx_freelist_11colibricore___pyx_scope_struct_41_filter[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_41_filter = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_41_filter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_41_filter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_41_filter[--__pyx_freecount_11colibricore___pyx_scope_struct_41_filter];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_41_filter(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_41_filter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_41_filter[__pyx_freecount_11colibricore___pyx_scope_struct_41_filter++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_41_filter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_41_filter = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_41_filter", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_41_filter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_41_filter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_41_filter, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_41_filter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_42___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_42___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_42___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_42___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_42___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_42___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_42___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_42___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_42___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_42___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_42___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_42___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_42___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_42___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_42___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_42___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_42___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *__pyx_freelist_11colibricore___pyx_scope_struct_43_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_43_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_43_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_43_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_43_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_43_items[--__pyx_freecount_11colibricore___pyx_scope_struct_43_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_43_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_cvalue)) IndexedData();
  new((void*)&(p->__pyx_v_it)) IndexedPatternModel<HashOrderedPatternMap<IndexedData,IndexedDataHandler,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_43_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_cvalue);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_value);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_43_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_43_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_43_items[__pyx_freecount_11colibricore___pyx_scope_struct_43_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_43_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_43_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(((PyObject *)p->__pyx_v_value), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_43_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_43_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_43_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_43_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_43_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_43_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *__pyx_freelist_11colibricore___pyx_scope_struct_44_getsubchildren[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_44_getsubchildren = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_44_getsubchildren(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_44_getsubchildren > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_44_getsubchildren[--__pyx_freecount_11colibricore___pyx_scope_struct_44_getsubchildren];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_44_getsubchildren(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_44_getsubchildren < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_44_getsubchildren[__pyx_freecount_11colibricore___pyx_scope_struct_44_getsubchildren++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_44_getsubchildren(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_44_getsubchildren", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_44_getsubchildren), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_44_getsubchildren, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_44_getsubchildren, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_44_getsubchildren, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *__pyx_freelist_11colibricore___pyx_scope_struct_45_getsubparents[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_45_getsubparents = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_45_getsubparents(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_45_getsubparents > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_45_getsubparents[--__pyx_freecount_11colibricore___pyx_scope_struct_45_getsubparents];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_45_getsubparents(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_45_getsubparents < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_45_getsubparents[__pyx_freecount_11colibricore___pyx_scope_struct_45_getsubparents++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_45_getsubparents(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_45_getsubparents = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_45_getsubparents", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_45_getsubparents), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_45_getsubparents, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_45_getsubparents, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_45_getsubparents, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *__pyx_freelist_11colibricore___pyx_scope_struct_46_getleftneighbours[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_46_getleftneighbours = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_46_getleftneighbours(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_46_getleftneighbours > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_46_getleftneighbours[--__pyx_freecount_11colibricore___pyx_scope_struct_46_getleftneighbours];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_46_getleftneighbours(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_46_getleftneighbours < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_46_getleftneighbours[__pyx_freecount_11colibricore___pyx_scope_struct_46_getleftneighbours++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_46_getleftneighbours(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_46_getleftneighbours", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_46_getleftneighbours), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_46_getleftneighbours, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_46_getleftneighbours, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_46_getleftneighbours, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *__pyx_freelist_11colibricore___pyx_scope_struct_47_getrightneighbours[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_47_getrightneighbours = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_47_getrightneighbours(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_47_getrightneighbours > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_47_getrightneighbours[--__pyx_freecount_11colibricore___pyx_scope_struct_47_getrightneighbours];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_47_getrightneighbours(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_47_getrightneighbours < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_47_getrightneighbours[__pyx_freecount_11colibricore___pyx_scope_struct_47_getrightneighbours++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_47_getrightneighbours(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_47_getrightneighbours", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_47_getrightneighbours), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_47_getrightneighbours, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_47_getrightneighbours, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_47_getrightneighbours, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *__pyx_freelist_11colibricore___pyx_scope_struct_48_getskipcontent[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_48_getskipcontent = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_48_getskipcontent(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_48_getskipcontent > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_48_getskipcontent[--__pyx_freecount_11colibricore___pyx_scope_struct_48_getskipcontent];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_48_getskipcontent(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_48_getskipcontent < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_48_getskipcontent[__pyx_freecount_11colibricore___pyx_scope_struct_48_getskipcontent++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_48_getskipcontent(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_48_getskipcontent", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_48_getskipcontent), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_48_getskipcontent, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_48_getskipcontent, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_48_getskipcontent, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *__pyx_freelist_11colibricore___pyx_scope_struct_49_gettemplates[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_49_gettemplates = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_49_gettemplates(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_49_gettemplates > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_49_gettemplates[--__pyx_freecount_11colibricore___pyx_scope_struct_49_gettemplates];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_49_gettemplates(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_49_gettemplates < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_49_gettemplates[__pyx_freecount_11colibricore___pyx_scope_struct_49_gettemplates++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_49_gettemplates(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_49_gettemplates = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_49_gettemplates", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_49_gettemplates), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_49_gettemplates, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_49_gettemplates, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_49_gettemplates, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *__pyx_freelist_11colibricore___pyx_scope_struct_50_getinstances[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_50_getinstances = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_50_getinstances(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_50_getinstances > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_50_getinstances[--__pyx_freecount_11colibricore___pyx_scope_struct_50_getinstances];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_50_getinstances(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_50_getinstances < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_50_getinstances[__pyx_freecount_11colibricore___pyx_scope_struct_50_getinstances++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_50_getinstances(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_50_getinstances = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_50_getinstances", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_50_getinstances), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_50_getinstances, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_50_getinstances, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_50_getinstances, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *__pyx_freelist_11colibricore___pyx_scope_struct_51_getcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_51_getcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_51_getcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_51_getcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_51_getcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_51_getcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_51_getcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_51_getcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_51_getcooc[__pyx_freecount_11colibricore___pyx_scope_struct_51_getcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_51_getcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_51_getcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_51_getcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_51_getcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_51_getcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_51_getcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_51_getcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *__pyx_freelist_11colibricore___pyx_scope_struct_52_getleftcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_52_getleftcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_52_getleftcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_52_getleftcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_52_getleftcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_52_getleftcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_52_getleftcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_52_getleftcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_52_getleftcooc[__pyx_freecount_11colibricore___pyx_scope_struct_52_getleftcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_52_getleftcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_52_getleftcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_52_getleftcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_52_getleftcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_52_getleftcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_52_getleftcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *__pyx_freelist_11colibricore___pyx_scope_struct_53_getrightcooc[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_53_getrightcooc = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_53_getrightcooc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_53_getrightcooc > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_53_getrightcooc[--__pyx_freecount_11colibricore___pyx_scope_struct_53_getrightcooc];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_relations)) t_relationmap();
  new((void*)&(p->__pyx_v_relit)) t_relationmap_iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_53_getrightcooc(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_relations);
  __Pyx_call_destructor(p->__pyx_v_relit);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_53_getrightcooc < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_53_getrightcooc[__pyx_freecount_11colibricore___pyx_scope_struct_53_getrightcooc++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_53_getrightcooc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_53_getrightcooc", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_53_getrightcooc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_53_getrightcooc, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_53_getrightcooc, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_53_getrightcooc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_54___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_54___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_54___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_54___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_54___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_54___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternSetModel::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternSetModel::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_54___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_54___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_54___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_54___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_54___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_54___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_54___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_54___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_54___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_54___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_54___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_55___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_55___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_55___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_55___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_55___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_55___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_55___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_55___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_55___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_55___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_55___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_55___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_55___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_55___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_55___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_55___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_55___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *__pyx_freelist_11colibricore___pyx_scope_struct_56_getreverseindex[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_56_getreverseindex = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_56_getreverseindex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_56_getreverseindex > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_56_getreverseindex[--__pyx_freecount_11colibricore___pyx_scope_struct_56_getreverseindex];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  new((void*)&(p->__pyx_v_resit)) std::unordered_set<PatternPointer> ::iterator();
  new((void*)&(p->__pyx_v_results)) std::unordered_set<PatternPointer> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_56_getreverseindex(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_ref);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_indexreference);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_56_getreverseindex < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_56_getreverseindex[__pyx_freecount_11colibricore___pyx_scope_struct_56_getreverseindex++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_56_getreverseindex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex *)o;
  if (p->__pyx_v_indexreference) {
    e = (*v)(p->__pyx_v_indexreference, a); if (e) return e;
  }
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_56_getreverseindex", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_56_getreverseindex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_56_getreverseindex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_56_getreverseindex, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_56_getreverseindex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *__pyx_freelist_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence[--__pyx_freecount_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_p)) std::pair<IndexReference,PatternPointer> ();
  new((void*)&(p->__pyx_v_resit)) std::vector<std::pair<IndexReference,PatternPointer> > ::iterator();
  new((void*)&(p->__pyx_v_results)) std::vector<std::pair<IndexReference,PatternPointer> > ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_p);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence[__pyx_freecount_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_57_getreverseindex_bysentence", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *__pyx_freelist_11colibricore___pyx_scope_struct_58_histogram[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_58_histogram = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_58_histogram(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_58_histogram > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_58_histogram[--__pyx_freecount_11colibricore___pyx_scope_struct_58_histogram];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)o);
  new((void*)&(p->__pyx_v_hist)) std::map<unsigned int,unsigned int> ();
  new((void*)&(p->__pyx_v_it)) std::map<unsigned int,unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_58_histogram(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_hist);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_58_histogram < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_58_histogram[__pyx_freecount_11colibricore___pyx_scope_struct_58_histogram++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_58_histogram(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_58_histogram = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_58_histogram", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_58_histogram), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_58_histogram, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_58_histogram, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_58_histogram, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *__pyx_freelist_11colibricore___pyx_scope_struct_59_filter[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_59_filter = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_59_filter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_59_filter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_59_filter[--__pyx_freecount_11colibricore___pyx_scope_struct_59_filter];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_59_filter(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_59_filter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_59_filter[__pyx_freecount_11colibricore___pyx_scope_struct_59_filter++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_59_filter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_59_filter = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_59_filter", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_59_filter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_59_filter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_59_filter, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_59_filter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *__pyx_freelist_11colibricore___pyx_scope_struct_60_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_60_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_60_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_60_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_60_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_60_items[--__pyx_freecount_11colibricore___pyx_scope_struct_60_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_60_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_60_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_60_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_60_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_60_items[__pyx_freecount_11colibricore___pyx_scope_struct_60_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_60_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_60_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_60_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_60_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_60_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_60_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_60_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_60_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_61___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_61___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_61___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_61___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_61___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_61___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_61___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_61___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_61___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_61___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_61___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_61___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_61___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_61___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_61___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_61___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_61___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *__pyx_freelist_11colibricore___pyx_scope_struct_62_getreverseindex[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_62_getreverseindex = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_62_getreverseindex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_62_getreverseindex > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_62_getreverseindex[--__pyx_freecount_11colibricore___pyx_scope_struct_62_getreverseindex];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  new((void*)&(p->__pyx_v_resit)) std::unordered_set<PatternPointer> ::iterator();
  new((void*)&(p->__pyx_v_results)) std::unordered_set<PatternPointer> ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_62_getreverseindex(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_ref);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_indexreference);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_62_getreverseindex < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_62_getreverseindex[__pyx_freecount_11colibricore___pyx_scope_struct_62_getreverseindex++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_62_getreverseindex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex *)o;
  if (p->__pyx_v_indexreference) {
    e = (*v)(p->__pyx_v_indexreference, a); if (e) return e;
  }
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_62_getreverseindex", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_62_getreverseindex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_62_getreverseindex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_62_getreverseindex, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_62_getreverseindex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *__pyx_freelist_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence[--__pyx_freecount_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_p)) std::pair<IndexReference,PatternPointer> ();
  new((void*)&(p->__pyx_v_resit)) std::vector<std::pair<IndexReference,PatternPointer> > ::iterator();
  new((void*)&(p->__pyx_v_results)) std::vector<std::pair<IndexReference,PatternPointer> > ();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_p);
  __Pyx_call_destructor(p->__pyx_v_resit);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence[__pyx_freecount_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_63_getreverseindex_bysentence", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *__pyx_freelist_11colibricore___pyx_scope_struct_64_histogram[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_64_histogram = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_64_histogram(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_64_histogram > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_64_histogram[--__pyx_freecount_11colibricore___pyx_scope_struct_64_histogram];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)o);
  new((void*)&(p->__pyx_v_hist)) std::map<unsigned int,unsigned int> ();
  new((void*)&(p->__pyx_v_it)) std::map<unsigned int,unsigned int> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_64_histogram(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_hist);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_64_histogram < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_64_histogram[__pyx_freecount_11colibricore___pyx_scope_struct_64_histogram++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_64_histogram(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_64_histogram = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_64_histogram", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_64_histogram), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_64_histogram, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_64_histogram, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_64_histogram, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *__pyx_freelist_11colibricore___pyx_scope_struct_65_filter[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_65_filter = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_65_filter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_65_filter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_65_filter[--__pyx_freecount_11colibricore___pyx_scope_struct_65_filter];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_65_filter(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_65_filter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_65_filter[__pyx_freecount_11colibricore___pyx_scope_struct_65_filter++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_65_filter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_65_filter = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_65_filter", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_65_filter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_65_filter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_65_filter, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_65_filter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *__pyx_freelist_11colibricore___pyx_scope_struct_66_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_66_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_66_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_66_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_66_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_66_items[--__pyx_freecount_11colibricore___pyx_scope_struct_66_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_66_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternModel<uint32_t,BaseValueHandler<uint32_t> ,HashOrderedPatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint64_t> > ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_66_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_66_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_66_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_66_items[__pyx_freecount_11colibricore___pyx_scope_struct_66_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_66_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_66_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_66_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_66_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_66_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_66_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_66_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_66_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_67___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_67___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_67___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_67___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_67___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_67___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)o);
  new((void*)&(p->__pyx_v_endit)) IndexedCorpus::iterator();
  new((void*)&(p->__pyx_v_it)) IndexedCorpus::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_67___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_endit);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_67___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_67___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_67___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_67___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_67___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_67___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_67___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_67___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_67___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_67___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *__pyx_freelist_11colibricore___pyx_scope_struct_68_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_68_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_68_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_68_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_68_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_68_items[--__pyx_freecount_11colibricore___pyx_scope_struct_68_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_68_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) IndexedCorpus::iterator();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_68_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_ref);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_68_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_68_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_68_items[__pyx_freecount_11colibricore___pyx_scope_struct_68_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_68_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_68_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_68_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_68_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_68_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_68_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_68_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_68_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *__pyx_freelist_11colibricore___pyx_scope_struct_69_findpattern[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_69_findpattern = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_69_findpattern(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_69_findpattern > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_69_findpattern[--__pyx_freecount_11colibricore___pyx_scope_struct_69_findpattern];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) std::vector<std::pair<IndexReference,PatternPointer> > ::iterator();
  new((void*)&(p->__pyx_v_matches)) std::vector<std::pair<IndexReference,PatternPointer> > ();
  new((void*)&(p->__pyx_v_ref)) IndexReference();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_69_findpattern(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_matches);
  __Pyx_call_destructor(p->__pyx_v_ref);
  Py_CLEAR(p->__pyx_v_foundpattern);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_69_findpattern < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_69_findpattern[__pyx_freecount_11colibricore___pyx_scope_struct_69_findpattern++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_69_findpattern(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern *)o;
  if (p->__pyx_v_foundpattern) {
    e = (*v)(((PyObject *)p->__pyx_v_foundpattern), a); if (e) return e;
  }
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_69_findpattern = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_69_findpattern", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_69_findpattern), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_69_findpattern, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_69_findpattern, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_69_findpattern, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *__pyx_freelist_11colibricore___pyx_scope_struct_70_sentences[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_70_sentences = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_70_sentences(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_70_sentences > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_70_sentences[--__pyx_freecount_11colibricore___pyx_scope_struct_70_sentences];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_70_sentences(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_70_sentences < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_70_sentences[__pyx_freecount_11colibricore___pyx_scope_struct_70_sentences++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_70_sentences(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_70_sentences = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_70_sentences", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_70_sentences), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_70_sentences, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_70_sentences, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_70_sentences, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_71___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_71___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_71___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_71___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_71___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_71___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)o);
  new((void*)&(p->__pyx_v_it)) PatternVector::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternVector::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_71___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_71___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_71___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_71___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_71___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_71___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_71___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_71___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_71___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_71___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_71___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *__pyx_freelist_11colibricore___pyx_scope_struct_72_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_72_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_72_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_72_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_72_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_72_items[--__pyx_freecount_11colibricore___pyx_scope_struct_72_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_72_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)o);
  new((void*)&(p->__pyx_v_it)) PatternFeatureVectorMap<double> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternFeatureVectorMap<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_72_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_72_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_72_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_72_items[__pyx_freecount_11colibricore___pyx_scope_struct_72_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_72_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_72_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_72_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_72_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_72_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_72_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_72_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_72_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_73___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_73___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_73___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_73___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_73___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_73___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)o);
  new((void*)&(p->__pyx_v_it)) PatternFeatureVectorMap<double> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternFeatureVectorMap<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_73___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_73___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_73___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_73___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_73___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_73___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_73___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_73___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_73___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_73___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_73___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_74___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_74___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_74___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_74___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_74___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_74___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternAlignmentModel<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_74___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_74___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_74___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_74___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_74___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_74___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_74___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_74___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_74___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_74___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_74___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *__pyx_freelist_11colibricore___pyx_scope_struct_75_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_75_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_75_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_75_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_75_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_75_items[--__pyx_freecount_11colibricore___pyx_scope_struct_75_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_75_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)o);
  new((void*)&(p->__pyx_v_cmap)) PatternFeatureVectorMap<double> ();
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternAlignmentModel<double> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternAlignmentModel<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_75_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cmap);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_pmap);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_75_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_75_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_75_items[__pyx_freecount_11colibricore___pyx_scope_struct_75_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_75_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_75_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_pmap) {
    e = (*v)(((PyObject *)p->__pyx_v_pmap), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_75_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_75_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_75_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_75_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_75_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_75_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *__pyx_freelist_11colibricore___pyx_scope_struct_76_triples[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_76_triples = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_76_triples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_76_triples > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_76_triples[--__pyx_freecount_11colibricore___pyx_scope_struct_76_triples];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)o);
  new((void*)&(p->__pyx_v_cmap)) PatternFeatureVectorMap<double> ();
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) PatternAlignmentModel<double> ::iterator();
  new((void*)&(p->__pyx_v_it2)) PatternFeatureVectorMap<double> ::iterator();
  new((void*)&(p->__pyx_v_it2_end)) PatternFeatureVectorMap<double> ::iterator();
  new((void*)&(p->__pyx_v_it_end)) PatternAlignmentModel<double> ::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_76_triples(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cmap);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it2);
  __Pyx_call_destructor(p->__pyx_v_it2_end);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_sourcepattern);
  Py_CLEAR(p->__pyx_v_targetpattern);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_76_triples < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_76_triples[__pyx_freecount_11colibricore___pyx_scope_struct_76_triples++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_76_triples(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_sourcepattern) {
    e = (*v)(((PyObject *)p->__pyx_v_sourcepattern), a); if (e) return e;
  }
  if (p->__pyx_v_targetpattern) {
    e = (*v)(((PyObject *)p->__pyx_v_targetpattern), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_76_triples = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_76_triples", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_76_triples), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_76_triples, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_76_triples, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_76_triples, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *__pyx_freelist_11colibricore___pyx_scope_struct_77___iter__[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_77___iter__ = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_77___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_77___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_77___iter__[--__pyx_freecount_11colibricore___pyx_scope_struct_77___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_it)) BasicPatternAlignmentModel::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_77___iter__(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_77___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_77___iter__[__pyx_freecount_11colibricore___pyx_scope_struct_77___iter__++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_77___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__ *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_77___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_77___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_77___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_77___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_77___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_77___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *__pyx_freelist_11colibricore___pyx_scope_struct_78_items[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_78_items = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_78_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_78_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_78_items)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_78_items[--__pyx_freecount_11colibricore___pyx_scope_struct_78_items];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_78_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_cvec)) PatternVector();
  new((void*)&(p->__pyx_v_it)) BasicPatternAlignmentModel::iterator();
  new((void*)&(p->__pyx_v_it_end)) BasicPatternAlignmentModel::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_78_items(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_cvec);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_pattern);
  Py_CLEAR(p->__pyx_v_pvec);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_78_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_78_items)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_78_items[__pyx_freecount_11colibricore___pyx_scope_struct_78_items++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_78_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_78_items *)o;
  if (p->__pyx_v_pattern) {
    e = (*v)(((PyObject *)p->__pyx_v_pattern), a); if (e) return e;
  }
  if (p->__pyx_v_pvec) {
    e = (*v)(((PyObject *)p->__pyx_v_pvec), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_78_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_78_items", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_78_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_78_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_78_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_78_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *__pyx_freelist_11colibricore___pyx_scope_struct_79_pairs[8];
static int __pyx_freecount_11colibricore___pyx_scope_struct_79_pairs = 0;

static PyObject *__pyx_tp_new_11colibricore___pyx_scope_struct_79_pairs(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_11colibricore___pyx_scope_struct_79_pairs > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs)))) {
    o = (PyObject*)__pyx_freelist_11colibricore___pyx_scope_struct_79_pairs[--__pyx_freecount_11colibricore___pyx_scope_struct_79_pairs];
    memset(o, 0, sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)o);
  new((void*)&(p->__pyx_v_cpattern)) Pattern();
  new((void*)&(p->__pyx_v_ctargetpattern)) Pattern();
  new((void*)&(p->__pyx_v_cvec)) PatternVector();
  new((void*)&(p->__pyx_v_it)) BasicPatternAlignmentModel::iterator();
  new((void*)&(p->__pyx_v_it2)) PatternVector::iterator();
  new((void*)&(p->__pyx_v_it2_end)) PatternVector::iterator();
  new((void*)&(p->__pyx_v_it_end)) BasicPatternAlignmentModel::iterator();
  return o;
}

static void __pyx_tp_dealloc_11colibricore___pyx_scope_struct_79_pairs(PyObject *o) {
  struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_cpattern);
  __Pyx_call_destructor(p->__pyx_v_ctargetpattern);
  __Pyx_call_destructor(p->__pyx_v_cvec);
  __Pyx_call_destructor(p->__pyx_v_it);
  __Pyx_call_destructor(p->__pyx_v_it2);
  __Pyx_call_destructor(p->__pyx_v_it2_end);
  __Pyx_call_destructor(p->__pyx_v_it_end);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_sourcepattern);
  Py_CLEAR(p->__pyx_v_targetpattern);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_11colibricore___pyx_scope_struct_79_pairs < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs)))) {
    __pyx_freelist_11colibricore___pyx_scope_struct_79_pairs[__pyx_freecount_11colibricore___pyx_scope_struct_79_pairs++] = ((struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_11colibricore___pyx_scope_struct_79_pairs(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *p = (struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_sourcepattern) {
    e = (*v)(((PyObject *)p->__pyx_v_sourcepattern), a); if (e) return e;
  }
  if (p->__pyx_v_targetpattern) {
    e = (*v)(((PyObject *)p->__pyx_v_targetpattern), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_11colibricore___pyx_scope_struct_79_pairs = {
  PyVarObject_HEAD_INIT(0, 0)
  "colibricore.__pyx_scope_struct_79_pairs", /*tp_name*/
  sizeof(struct __pyx_obj_11colibricore___pyx_scope_struct_79_pairs), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11colibricore___pyx_scope_struct_79_pairs, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_11colibricore___pyx_scope_struct_79_pairs, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11colibricore___pyx_scope_struct_79_pairs, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11colibricore_5write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11colibricore_4write},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_colibricore(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_colibricore},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "colibricore",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
  {&__pyx_n_s_AlignedPatternDict_int32, __pyx_k_AlignedPatternDict_int32, sizeof(__pyx_k_AlignedPatternDict_int32), 0, 0, 1, 1},
  {&__pyx_n_s_AlignedPatternDict_int32___iter, __pyx_k_AlignedPatternDict_int32___iter, sizeof(__pyx_k_AlignedPatternDict_int32___iter), 0, 0, 1, 1},
  {&__pyx_n_s_AlignedPatternDict_int32_childre, __pyx_k_AlignedPatternDict_int32_childre, sizeof(__pyx_k_AlignedPatternDict_int32_childre), 0, 0, 1, 1},
  {&__pyx_n_s_AlignedPatternDict_int32_items, __pyx_k_AlignedPatternDict_int32_items, sizeof(__pyx_k_AlignedPatternDict_int32_items), 0, 0, 1, 1},
  {&__pyx_kp_u_Argument_must_be_Pattern_instanc, __pyx_k_Argument_must_be_Pattern_instanc, sizeof(__pyx_k_Argument_must_be_Pattern_instanc), 0, 1, 0, 0},
  {&__pyx_n_s_BOUNDARYPATTERN, __pyx_k_BOUNDARYPATTERN, sizeof(__pyx_k_BOUNDARYPATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_BasicPatternAlignmentModel, __pyx_k_BasicPatternAlignmentModel, sizeof(__pyx_k_BasicPatternAlignmentModel), 0, 0, 1, 1},
  {&__pyx_n_s_BasicPatternAlignmentModel___ite, __pyx_k_BasicPatternAlignmentModel___ite, sizeof(__pyx_k_BasicPatternAlignmentModel___ite), 0, 0, 1, 1},
  {&__pyx_n_s_BasicPatternAlignmentModel_items, __pyx_k_BasicPatternAlignmentModel_items, sizeof(__pyx_k_BasicPatternAlignmentModel_items), 0, 0, 1, 1},
  {&__pyx_n_s_BasicPatternAlignmentModel_pairs, __pyx_k_BasicPatternAlignmentModel_pairs, sizeof(__pyx_k_BasicPatternAlignmentModel_pairs), 0, 0, 1, 1},
  {&__pyx_n_s_Category, __pyx_k_Category, sizeof(__pyx_k_Category), 0, 0, 1, 1},
  {&__pyx_n_s_ClassDecoder, __pyx_k_ClassDecoder, sizeof(__pyx_k_ClassDecoder), 0, 0, 1, 1},
  {&__pyx_n_s_ClassEncoder, __pyx_k_ClassEncoder, sizeof(__pyx_k_ClassEncoder), 0, 0, 1, 1},
  {&__pyx_n_s_Counter, __pyx_k_Counter, sizeof(__pyx_k_Counter), 0, 0, 1, 1},
  {&__pyx_n_u_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 1, 0, 1},
  {&__pyx_n_u_DOPATTERNPERLINE, __pyx_k_DOPATTERNPERLINE, sizeof(__pyx_k_DOPATTERNPERLINE), 0, 1, 0, 1},
  {&__pyx_n_u_DOREMOVEFLEXGRAMS, __pyx_k_DOREMOVEFLEXGRAMS, sizeof(__pyx_k_DOREMOVEFLEXGRAMS), 0, 1, 0, 1},
  {&__pyx_n_u_DOREMOVENGRAMS, __pyx_k_DOREMOVENGRAMS, sizeof(__pyx_k_DOREMOVENGRAMS), 0, 1, 0, 1},
  {&__pyx_n_u_DOREMOVESKIPGRAMS, __pyx_k_DOREMOVESKIPGRAMS, sizeof(__pyx_k_DOREMOVESKIPGRAMS), 0, 1, 0, 1},
  {&__pyx_n_u_DORESET, __pyx_k_DORESET, sizeof(__pyx_k_DORESET), 0, 1, 0, 1},
  {&__pyx_n_u_DOREVERSEINDEX, __pyx_k_DOREVERSEINDEX, sizeof(__pyx_k_DOREVERSEINDEX), 0, 1, 0, 1},
  {&__pyx_n_s_DOSKIPGRAMS, __pyx_k_DOSKIPGRAMS, sizeof(__pyx_k_DOSKIPGRAMS), 0, 0, 1, 1},
  {&__pyx_n_u_DOSKIPGRAMS, __pyx_k_DOSKIPGRAMS, sizeof(__pyx_k_DOSKIPGRAMS), 0, 1, 0, 1},
  {&__pyx_n_u_DOSKIPGRAMS_EXHAUSTIVE, __pyx_k_DOSKIPGRAMS_EXHAUSTIVE, sizeof(__pyx_k_DOSKIPGRAMS_EXHAUSTIVE), 0, 1, 0, 1},
  {&__pyx_kp_u_Expected_instance_of_Pattern, __pyx_k_Expected_instance_of_Pattern, sizeof(__pyx_k_Expected_instance_of_Pattern), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_instance_of_Pattern_or, __pyx_k_Expected_instance_of_Pattern_or, sizeof(__pyx_k_Expected_instance_of_Pattern_or), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_instance_of_Pattern_or_2, __pyx_k_Expected_instance_of_Pattern_or_2, sizeof(__pyx_k_Expected_instance_of_Pattern_or_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_list_with_instances_of, __pyx_k_Expected_list_with_instances_of, sizeof(__pyx_k_Expected_list_with_instances_of), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_tuple, __pyx_k_Expected_tuple, sizeof(__pyx_k_Expected_tuple), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_tuple_for_end_of_slice, __pyx_k_Expected_tuple_for_end_of_slice, sizeof(__pyx_k_Expected_tuple_for_end_of_slice), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_tuple_for_start_of_slic, __pyx_k_Expected_tuple_for_start_of_slic, sizeof(__pyx_k_Expected_tuple_for_start_of_slic), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_two_tuple_of_Patterns, __pyx_k_Expected_two_tuple_of_Patterns, sizeof(__pyx_k_Expected_two_tuple_of_Patterns), 0, 1, 0, 0},
  {&__pyx_n_s_FLEXGRAM, __pyx_k_FLEXGRAM, sizeof(__pyx_k_FLEXGRAM), 0, 0, 1, 1},
  {&__pyx_n_s_FLEXPATTERN, __pyx_k_FLEXPATTERN, sizeof(__pyx_k_FLEXPATTERN), 0, 0, 1, 1},
  {&__pyx_kp_u_File, __pyx_k_File, sizeof(__pyx_k_File), 0, 1, 0, 0},
  {&__pyx_n_s_FileNotFoundError, __pyx_k_FileNotFoundError, sizeof(__pyx_k_FileNotFoundError), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel, __pyx_k_HashOrderedIndexedPatternModel, sizeof(__pyx_k_HashOrderedIndexedPatternModel), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_2, __pyx_k_HashOrderedIndexedPatternModel_2, sizeof(__pyx_k_HashOrderedIndexedPatternModel_2), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_f, __pyx_k_HashOrderedIndexedPatternModel_f, sizeof(__pyx_k_HashOrderedIndexedPatternModel_f), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g, __pyx_k_HashOrderedIndexedPatternModel_g, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_10, __pyx_k_HashOrderedIndexedPatternModel_g_10, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_10), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_11, __pyx_k_HashOrderedIndexedPatternModel_g_11, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_11), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_12, __pyx_k_HashOrderedIndexedPatternModel_g_12, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_12), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_2, __pyx_k_HashOrderedIndexedPatternModel_g_2, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_2), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_3, __pyx_k_HashOrderedIndexedPatternModel_g_3, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_3), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_4, __pyx_k_HashOrderedIndexedPatternModel_g_4, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_4), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_5, __pyx_k_HashOrderedIndexedPatternModel_g_5, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_5), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_6, __pyx_k_HashOrderedIndexedPatternModel_g_6, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_6), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_7, __pyx_k_HashOrderedIndexedPatternModel_g_7, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_7), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_8, __pyx_k_HashOrderedIndexedPatternModel_g_8, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_8), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_g_9, __pyx_k_HashOrderedIndexedPatternModel_g_9, sizeof(__pyx_k_HashOrderedIndexedPatternModel_g_9), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_h, __pyx_k_HashOrderedIndexedPatternModel_h, sizeof(__pyx_k_HashOrderedIndexedPatternModel_h), 0, 0, 1, 1},
  {&__pyx_n_s_HashOrderedIndexedPatternModel_i, __pyx_k_HashOrderedIndexedPatternModel_i, sizeof(__pyx_k_HashOrderedIndexedPatternModel_i), 0, 0, 1, 1},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedCorpus, __pyx_k_IndexedCorpus, sizeof(__pyx_k_IndexedCorpus), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedCorpus___iter, __pyx_k_IndexedCorpus___iter, sizeof(__pyx_k_IndexedCorpus___iter), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedCorpus_findpattern, __pyx_k_IndexedCorpus_findpattern, sizeof(__pyx_k_IndexedCorpus_findpattern), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedCorpus_items, __pyx_k_IndexedCorpus_items, sizeof(__pyx_k_IndexedCorpus_items), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedCorpus_sentences, __pyx_k_IndexedCorpus_sentences, sizeof(__pyx_k_IndexedCorpus_sentences), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedData, __pyx_k_IndexedData, sizeof(__pyx_k_IndexedData), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedData___iter, __pyx_k_IndexedData___iter, sizeof(__pyx_k_IndexedData___iter), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel, __pyx_k_IndexedPatternModel, sizeof(__pyx_k_IndexedPatternModel), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel___iter, __pyx_k_IndexedPatternModel___iter, sizeof(__pyx_k_IndexedPatternModel___iter), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_filter, __pyx_k_IndexedPatternModel_filter, sizeof(__pyx_k_IndexedPatternModel_filter), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getcooc, __pyx_k_IndexedPatternModel_getcooc, sizeof(__pyx_k_IndexedPatternModel_getcooc), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getinstances, __pyx_k_IndexedPatternModel_getinstances, sizeof(__pyx_k_IndexedPatternModel_getinstances), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getleftcooc, __pyx_k_IndexedPatternModel_getleftcooc, sizeof(__pyx_k_IndexedPatternModel_getleftcooc), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getleftneigh, __pyx_k_IndexedPatternModel_getleftneigh, sizeof(__pyx_k_IndexedPatternModel_getleftneigh), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getreversein, __pyx_k_IndexedPatternModel_getreversein, sizeof(__pyx_k_IndexedPatternModel_getreversein), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getreversein_2, __pyx_k_IndexedPatternModel_getreversein_2, sizeof(__pyx_k_IndexedPatternModel_getreversein_2), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getrightcooc, __pyx_k_IndexedPatternModel_getrightcooc, sizeof(__pyx_k_IndexedPatternModel_getrightcooc), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getrightneig, __pyx_k_IndexedPatternModel_getrightneig, sizeof(__pyx_k_IndexedPatternModel_getrightneig), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getskipconte, __pyx_k_IndexedPatternModel_getskipconte, sizeof(__pyx_k_IndexedPatternModel_getskipconte), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getsubchildr, __pyx_k_IndexedPatternModel_getsubchildr, sizeof(__pyx_k_IndexedPatternModel_getsubchildr), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_getsubparent, __pyx_k_IndexedPatternModel_getsubparent, sizeof(__pyx_k_IndexedPatternModel_getsubparent), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_gettemplates, __pyx_k_IndexedPatternModel_gettemplates, sizeof(__pyx_k_IndexedPatternModel_gettemplates), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_histogram, __pyx_k_IndexedPatternModel_histogram, sizeof(__pyx_k_IndexedPatternModel_histogram), 0, 0, 1, 1},
  {&__pyx_n_s_IndexedPatternModel_items, __pyx_k_IndexedPatternModel_items, sizeof(__pyx_k_IndexedPatternModel_items), 0, 0, 1, 1},
  {&__pyx_kp_u_Invalid_type_for_constrainmodel, __pyx_k_Invalid_type_for_constrainmodel, sizeof(__pyx_k_Invalid_type_for_constrainmodel), 0, 1, 0, 0},
  {&__pyx_kp_u_Item_should_be_a_2_tuple_sentenc, __pyx_k_Item_should_be_a_2_tuple_sentenc, sizeof(__pyx_k_Item_should_be_a_2_tuple_sentenc), 0, 1, 0, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_kp_u_Key_must_be_Pattern_instance, __pyx_k_Key_must_be_Pattern_instance, sizeof(__pyx_k_Key_must_be_Pattern_instance), 0, 1, 0, 0},
  {&__pyx_n_u_MAXLENGTH, __pyx_k_MAXLENGTH, sizeof(__pyx_k_MAXLENGTH), 0, 1, 0, 1},
  {&__pyx_n_u_MAXSKIPS, __pyx_k_MAXSKIPS, sizeof(__pyx_k_MAXSKIPS), 0, 1, 0, 1},
  {&__pyx_n_u_MINLENGTH, __pyx_k_MINLENGTH, sizeof(__pyx_k_MINLENGTH), 0, 1, 0, 1},
  {&__pyx_n_u_MINSKIPTYPES, __pyx_k_MINSKIPTYPES, sizeof(__pyx_k_MINSKIPTYPES), 0, 1, 0, 1},
  {&__pyx_n_u_MINTOKENS, __pyx_k_MINTOKENS, sizeof(__pyx_k_MINTOKENS), 0, 1, 0, 1},
  {&__pyx_n_u_MINTOKENS_SKIPGRAMS, __pyx_k_MINTOKENS_SKIPGRAMS, sizeof(__pyx_k_MINTOKENS_SKIPGRAMS), 0, 1, 0, 1},
  {&__pyx_n_u_MINTOKENS_UNIGRAMS, __pyx_k_MINTOKENS_UNIGRAMS, sizeof(__pyx_k_MINTOKENS_UNIGRAMS), 0, 1, 0, 1},
  {&__pyx_n_s_NGRAM, __pyx_k_NGRAM, sizeof(__pyx_k_NGRAM), 0, 0, 1, 1},
  {&__pyx_kp_u_No_filename_or_reverseindex_spec, __pyx_k_No_filename_or_reverseindex_spec, sizeof(__pyx_k_No_filename_or_reverseindex_spec), 0, 1, 0, 0},
  {&__pyx_kp_u_No_reverse_index_loaded, __pyx_k_No_reverse_index_loaded, sizeof(__pyx_k_No_reverse_index_loaded), 0, 1, 0, 0},
  {&__pyx_kp_u_No_reverseindex_was_specified_bu, __pyx_k_No_reverseindex_was_specified_bu, sizeof(__pyx_k_No_reverseindex_was_specified_bu), 0, 1, 0, 0},
  {&__pyx_kp_u_No_reversindex_was_specified_but, __pyx_k_No_reversindex_was_specified_but, sizeof(__pyx_k_No_reversindex_was_specified_but), 0, 1, 0, 0},
  {&__pyx_kp_u_No_such_file, __pyx_k_No_such_file, sizeof(__pyx_k_No_such_file), 0, 1, 0, 0},
  {&__pyx_n_s_OrderedUnindexedPatternModel, __pyx_k_OrderedUnindexedPatternModel, sizeof(__pyx_k_OrderedUnindexedPatternModel), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel___i, __pyx_k_OrderedUnindexedPatternModel___i, sizeof(__pyx_k_OrderedUnindexedPatternModel___i), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel_fil, __pyx_k_OrderedUnindexedPatternModel_fil, sizeof(__pyx_k_OrderedUnindexedPatternModel_fil), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel_get, __pyx_k_OrderedUnindexedPatternModel_get, sizeof(__pyx_k_OrderedUnindexedPatternModel_get), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel_get_2, __pyx_k_OrderedUnindexedPatternModel_get_2, sizeof(__pyx_k_OrderedUnindexedPatternModel_get_2), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel_his, __pyx_k_OrderedUnindexedPatternModel_his, sizeof(__pyx_k_OrderedUnindexedPatternModel_his), 0, 0, 1, 1},
  {&__pyx_n_s_OrderedUnindexedPatternModel_ite, __pyx_k_OrderedUnindexedPatternModel_ite, sizeof(__pyx_k_OrderedUnindexedPatternModel_ite), 0, 0, 1, 1},
  {&__pyx_n_u_PRUNENONSUBSUMED, __pyx_k_PRUNENONSUBSUMED, sizeof(__pyx_k_PRUNENONSUBSUMED), 0, 1, 0, 1},
  {&__pyx_n_u_PRUNESUBSUMED, __pyx_k_PRUNESUBSUMED, sizeof(__pyx_k_PRUNESUBSUMED), 0, 1, 0, 1},
  {&__pyx_n_s_Pattern, __pyx_k_Pattern, sizeof(__pyx_k_Pattern), 0, 0, 1, 1},
  {&__pyx_n_s_PatternAlignmentModel_float, __pyx_k_PatternAlignmentModel_float, sizeof(__pyx_k_PatternAlignmentModel_float), 0, 0, 1, 1},
  {&__pyx_n_s_PatternAlignmentModel_float___it, __pyx_k_PatternAlignmentModel_float___it, sizeof(__pyx_k_PatternAlignmentModel_float___it), 0, 0, 1, 1},
  {&__pyx_n_s_PatternAlignmentModel_float_item, __pyx_k_PatternAlignmentModel_float_item, sizeof(__pyx_k_PatternAlignmentModel_float_item), 0, 0, 1, 1},
  {&__pyx_n_s_PatternAlignmentModel_float_trip, __pyx_k_PatternAlignmentModel_float_trip, sizeof(__pyx_k_PatternAlignmentModel_float_trip), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_float, __pyx_k_PatternDict_float, sizeof(__pyx_k_PatternDict_float), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_float___iter, __pyx_k_PatternDict_float___iter, sizeof(__pyx_k_PatternDict_float___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_float_items, __pyx_k_PatternDict_float_items, sizeof(__pyx_k_PatternDict_float_items), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int, __pyx_k_PatternDict_int, sizeof(__pyx_k_PatternDict_int), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int32, __pyx_k_PatternDict_int32, sizeof(__pyx_k_PatternDict_int32), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int32___iter, __pyx_k_PatternDict_int32___iter, sizeof(__pyx_k_PatternDict_int32___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int32_items, __pyx_k_PatternDict_int32_items, sizeof(__pyx_k_PatternDict_int32_items), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int___iter, __pyx_k_PatternDict_int___iter, sizeof(__pyx_k_PatternDict_int___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PatternDict_int_items, __pyx_k_PatternDict_int_items, sizeof(__pyx_k_PatternDict_int_items), 0, 0, 1, 1},
  {&__pyx_n_s_PatternFeatureVectorMap_float, __pyx_k_PatternFeatureVectorMap_float, sizeof(__pyx_k_PatternFeatureVectorMap_float), 0, 0, 1, 1},
  {&__pyx_n_s_PatternFeatureVectorMap_float_2, __pyx_k_PatternFeatureVectorMap_float_2, sizeof(__pyx_k_PatternFeatureVectorMap_float_2), 0, 0, 1, 1},
  {&__pyx_n_s_PatternFeatureVectorMap_float_it, __pyx_k_PatternFeatureVectorMap_float_it, sizeof(__pyx_k_PatternFeatureVectorMap_float_it), 0, 0, 1, 1},
  {&__pyx_n_s_PatternModelOptions, __pyx_k_PatternModelOptions, sizeof(__pyx_k_PatternModelOptions), 0, 0, 1, 1},
  {&__pyx_n_s_PatternSet, __pyx_k_PatternSet, sizeof(__pyx_k_PatternSet), 0, 0, 1, 1},
  {&__pyx_n_s_PatternSetModel, __pyx_k_PatternSetModel, sizeof(__pyx_k_PatternSetModel), 0, 0, 1, 1},
  {&__pyx_n_s_PatternSetModel___iter, __pyx_k_PatternSetModel___iter, sizeof(__pyx_k_PatternSetModel___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PatternSet___iter, __pyx_k_PatternSet___iter, sizeof(__pyx_k_PatternSet___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PatternVector, __pyx_k_PatternVector, sizeof(__pyx_k_PatternVector), 0, 0, 1, 1},
  {&__pyx_n_s_PatternVector___iter, __pyx_k_PatternVector___iter, sizeof(__pyx_k_PatternVector___iter), 0, 0, 1, 1},
  {&__pyx_kp_s_Pattern_Category, __pyx_k_Pattern_Category, sizeof(__pyx_k_Pattern_Category), 0, 0, 1, 0},
  {&__pyx_n_s_Pattern___iter, __pyx_k_Pattern___iter, sizeof(__pyx_k_Pattern___iter), 0, 0, 1, 1},
  {&__pyx_n_s_Pattern__ngrams_aux, __pyx_k_Pattern__ngrams_aux, sizeof(__pyx_k_Pattern__ngrams_aux), 0, 0, 1, 1},
  {&__pyx_n_s_Pattern_gaps, __pyx_k_Pattern_gaps, sizeof(__pyx_k_Pattern_gaps), 0, 0, 1, 1},
  {&__pyx_n_s_Pattern_parts, __pyx_k_Pattern_parts, sizeof(__pyx_k_Pattern_parts), 0, 0, 1, 1},
  {&__pyx_n_s_Pattern_subngrams, __pyx_k_Pattern_subngrams, sizeof(__pyx_k_Pattern_subngrams), 0, 0, 1, 1},
  {&__pyx_n_u_QUIET, __pyx_k_QUIET, sizeof(__pyx_k_QUIET), 0, 1, 0, 1},
  {&__pyx_n_s_SKIPGRAM, __pyx_k_SKIPGRAM, sizeof(__pyx_k_SKIPGRAM), 0, 0, 1, 1},
  {&__pyx_n_s_SKIPPATTERN, __pyx_k_SKIPPATTERN, sizeof(__pyx_k_SKIPPATTERN), 0, 0, 1, 1},
  {&__pyx_kp_u_Slices_only_supported_within_the, __pyx_k_Slices_only_supported_within_the, sizeof(__pyx_k_Slices_only_supported_within_the), 0, 1, 0, 0},
  {&__pyx_n_s_SmallPatternDict_int32, __pyx_k_SmallPatternDict_int32, sizeof(__pyx_k_SmallPatternDict_int32), 0, 0, 1, 1},
  {&__pyx_n_s_SmallPatternDict_int32___iter, __pyx_k_SmallPatternDict_int32___iter, sizeof(__pyx_k_SmallPatternDict_int32___iter), 0, 0, 1, 1},
  {&__pyx_n_s_SmallPatternDict_int32_items, __pyx_k_SmallPatternDict_int32_items, sizeof(__pyx_k_SmallPatternDict_int32_items), 0, 0, 1, 1},
  {&__pyx_n_s_TinyPatternDict_int32, __pyx_k_TinyPatternDict_int32, sizeof(__pyx_k_TinyPatternDict_int32), 0, 0, 1, 1},
  {&__pyx_n_s_TinyPatternDict_int32___iter, __pyx_k_TinyPatternDict_int32___iter, sizeof(__pyx_k_TinyPatternDict_int32___iter), 0, 0, 1, 1},
  {&__pyx_n_s_TinyPatternDict_int32_items, __pyx_k_TinyPatternDict_int32_items, sizeof(__pyx_k_TinyPatternDict_int32_items), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UNKPATTERN, __pyx_k_UNKPATTERN, sizeof(__pyx_k_UNKPATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel, __pyx_k_UnindexedPatternModel, sizeof(__pyx_k_UnindexedPatternModel), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel___iter, __pyx_k_UnindexedPatternModel___iter, sizeof(__pyx_k_UnindexedPatternModel___iter), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel_filter, __pyx_k_UnindexedPatternModel_filter, sizeof(__pyx_k_UnindexedPatternModel_filter), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel_getreverse, __pyx_k_UnindexedPatternModel_getreverse, sizeof(__pyx_k_UnindexedPatternModel_getreverse), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel_getreverse_2, __pyx_k_UnindexedPatternModel_getreverse_2, sizeof(__pyx_k_UnindexedPatternModel_getreverse_2), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel_histogram, __pyx_k_UnindexedPatternModel_histogram, sizeof(__pyx_k_UnindexedPatternModel_histogram), 0, 0, 1, 1},
  {&__pyx_n_s_UnindexedPatternModel_items, __pyx_k_UnindexedPatternModel_items, sizeof(__pyx_k_UnindexedPatternModel_items), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_u_Value_must_be_tuple_containing_f, __pyx_k_Value_must_be_tuple_containing_f, sizeof(__pyx_k_Value_must_be_tuple_containing_f), 0, 1, 0, 0},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_addunknown, __pyx_k_addunknown, sizeof(__pyx_k_addunknown), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_allowunknown, __pyx_k_allowunknown, sizeof(__pyx_k_allowunknown), 0, 0, 1, 1},
  {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_autoaddunknown, __pyx_k_autoaddunknown, sizeof(__pyx_k_autoaddunknown), 0, 0, 1, 1},
  {&__pyx_n_s_bindboundary, __pyx_k_bindboundary, sizeof(__pyx_k_bindboundary), 0, 0, 1, 1},
  {&__pyx_n_s_bindflex, __pyx_k_bindflex, sizeof(__pyx_k_bindflex), 0, 0, 1, 1},
  {&__pyx_n_s_bindskip, __pyx_k_bindskip, sizeof(__pyx_k_bindskip), 0, 0, 1, 1},
  {&__pyx_n_s_bindunk, __pyx_k_bindunk, sizeof(__pyx_k_bindunk), 0, 0, 1, 1},
  {&__pyx_n_s_bytesize, __pyx_k_bytesize, sizeof(__pyx_k_bytesize), 0, 0, 1, 1},
  {&__pyx_n_s_cap, __pyx_k_cap, sizeof(__pyx_k_cap), 0, 0, 1, 1},
  {&__pyx_n_s_category, __pyx_k_category, sizeof(__pyx_k_category), 0, 0, 1, 1},
  {&__pyx_n_s_children, __pyx_k_children, sizeof(__pyx_k_children), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_colibricore, __pyx_k_colibricore, sizeof(__pyx_k_colibricore), 0, 0, 1, 1},
  {&__pyx_kp_s_colibricore_wrapper_pyx, __pyx_k_colibricore_wrapper_pyx, sizeof(__pyx_k_colibricore_wrapper_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1},
  {&__pyx_n_s_constrainmodel, __pyx_k_constrainmodel, sizeof(__pyx_k_constrainmodel), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_cpattern, __pyx_k_cpattern, sizeof(__pyx_k_cpattern), 0, 0, 1, 1},
  {&__pyx_n_s_cutoff, __pyx_k_cutoff, sizeof(__pyx_k_cutoff), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_decoder, __pyx_k_decoder, sizeof(__pyx_k_decoder), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_kp_u_does_not_exist, __pyx_k_does_not_exist, sizeof(__pyx_k_does_not_exist), 0, 1, 0, 0},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
  {&__pyx_n_s_features, __pyx_k_features, sizeof(__pyx_k_features), 0, 0, 1, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
  {&__pyx_n_s_filterset, __pyx_k_filterset, sizeof(__pyx_k_filterset), 0, 0, 1, 1},
  {&__pyx_n_s_findpattern, __pyx_k_findpattern, sizeof(__pyx_k_findpattern), 0, 0, 1, 1},
  {&__pyx_n_s_gaps, __pyx_k_gaps, sizeof(__pyx_k_gaps), 0, 0, 1, 1},
  {&__pyx_n_s_getcooc, __pyx_k_getcooc, sizeof(__pyx_k_getcooc), 0, 0, 1, 1},
  {&__pyx_n_s_getdata, __pyx_k_getdata, sizeof(__pyx_k_getdata), 0, 0, 1, 1},
  {&__pyx_n_s_getdatatuple, __pyx_k_getdatatuple, sizeof(__pyx_k_getdatatuple), 0, 0, 1, 1},
  {&__pyx_n_s_getinstance, __pyx_k_getinstance, sizeof(__pyx_k_getinstance), 0, 0, 1, 1},
  {&__pyx_n_s_getinstances, __pyx_k_getinstances, sizeof(__pyx_k_getinstances), 0, 0, 1, 1},
  {&__pyx_n_s_getleftcooc, __pyx_k_getleftcooc, sizeof(__pyx_k_getleftcooc), 0, 0, 1, 1},
  {&__pyx_n_s_getleftneighbours, __pyx_k_getleftneighbours, sizeof(__pyx_k_getleftneighbours), 0, 0, 1, 1},
  {&__pyx_n_s_getpair, __pyx_k_getpair, sizeof(__pyx_k_getpair), 0, 0, 1, 1},
  {&__pyx_n_s_getreverseindex, __pyx_k_getreverseindex, sizeof(__pyx_k_getreverseindex), 0, 0, 1, 1},
  {&__pyx_n_s_getreverseindex_bysentence, __pyx_k_getreverseindex_bysentence, sizeof(__pyx_k_getreverseindex_bysentence), 0, 0, 1, 1},
  {&__pyx_n_s_getrightcooc, __pyx_k_getrightcooc, sizeof(__pyx_k_getrightcooc), 0, 0, 1, 1},
  {&__pyx_n_s_getrightneighbours, __pyx_k_getrightneighbours, sizeof(__pyx_k_getrightneighbours), 0, 0, 1, 1},
  {&__pyx_n_s_getsentence, __pyx_k_getsentence, sizeof(__pyx_k_getsentence), 0, 0, 1, 1},
  {&__pyx_n_s_getskipcontent, __pyx_k_getskipcontent, sizeof(__pyx_k_getskipcontent), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_getsubchildren, __pyx_k_getsubchildren, sizeof(__pyx_k_getsubchildren), 0, 0, 1, 1},
  {&__pyx_n_s_getsubparents, __pyx_k_getsubparents, sizeof(__pyx_k_getsubparents), 0, 0, 1, 1},
  {&__pyx_n_s_gettemplates, __pyx_k_gettemplates, sizeof(__pyx_k_gettemplates), 0, 0, 1, 1},
  {&__pyx_n_s_has, __pyx_k_has, sizeof(__pyx_k_has), 0, 0, 1, 1},
  {&__pyx_n_s_haspair, __pyx_k_haspair, sizeof(__pyx_k_haspair), 0, 0, 1, 1},
  {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1},
  {&__pyx_n_s_ignorenewlines, __pyx_k_ignorenewlines, sizeof(__pyx_k_ignorenewlines), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_instantiate, __pyx_k_instantiate, sizeof(__pyx_k_instantiate), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
  {&__pyx_n_s_loadconstrainedbyindexedmodel, __pyx_k_loadconstrainedbyindexedmodel, sizeof(__pyx_k_loadconstrainedbyindexedmodel), 0, 0, 1, 1},
  {&__pyx_n_s_loadconstrainedbysetmodel, __pyx_k_loadconstrainedbysetmodel, sizeof(__pyx_k_loadconstrainedbysetmodel), 0, 0, 1, 1},
  {&__pyx_n_s_loadconstrainedbyunindexedmodel, __pyx_k_loadconstrainedbyunindexedmodel, sizeof(__pyx_k_loadconstrainedbyunindexedmodel), 0, 0, 1, 1},
  {&__pyx_n_s_loadreverseindex, __pyx_k_loadreverseindex, sizeof(__pyx_k_loadreverseindex), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_maxlength, __pyx_k_maxlength, sizeof(__pyx_k_maxlength), 0, 0, 1, 1},
  {&__pyx_n_s_maxn, __pyx_k_maxn, sizeof(__pyx_k_maxn), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_minlength, __pyx_k_minlength, sizeof(__pyx_k_minlength), 0, 0, 1, 1},
  {&__pyx_n_s_minn, __pyx_k_minn, sizeof(__pyx_k_minn), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_ngrams, __pyx_k_ngrams, sizeof(__pyx_k_ngrams), 0, 0, 1, 1},
  {&__pyx_n_s_ngrams_aux, __pyx_k_ngrams_aux, sizeof(__pyx_k_ngrams_aux), 0, 0, 1, 1},
  {&__pyx_n_s_occurrencethreshold, __pyx_k_occurrencethreshold, sizeof(__pyx_k_occurrencethreshold), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
  {&__pyx_n_s_outputrelations, __pyx_k_outputrelations, sizeof(__pyx_k_outputrelations), 0, 0, 1, 1},
  {&__pyx_n_s_pairs, __pyx_k_pairs, sizeof(__pyx_k_pairs), 0, 0, 1, 1},
  {&__pyx_n_s_parts, __pyx_k_parts, sizeof(__pyx_k_parts), 0, 0, 1, 1},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_pattern, __pyx_k_pattern, sizeof(__pyx_k_pattern), 0, 0, 1, 1},
  {&__pyx_n_s_pattern2, __pyx_k_pattern2, sizeof(__pyx_k_pattern2), 0, 0, 1, 1},
  {&__pyx_n_s_patternfromfile, __pyx_k_patternfromfile, sizeof(__pyx_k_patternfromfile), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_printhistogram, __pyx_k_printhistogram, sizeof(__pyx_k_printhistogram), 0, 0, 1, 1},
  {&__pyx_n_s_printmodel, __pyx_k_printmodel, sizeof(__pyx_k_printmodel), 0, 0, 1, 1},
  {&__pyx_n_s_prune, __pyx_k_prune, sizeof(__pyx_k_prune), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_report, __pyx_k_report, sizeof(__pyx_k_report), 0, 0, 1, 1},
  {&__pyx_n_s_reverseindex, __pyx_k_reverseindex, sizeof(__pyx_k_reverseindex), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_kp_s_self_coptions_cannot_be_converte, __pyx_k_self_coptions_cannot_be_converte, sizeof(__pyx_k_self_coptions_cannot_be_converte), 0, 0, 1, 0},
  {&__pyx_kp_s_self_cpattern_cannot_be_converte, __pyx_k_self_cpattern_cannot_be_converte, sizeof(__pyx_k_self_cpattern_cannot_be_converte), 0, 0, 1, 0},
  {&__pyx_kp_s_self_data_cannot_be_converted_to, __pyx_k_self_data_cannot_be_converted_to, sizeof(__pyx_k_self_data_cannot_be_converted_to), 0, 0, 1, 0},
  {&__pyx_kp_s_self_data_self_it_cannot_be_conv, __pyx_k_self_data_self_it_cannot_be_conv, sizeof(__pyx_k_self_data_self_it_cannot_be_conv), 0, 0, 1, 0},
  {&__pyx_kp_s_self_data_self_it_self_it_end_ca, __pyx_k_self_data_self_it_self_it_end_ca, sizeof(__pyx_k_self_data_self_it_self_it_end_ca), 0, 0, 1, 0},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_sentence, __pyx_k_sentence, sizeof(__pyx_k_sentence), 0, 0, 1, 1},
  {&__pyx_n_s_sentences, __pyx_k_sentences, sizeof(__pyx_k_sentences), 0, 0, 1, 1},
  {&__pyx_n_s_setdata, __pyx_k_setdata, sizeof(__pyx_k_setdata), 0, 0, 1, 1},
  {&__pyx_n_s_setpair, __pyx_k_setpair, sizeof(__pyx_k_setpair), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_sourcefile, __pyx_k_sourcefile, sizeof(__pyx_k_sourcefile), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_subngrams, __pyx_k_subngrams, sizeof(__pyx_k_subngrams), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_targetfile, __pyx_k_targetfile, sizeof(__pyx_k_targetfile), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_train, __pyx_k_train, sizeof(__pyx_k_train), 0, 0, 1, 1},
  {&__pyx_n_s_train_filtered, __pyx_k_train_filtered, sizeof(__pyx_k_train_filtered), 0, 0, 1, 1},
  {&__pyx_n_s_trainconstrainedbyalignmodel, __pyx_k_trainconstrainedbyalignmodel, sizeof(__pyx_k_trainconstrainedbyalignmodel), 0, 0, 1, 1},
  {&__pyx_n_s_trainconstrainedbyindexedmodel, __pyx_k_trainconstrainedbyindexedmodel, sizeof(__pyx_k_trainconstrainedbyindexedmodel), 0, 0, 1, 1},
  {&__pyx_n_s_trainconstrainedbypatternsetmode, __pyx_k_trainconstrainedbypatternsetmode, sizeof(__pyx_k_trainconstrainedbypatternsetmode), 0, 0, 1, 1},
  {&__pyx_n_s_trainconstrainedbyunindexedmodel, __pyx_k_trainconstrainedbyunindexedmodel, sizeof(__pyx_k_trainconstrainedbyunindexedmodel), 0, 0, 1, 1},
  {&__pyx_n_s_triples, __pyx_k_triples, sizeof(__pyx_k_triples), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 301, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 482, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(1, 625, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(1, 1592, __pyx_L1_error)
  __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(1, 4215, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_self_cpattern_cannot_be_converte); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "(tree fragment)":4
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.cpattern cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_self_cpattern_cannot_be_converte); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "colibricore_wrapper.pyx":482
 *         """Tests if the specified (sentence,token) tuple is in the set"""
 *         if not isinstance(item, tuple) or len(item) != 2:
 *             raise ValueError("Item should be a 2-tuple (sentence,token)")             # <<<<<<<<<<<<<<
 *         cdef cIndexReference ref = cIndexReference(item[0], item[1])
 *         return self.data.has(ref)
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Item_should_be_a_2_tuple_sentenc); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "colibricore_wrapper.pyx":522
 *     cpdef has(self, Pattern pattern):
 *         if not isinstance(pattern, Pattern):
 *             raise ValueError("Expected instance of Pattern")             # <<<<<<<<<<<<<<
 *         return self.data.has(pattern.cpattern)
 * 
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Expected_instance_of_Pattern); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "colibricore_wrapper.pyx":992
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or two-tuple of Patterns")
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Expected_instance_of_Pattern_or); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "colibricore_wrapper.pyx":1097
 *         if isinstance(item, tuple):
 *             if len(item) != 2:
 *                 raise ValueError("Expected two-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             elif not isinstance(item[0], Pattern) or not isinstance(item[1], Pattern):
 *                 raise ValueError("Expected two-tuple of Patterns")
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_Expected_two_tuple_of_Patterns); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "colibricore_wrapper.pyx":1394
 *             filename = ""
 *         if isinstance(self, IndexedPatternModel) and self.data.reverseindex == NULL and options.DOSKIPGRAMS:
 *             raise ValueError("No reversindex was specified but you are requesting to train skipgrams, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_u_No_reversindex_was_specified_but); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 1394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "colibricore_wrapper.pyx":1408
 *                 self.trainconstrainedbyalignmodel(filename, options, constrainmodel)
 *             else:
 *                 raise ValueError("Invalid type for constrainmodel") #TODO: build patternmodel on the fly from an iterable of patterns or lower level patternstorage             # <<<<<<<<<<<<<<
 *         elif filename:
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_Invalid_type_for_constrainmodel); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 1408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "colibricore_wrapper.pyx":1412
 *             self.data.train(<string> encode(filename),options.coptions, NULL, NULL)
 *         elif self.data.reverseindex == NULL:
 *             raise ValueError("No filename or reverseindex specified!")             # <<<<<<<<<<<<<<
 *         else:
 *             self.data.train(<istream*> NULL ,options.coptions, NULL, NULL)
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_No_filename_or_reverseindex_spec); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 1412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "colibricore_wrapper.pyx":1503
 * 
 *         if not isinstance(indexreference, tuple) or not len(indexreference) == 2:
 *             raise ValueError("Expected tuple")             # <<<<<<<<<<<<<<
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_Expected_tuple); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "colibricore_wrapper.pyx":1505
 *             raise ValueError("Expected tuple")
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverse index loaded")             # <<<<<<<<<<<<<<
 * 
 *         cdef int sentence = indexreference[0]
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_No_reverse_index_loaded); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 1505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "colibricore_wrapper.pyx":1695
 *         """
 *         if self.data.reverseindex == NULL:
 *             raise ValueError("No reverseindex was specified but this method requires it, set reverseindex to an IndexedCorpus instance upon model construction")             # <<<<<<<<<<<<<<
 * 
 *         cdef t_relationmap  relations = self.data.getsubchildren(pattern.cpattern, occurrencethreshold, category, size)
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_No_reverseindex_was_specified_bu); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 1695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_self_coptions_cannot_be_converte); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "(tree fragment)":4
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.coptions cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_self_coptions_cannot_be_converte); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "colibricore_wrapper.pyx":4060
 *             stop = item.stop
 *             if not isinstance(start, tuple):
 *                 raise ValueError("Expected tuple for start of slice")             # <<<<<<<<<<<<<<
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_u_Expected_tuple_for_start_of_slic); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 4060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "colibricore_wrapper.pyx":4062
 *                 raise ValueError("Expected tuple for start of slice")
 *             if not isinstance(stop, tuple):
 *                 raise ValueError("Expected tuple for end of slice")             # <<<<<<<<<<<<<<
 *             if start[0] != stop[0]:
 *                 raise ValueError("Slices only supported within the same sentence")
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_u_Expected_tuple_for_end_of_slice); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 4062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "colibricore_wrapper.pyx":4064
 *                 raise ValueError("Expected tuple for end of slice")
 *             if start[0] != stop[0]:
 *                 raise ValueError("Slices only supported within the same sentence")             # <<<<<<<<<<<<<<
 *             return self.getslice(start, stop)
 *         else:
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_u_Slices_only_supported_within_the); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 4064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "(tree fragment)":4
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_self_data_cannot_be_converted_to); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "colibricore_wrapper.pyx":4200
 *     def __getitem__(self, pattern):
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Argument must be Pattern instance")             # <<<<<<<<<<<<<<
 *         return self.getdata(pattern)
 * 
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_u_Argument_must_be_Pattern_instanc); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 4200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "colibricore_wrapper.pyx":4214
 *     def __setitem__(self, pattern, value):
 *         if not isinstance(pattern,Pattern):
 *             raise ValueError("Key must be Pattern instance")             # <<<<<<<<<<<<<<
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 *             raise ValueError("Value must be tuple containing floats")
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_u_Key_must_be_Pattern_instance); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 4214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "colibricore_wrapper.pyx":4216
 *             raise ValueError("Key must be Pattern instance")
 *         if not isinstance(value,tuple) or all([ isinstance(x,float) or isinstance(x,int) for x in value]):
 *             raise ValueError("Value must be tuple containing floats")             # <<<<<<<<<<<<<<
 *         self.setdata(pattern, value)
 * 
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_u_Value_must_be_tuple_containing_f); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 4216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "colibricore_wrapper.pyx":4304
 *         if isinstance(pattern, tuple):
 *             if len(pattern) != 2 or not isinstance(pattern[0], Pattern) or not isinstance(pattern[1], Pattern):
 *                 raise ValueError("Expected instance of Pattern or 2-tuple of Patterns")             # <<<<<<<<<<<<<<
 *             return self.hastuple(pattern[0], pattern[1])
 * 
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_u_Expected_instance_of_Pattern_or_2); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 4304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "colibricore_wrapper.pyx":4467
 *         for e in l:
 *             if not isinstance(e, float) and not isinstance(e, int):
 *                 raise ValueError("Expected list with instances of float")             # <<<<<<<<<<<<<<
 *             v.push_back(e)
 * 
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_u_Expected_list_with_instances_of); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 4467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_cannot_be_conv); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "(tree fragment)":4
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.data,self.it,self.it_end cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_kp_s_self_data_self_it_self_it_end_ca); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "colibricore_wrapper.pyx":30
 * 
 * 
 * def encode(s):             # <<<<<<<<<<<<<<
 *     return s.encode('utf-8')
 * 
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_colibricore_wrapper_pyx, __pyx_n_s_encode, 30, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(1, 30, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":157
 *         return self._filename
 * 
 * def patternfromfile(str filename):             # <<<<<<<<<<<<<<
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 */
  __pyx_tuple__66 = PyTuple_Pack(3, __pyx_n_s_filename, __pyx_n_s_cpattern, __pyx_n_s_pattern); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(1, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_colibricore_wrapper_pyx, __pyx_n_s_patternfromfile, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(1, 157, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_11colibricore_ClassEncoder) < 0) __PYX_ERR(1, 40, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_ClassEncoder.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_ClassEncoder.tp_dictoffset && __pyx_type_11colibricore_ClassEncoder.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_ClassEncoder.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_ClassEncoder, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 40, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_12ClassEncoder_4__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_12ClassEncoder_4__len__.doc = __pyx_doc_11colibricore_12ClassEncoder_4__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_12ClassEncoder_4__len__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClassEncoder, (PyObject *)&__pyx_type_11colibricore_ClassEncoder) < 0) __PYX_ERR(1, 40, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_ClassEncoder) < 0) __PYX_ERR(1, 40, __pyx_L1_error)
  __pyx_ptype_11colibricore_ClassEncoder = &__pyx_type_11colibricore_ClassEncoder;
  if (PyType_Ready(&__pyx_type_11colibricore_ClassDecoder) < 0) __PYX_ERR(1, 127, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_ClassDecoder.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_ClassDecoder.tp_dictoffset && __pyx_type_11colibricore_ClassDecoder.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_ClassDecoder.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_ClassDecoder, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 127, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_12ClassDecoder_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_12ClassDecoder_2__len__.doc = __pyx_doc_11colibricore_12ClassDecoder_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_12ClassDecoder_2__len__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClassDecoder, (PyObject *)&__pyx_type_11colibricore_ClassDecoder) < 0) __PYX_ERR(1, 127, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_ClassDecoder) < 0) __PYX_ERR(1, 127, __pyx_L1_error)
  __pyx_ptype_11colibricore_ClassDecoder = &__pyx_type_11colibricore_ClassDecoder;
  __pyx_vtabptr_11colibricore_Pattern = &__pyx_vtable_11colibricore_Pattern;
  __pyx_vtable_11colibricore_Pattern.getcpattern = (Pattern (*)(struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_7Pattern_getcpattern;
  __pyx_vtable_11colibricore_Pattern.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_Pattern *, Pattern &))__pyx_f_11colibricore_7Pattern_bind;
  __pyx_vtable_11colibricore_Pattern.add = (struct __pyx_obj_11colibricore_Pattern *(*)(struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_7Pattern_add;
  if (PyType_Ready(&__pyx_type_11colibricore_Pattern) < 0) __PYX_ERR(1, 164, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_Pattern.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_Pattern.tp_dictoffset && __pyx_type_11colibricore_Pattern.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_Pattern.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_12__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_12__contains__.doc = __pyx_doc_11colibricore_7Pattern_12__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_12__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_16__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_16__len__.doc = __pyx_doc_11colibricore_7Pattern_16__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_16__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__add__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_24__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_24__add__.doc = __pyx_doc_11colibricore_7Pattern_24__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_24__add__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_26__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_26__getitem__.doc = __pyx_doc_11colibricore_7Pattern_26__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_26__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_28__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_28__iter__.doc = __pyx_doc_11colibricore_7Pattern_28__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_28__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_Pattern, "__hash__"); if (unlikely(!wrapper)) __PYX_ERR(1, 164, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_7Pattern_37__hash__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_7Pattern_37__hash__.doc = __pyx_doc_11colibricore_7Pattern_37__hash__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_7Pattern_37__hash__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_Pattern.tp_dict, __pyx_vtabptr_11colibricore_Pattern) < 0) __PYX_ERR(1, 164, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Pattern, (PyObject *)&__pyx_type_11colibricore_Pattern) < 0) __PYX_ERR(1, 164, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_Pattern) < 0) __PYX_ERR(1, 164, __pyx_L1_error)
  __pyx_ptype_11colibricore_Pattern = &__pyx_type_11colibricore_Pattern;
  __pyx_vtabptr_11colibricore_IndexedData = &__pyx_vtable_11colibricore_IndexedData;
  __pyx_vtable_11colibricore_IndexedData.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedData *, IndexedData))__pyx_f_11colibricore_11IndexedData_bind;
  if (PyType_Ready(&__pyx_type_11colibricore_IndexedData) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_IndexedData.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_IndexedData.tp_dictoffset && __pyx_type_11colibricore_IndexedData.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_IndexedData.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedData, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 470, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_11IndexedData___contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_11IndexedData___contains__.doc = __pyx_doc_11colibricore_11IndexedData___contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_11IndexedData___contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedData, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 470, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_11IndexedData_2__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_11IndexedData_2__iter__.doc = __pyx_doc_11colibricore_11IndexedData_2__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_11IndexedData_2__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedData, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 470, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_11IndexedData_5__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_11IndexedData_5__len__.doc = __pyx_doc_11colibricore_11IndexedData_5__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_11IndexedData_5__len__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_IndexedData.tp_dict, __pyx_vtabptr_11colibricore_IndexedData) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IndexedData, (PyObject *)&__pyx_type_11colibricore_IndexedData) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_IndexedData) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
  __pyx_ptype_11colibricore_IndexedData = &__pyx_type_11colibricore_IndexedData;
  __pyx_vtabptr_11colibricore_PatternSet = &__pyx_vtable_11colibricore_PatternSet;
  __pyx_vtable_11colibricore_PatternSet.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternSet *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_10PatternSet_has;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternSet) < 0) __PYX_ERR(1, 507, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternSet.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternSet.tp_dictoffset && __pyx_type_11colibricore_PatternSet.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternSet.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSet, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 507, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_10PatternSet_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_10PatternSet_2__len__.doc = __pyx_doc_11colibricore_10PatternSet_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_10PatternSet_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSet, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 507, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_10PatternSet_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_10PatternSet_6__contains__.doc = __pyx_doc_11colibricore_10PatternSet_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_10PatternSet_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSet, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 507, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_10PatternSet_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_10PatternSet_8__iter__.doc = __pyx_doc_11colibricore_10PatternSet_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_10PatternSet_8__iter__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternSet.tp_dict, __pyx_vtabptr_11colibricore_PatternSet) < 0) __PYX_ERR(1, 507, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternSet, (PyObject *)&__pyx_type_11colibricore_PatternSet) < 0) __PYX_ERR(1, 507, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternSet) < 0) __PYX_ERR(1, 507, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternSet = &__pyx_type_11colibricore_PatternSet;
  __pyx_vtabptr_11colibricore_PatternDict_int32 = &__pyx_vtable_11colibricore_PatternDict_int32;
  __pyx_vtable_11colibricore_PatternDict_int32.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_17PatternDict_int32_has;
  __pyx_vtable_11colibricore_PatternDict_int32.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  &))__pyx_f_11colibricore_17PatternDict_int32_bind;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternDict_int32) < 0) __PYX_ERR(1, 562, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternDict_int32.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternDict_int32.tp_dictoffset && __pyx_type_11colibricore_PatternDict_int32.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternDict_int32.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int32, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 562, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_2__len__.doc = __pyx_doc_11colibricore_17PatternDict_int32_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_int32_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int32, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 562, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_6__contains__.doc = __pyx_doc_11colibricore_17PatternDict_int32_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_int32_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int32, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 562, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_8__iter__.doc = __pyx_doc_11colibricore_17PatternDict_int32_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_int32_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int32, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 562, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_11__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_11__getitem__.doc = __pyx_doc_11colibricore_17PatternDict_int32_11__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_int32_11__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int32, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 562, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_20__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_int32_20__setitem__.doc = __pyx_doc_11colibricore_17PatternDict_int32_20__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_int32_20__setitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternDict_int32.tp_dict, __pyx_vtabptr_11colibricore_PatternDict_int32) < 0) __PYX_ERR(1, 562, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternDict_int32, (PyObject *)&__pyx_type_11colibricore_PatternDict_int32) < 0) __PYX_ERR(1, 562, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternDict_int32) < 0) __PYX_ERR(1, 562, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternDict_int32 = &__pyx_type_11colibricore_PatternDict_int32;
  __pyx_vtabptr_11colibricore_SmallPatternDict_int32 = &__pyx_vtable_11colibricore_SmallPatternDict_int32;
  __pyx_vtable_11colibricore_SmallPatternDict_int32.has = (PyObject *(*)(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_22SmallPatternDict_int32_has;
  __pyx_vtable_11colibricore_SmallPatternDict_int32.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_SmallPatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint16_t>  &))__pyx_f_11colibricore_22SmallPatternDict_int32_bind;
  if (PyType_Ready(&__pyx_type_11colibricore_SmallPatternDict_int32) < 0) __PYX_ERR(1, 643, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_SmallPatternDict_int32.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_SmallPatternDict_int32.tp_dictoffset && __pyx_type_11colibricore_SmallPatternDict_int32.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_SmallPatternDict_int32.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 643, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_2__len__.doc = __pyx_doc_11colibricore_22SmallPatternDict_int32_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 643, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_6__contains__.doc = __pyx_doc_11colibricore_22SmallPatternDict_int32_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 643, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_8__iter__.doc = __pyx_doc_11colibricore_22SmallPatternDict_int32_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 643, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_11__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_11__getitem__.doc = __pyx_doc_11colibricore_22SmallPatternDict_int32_11__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_11__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 643, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_20__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_20__setitem__.doc = __pyx_doc_11colibricore_22SmallPatternDict_int32_20__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_22SmallPatternDict_int32_20__setitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_SmallPatternDict_int32.tp_dict, __pyx_vtabptr_11colibricore_SmallPatternDict_int32) < 0) __PYX_ERR(1, 643, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SmallPatternDict_int32, (PyObject *)&__pyx_type_11colibricore_SmallPatternDict_int32) < 0) __PYX_ERR(1, 643, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_SmallPatternDict_int32) < 0) __PYX_ERR(1, 643, __pyx_L1_error)
  __pyx_ptype_11colibricore_SmallPatternDict_int32 = &__pyx_type_11colibricore_SmallPatternDict_int32;
  __pyx_vtabptr_11colibricore_TinyPatternDict_int32 = &__pyx_vtable_11colibricore_TinyPatternDict_int32;
  __pyx_vtable_11colibricore_TinyPatternDict_int32.has = (PyObject *(*)(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21TinyPatternDict_int32_has;
  __pyx_vtable_11colibricore_TinyPatternDict_int32.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_TinyPatternDict_int32 *, PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint8_t>  &))__pyx_f_11colibricore_21TinyPatternDict_int32_bind;
  if (PyType_Ready(&__pyx_type_11colibricore_TinyPatternDict_int32) < 0) __PYX_ERR(1, 723, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_TinyPatternDict_int32.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_TinyPatternDict_int32.tp_dictoffset && __pyx_type_11colibricore_TinyPatternDict_int32.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_TinyPatternDict_int32.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 723, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_2__len__.doc = __pyx_doc_11colibricore_21TinyPatternDict_int32_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 723, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_6__contains__.doc = __pyx_doc_11colibricore_21TinyPatternDict_int32_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 723, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_8__iter__.doc = __pyx_doc_11colibricore_21TinyPatternDict_int32_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 723, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_11__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_11__getitem__.doc = __pyx_doc_11colibricore_21TinyPatternDict_int32_11__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_11__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 723, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_20__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_20__setitem__.doc = __pyx_doc_11colibricore_21TinyPatternDict_int32_20__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21TinyPatternDict_int32_20__setitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_TinyPatternDict_int32.tp_dict, __pyx_vtabptr_11colibricore_TinyPatternDict_int32) < 0) __PYX_ERR(1, 723, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TinyPatternDict_int32, (PyObject *)&__pyx_type_11colibricore_TinyPatternDict_int32) < 0) __PYX_ERR(1, 723, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_TinyPatternDict_int32) < 0) __PYX_ERR(1, 723, __pyx_L1_error)
  __pyx_ptype_11colibricore_TinyPatternDict_int32 = &__pyx_type_11colibricore_TinyPatternDict_int32;
  __pyx_vtabptr_11colibricore_PatternDict_int = &__pyx_vtable_11colibricore_PatternDict_int;
  __pyx_vtable_11colibricore_PatternDict_int.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternDict_int *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_15PatternDict_int_has;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternDict_int) < 0) __PYX_ERR(1, 802, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternDict_int.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternDict_int.tp_dictoffset && __pyx_type_11colibricore_PatternDict_int.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternDict_int.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 802, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternDict_int_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternDict_int_2__len__.doc = __pyx_doc_11colibricore_15PatternDict_int_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternDict_int_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 802, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternDict_int_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternDict_int_6__contains__.doc = __pyx_doc_11colibricore_15PatternDict_int_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternDict_int_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 802, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternDict_int_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternDict_int_8__iter__.doc = __pyx_doc_11colibricore_15PatternDict_int_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternDict_int_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 802, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternDict_int_11__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternDict_int_11__getitem__.doc = __pyx_doc_11colibricore_15PatternDict_int_11__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternDict_int_11__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_int, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 802, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternDict_int_20__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternDict_int_20__setitem__.doc = __pyx_doc_11colibricore_15PatternDict_int_20__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternDict_int_20__setitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternDict_int.tp_dict, __pyx_vtabptr_11colibricore_PatternDict_int) < 0) __PYX_ERR(1, 802, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternDict_int, (PyObject *)&__pyx_type_11colibricore_PatternDict_int) < 0) __PYX_ERR(1, 802, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternDict_int) < 0) __PYX_ERR(1, 802, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternDict_int = &__pyx_type_11colibricore_PatternDict_int;
  __pyx_vtabptr_11colibricore_PatternDict_float = &__pyx_vtable_11colibricore_PatternDict_float;
  __pyx_vtable_11colibricore_PatternDict_float.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternDict_float *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_17PatternDict_float_has;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternDict_float) < 0) __PYX_ERR(1, 878, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternDict_float.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternDict_float.tp_dictoffset && __pyx_type_11colibricore_PatternDict_float.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternDict_float.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_float, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 878, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_float_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_float_2__len__.doc = __pyx_doc_11colibricore_17PatternDict_float_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_float_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_float, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 878, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_float_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_float_6__contains__.doc = __pyx_doc_11colibricore_17PatternDict_float_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_float_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_float, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 878, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_float_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_float_8__iter__.doc = __pyx_doc_11colibricore_17PatternDict_float_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_float_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_float, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 878, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_float_11__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_float_11__getitem__.doc = __pyx_doc_11colibricore_17PatternDict_float_11__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_float_11__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternDict_float, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 878, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_17PatternDict_float_20__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_17PatternDict_float_20__setitem__.doc = __pyx_doc_11colibricore_17PatternDict_float_20__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_17PatternDict_float_20__setitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternDict_float.tp_dict, __pyx_vtabptr_11colibricore_PatternDict_float) < 0) __PYX_ERR(1, 878, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternDict_float, (PyObject *)&__pyx_type_11colibricore_PatternDict_float) < 0) __PYX_ERR(1, 878, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternDict_float) < 0) __PYX_ERR(1, 878, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternDict_float = &__pyx_type_11colibricore_PatternDict_float;
  __pyx_vtabptr_11colibricore_AlignedPatternDict_int32 = &__pyx_vtable_11colibricore_AlignedPatternDict_int32;
  __pyx_vtable_11colibricore_AlignedPatternDict_int32.has = (PyObject *(*)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_24AlignedPatternDict_int32_has;
  __pyx_vtable_11colibricore_AlignedPatternDict_int32.haspair = (PyObject *(*)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_24AlignedPatternDict_int32_haspair;
  __pyx_vtable_11colibricore_AlignedPatternDict_int32.getmap = (PatternMap<uint32_t,BaseValueHandler<uint32_t> ,uint32_t>  *(*)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_24AlignedPatternDict_int32_getmap;
  __pyx_vtable_11colibricore_AlignedPatternDict_int32.getpair = (PyObject *(*)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_24AlignedPatternDict_int32_getpair;
  __pyx_vtable_11colibricore_AlignedPatternDict_int32.setpair = (PyObject *(*)(struct __pyx_obj_11colibricore_AlignedPatternDict_int32 *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, uint32_t, int __pyx_skip_dispatch))__pyx_f_11colibricore_24AlignedPatternDict_int32_setpair;
  if (PyType_Ready(&__pyx_type_11colibricore_AlignedPatternDict_int32) < 0) __PYX_ERR(1, 955, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_AlignedPatternDict_int32.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_AlignedPatternDict_int32.tp_dictoffset && __pyx_type_11colibricore_AlignedPatternDict_int32.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_AlignedPatternDict_int32.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_AlignedPatternDict_int32, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 955, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32___len__.doc = __pyx_doc_11colibricore_24AlignedPatternDict_int32___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_AlignedPatternDict_int32, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 955, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_8__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_8__contains__.doc = __pyx_doc_11colibricore_24AlignedPatternDict_int32_8__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_8__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_AlignedPatternDict_int32, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 955, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_10__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_10__iter__.doc = __pyx_doc_11colibricore_24AlignedPatternDict_int32_10__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_10__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_AlignedPatternDict_int32, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 955, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_23__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_23__getitem__.doc = __pyx_doc_11colibricore_24AlignedPatternDict_int32_23__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_24AlignedPatternDict_int32_23__getitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_AlignedPatternDict_int32.tp_dict, __pyx_vtabptr_11colibricore_AlignedPatternDict_int32) < 0) __PYX_ERR(1, 955, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AlignedPatternDict_int32, (PyObject *)&__pyx_type_11colibricore_AlignedPatternDict_int32) < 0) __PYX_ERR(1, 955, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_AlignedPatternDict_int32) < 0) __PYX_ERR(1, 955, __pyx_L1_error)
  __pyx_ptype_11colibricore_AlignedPatternDict_int32 = &__pyx_type_11colibricore_AlignedPatternDict_int32;
  __pyx_vtabptr_11colibricore_IndexedPatternModel = &__pyx_vtable_11colibricore_IndexedPatternModel;
  __pyx_vtable_11colibricore_IndexedPatternModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_19IndexedPatternModel_has;
  __pyx_vtable_11colibricore_IndexedPatternModel.loadconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.loadconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.loadconstrainedbysetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_loadconstrainedbysetmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.write = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_write;
  __pyx_vtable_11colibricore_IndexedPatternModel.printmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_printmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.train = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_train *__pyx_optional_args))__pyx_f_11colibricore_19IndexedPatternModel_train;
  __pyx_vtable_11colibricore_IndexedPatternModel.train_filtered = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_train_filtered;
  __pyx_vtable_11colibricore_IndexedPatternModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *))__pyx_f_11colibricore_19IndexedPatternModel_getinterface;
  __pyx_vtable_11colibricore_IndexedPatternModel.trainconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.trainconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.trainconstrainedbypatternsetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbypatternsetmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.trainconstrainedbyalignmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_trainconstrainedbyalignmodel;
  __pyx_vtable_11colibricore_IndexedPatternModel.report = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_report;
  __pyx_vtable_11colibricore_IndexedPatternModel.printhistogram = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_printhistogram;
  __pyx_vtable_11colibricore_IndexedPatternModel.prune = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_19IndexedPatternModel_prune *__pyx_optional_args))__pyx_f_11colibricore_19IndexedPatternModel_prune;
  __pyx_vtable_11colibricore_IndexedPatternModel.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_getdata;
  __pyx_vtable_11colibricore_IndexedPatternModel.add = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_add;
  __pyx_vtable_11colibricore_IndexedPatternModel.outputrelations = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_19IndexedPatternModel_outputrelations;
  if (PyType_Ready(&__pyx_type_11colibricore_IndexedPatternModel) < 0) __PYX_ERR(1, 1115, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_IndexedPatternModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_IndexedPatternModel.tp_dictoffset && __pyx_type_11colibricore_IndexedPatternModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_IndexedPatternModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel___len__.doc = __pyx_doc_11colibricore_19IndexedPatternModel___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_32__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_32__contains__.doc = __pyx_doc_11colibricore_19IndexedPatternModel_32__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel_32__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_34__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_34__getitem__.doc = __pyx_doc_11colibricore_19IndexedPatternModel_34__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel_34__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_36__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_36__iter__.doc = __pyx_doc_11colibricore_19IndexedPatternModel_36__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel_36__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_39__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_39__init__.doc = __pyx_doc_11colibricore_19IndexedPatternModel_39__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel_39__init__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1115, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_97__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_19IndexedPatternModel_97__iter__.doc = __pyx_doc_11colibricore_19IndexedPatternModel_97__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_19IndexedPatternModel_97__iter__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_IndexedPatternModel.tp_dict, __pyx_vtabptr_11colibricore_IndexedPatternModel) < 0) __PYX_ERR(1, 1115, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IndexedPatternModel, (PyObject *)&__pyx_type_11colibricore_IndexedPatternModel) < 0) __PYX_ERR(1, 1115, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_IndexedPatternModel) < 0) __PYX_ERR(1, 1115, __pyx_L1_error)
  __pyx_ptype_11colibricore_IndexedPatternModel = &__pyx_type_11colibricore_IndexedPatternModel;
  __pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel = &__pyx_vtable_11colibricore_HashOrderedIndexedPatternModel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_has;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.loadconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.loadconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.loadconstrainedbysetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_loadconstrainedbysetmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.write = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_write;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.printmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.train = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_train *__pyx_optional_args))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.train_filtered = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_train_filtered;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getinterface;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.trainconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.trainconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.trainconstrainedbypatternsetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbypatternsetmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.trainconstrainedbyalignmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_trainconstrainedbyalignmodel;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.report = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_report;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.printhistogram = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_printhistogram;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.prune = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_30HashOrderedIndexedPatternModel_prune *__pyx_optional_args))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_prune;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_getdata;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.add = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_add;
  __pyx_vtable_11colibricore_HashOrderedIndexedPatternModel.outputrelations = (PyObject *(*)(struct __pyx_obj_11colibricore_HashOrderedIndexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_30HashOrderedIndexedPatternModel_outputrelations;
  if (PyType_Ready(&__pyx_type_11colibricore_HashOrderedIndexedPatternModel) < 0) __PYX_ERR(1, 1941, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_HashOrderedIndexedPatternModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_HashOrderedIndexedPatternModel.tp_dictoffset && __pyx_type_11colibricore_HashOrderedIndexedPatternModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_HashOrderedIndexedPatternModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel___len__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_32__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_32__contains__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_32__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_32__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_34__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_36__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_36__iter__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_36__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_36__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_39__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_39__init__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_39__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_39__init__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1941, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_97__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_97__iter__.doc = __pyx_doc_11colibricore_30HashOrderedIndexedPatternModel_97__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_30HashOrderedIndexedPatternModel_97__iter__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_HashOrderedIndexedPatternModel.tp_dict, __pyx_vtabptr_11colibricore_HashOrderedIndexedPatternModel) < 0) __PYX_ERR(1, 1941, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HashOrderedIndexedPatternModel_2, (PyObject *)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel) < 0) __PYX_ERR(1, 1941, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_HashOrderedIndexedPatternModel) < 0) __PYX_ERR(1, 1941, __pyx_L1_error)
  __pyx_ptype_11colibricore_HashOrderedIndexedPatternModel = &__pyx_type_11colibricore_HashOrderedIndexedPatternModel;
  __pyx_vtabptr_11colibricore_PatternSetModel = &__pyx_vtable_11colibricore_PatternSetModel;
  __pyx_vtable_11colibricore_PatternSetModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternSetModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_15PatternSetModel_has;
  __pyx_vtable_11colibricore_PatternSetModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_PatternSetModel *))__pyx_f_11colibricore_15PatternSetModel_getinterface;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternSetModel) < 0) __PYX_ERR(1, 2767, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternSetModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternSetModel.tp_dictoffset && __pyx_type_11colibricore_PatternSetModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternSetModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSetModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2767, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternSetModel_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternSetModel_2__len__.doc = __pyx_doc_11colibricore_15PatternSetModel_2__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternSetModel_2__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSetModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2767, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternSetModel_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternSetModel_6__contains__.doc = __pyx_doc_11colibricore_15PatternSetModel_6__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternSetModel_6__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSetModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2767, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternSetModel_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternSetModel_8__iter__.doc = __pyx_doc_11colibricore_15PatternSetModel_8__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternSetModel_8__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternSetModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2767, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_15PatternSetModel_13__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_15PatternSetModel_13__init__.doc = __pyx_doc_11colibricore_15PatternSetModel_13__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_15PatternSetModel_13__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternSetModel.tp_dict, __pyx_vtabptr_11colibricore_PatternSetModel) < 0) __PYX_ERR(1, 2767, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternSetModel, (PyObject *)&__pyx_type_11colibricore_PatternSetModel) < 0) __PYX_ERR(1, 2767, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternSetModel) < 0) __PYX_ERR(1, 2767, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternSetModel = &__pyx_type_11colibricore_PatternSetModel;
  __pyx_vtabptr_11colibricore_UnindexedPatternModel = &__pyx_vtable_11colibricore_UnindexedPatternModel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_21UnindexedPatternModel_has;
  __pyx_vtable_11colibricore_UnindexedPatternModel.loadconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.loadconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.loadconstrainedbysetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_loadconstrainedbysetmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.write = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_write;
  __pyx_vtable_11colibricore_UnindexedPatternModel.printmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_printmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.train = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_train *__pyx_optional_args))__pyx_f_11colibricore_21UnindexedPatternModel_train;
  __pyx_vtable_11colibricore_UnindexedPatternModel.train_filtered = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_train_filtered;
  __pyx_vtable_11colibricore_UnindexedPatternModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *))__pyx_f_11colibricore_21UnindexedPatternModel_getinterface;
  __pyx_vtable_11colibricore_UnindexedPatternModel.trainconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.trainconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.trainconstrainedbypatternsetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbypatternsetmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.trainconstrainedbyalignmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_trainconstrainedbyalignmodel;
  __pyx_vtable_11colibricore_UnindexedPatternModel.report = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_report;
  __pyx_vtable_11colibricore_UnindexedPatternModel.printhistogram = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_printhistogram;
  __pyx_vtable_11colibricore_UnindexedPatternModel.prune = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_prune *__pyx_optional_args))__pyx_f_11colibricore_21UnindexedPatternModel_prune;
  __pyx_vtable_11colibricore_UnindexedPatternModel.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_21UnindexedPatternModel_getdata;
  __pyx_vtable_11colibricore_UnindexedPatternModel.add = (PyObject *(*)(struct __pyx_obj_11colibricore_UnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_21UnindexedPatternModel_add *__pyx_optional_args))__pyx_f_11colibricore_21UnindexedPatternModel_add;
  if (PyType_Ready(&__pyx_type_11colibricore_UnindexedPatternModel) < 0) __PYX_ERR(1, 2869, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_UnindexedPatternModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_UnindexedPatternModel.tp_dictoffset && __pyx_type_11colibricore_UnindexedPatternModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_UnindexedPatternModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2869, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel___len__.doc = __pyx_doc_11colibricore_21UnindexedPatternModel___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21UnindexedPatternModel___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2869, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_32__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_32__contains__.doc = __pyx_doc_11colibricore_21UnindexedPatternModel_32__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21UnindexedPatternModel_32__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2869, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_34__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_34__getitem__.doc = __pyx_doc_11colibricore_21UnindexedPatternModel_34__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21UnindexedPatternModel_34__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2869, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_36__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_36__iter__.doc = __pyx_doc_11colibricore_21UnindexedPatternModel_36__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21UnindexedPatternModel_36__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 2869, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_39__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_21UnindexedPatternModel_39__init__.doc = __pyx_doc_11colibricore_21UnindexedPatternModel_39__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_21UnindexedPatternModel_39__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_UnindexedPatternModel.tp_dict, __pyx_vtabptr_11colibricore_UnindexedPatternModel) < 0) __PYX_ERR(1, 2869, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_UnindexedPatternModel, (PyObject *)&__pyx_type_11colibricore_UnindexedPatternModel) < 0) __PYX_ERR(1, 2869, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_UnindexedPatternModel) < 0) __PYX_ERR(1, 2869, __pyx_L1_error)
  __pyx_ptype_11colibricore_UnindexedPatternModel = &__pyx_type_11colibricore_UnindexedPatternModel;
  __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel = &__pyx_vtable_11colibricore_OrderedUnindexedPatternModel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_has;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.loadconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.loadconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.loadconstrainedbysetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_loadconstrainedbysetmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.write = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_write;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.printmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_ClassDecoder *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.train = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_train *__pyx_optional_args))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.train_filtered = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSet *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_train_filtered;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getinterface;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.trainconstrainedbyindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_IndexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyindexedmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.trainconstrainedbyunindexedmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_UnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyunindexedmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.trainconstrainedbypatternsetmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternSetModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbypatternsetmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.trainconstrainedbyalignmodel = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, PyObject *, struct __pyx_obj_11colibricore_PatternModelOptions *, struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_trainconstrainedbyalignmodel;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.report = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_report;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.printhistogram = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_printhistogram;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.prune = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_prune *__pyx_optional_args))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_prune;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_getdata;
  __pyx_vtable_11colibricore_OrderedUnindexedPatternModel.add = (PyObject *(*)(struct __pyx_obj_11colibricore_OrderedUnindexedPatternModel *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_11colibricore_28OrderedUnindexedPatternModel_add *__pyx_optional_args))__pyx_f_11colibricore_28OrderedUnindexedPatternModel_add;
  if (PyType_Ready(&__pyx_type_11colibricore_OrderedUnindexedPatternModel) < 0) __PYX_ERR(1, 3366, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_OrderedUnindexedPatternModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_OrderedUnindexedPatternModel.tp_dictoffset && __pyx_type_11colibricore_OrderedUnindexedPatternModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_OrderedUnindexedPatternModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3366, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel___len__.doc = __pyx_doc_11colibricore_28OrderedUnindexedPatternModel___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3366, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_32__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_32__contains__.doc = __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_32__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_32__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3366, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_34__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_34__getitem__.doc = __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_34__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_34__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3366, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_36__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_36__iter__.doc = __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_36__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_36__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3366, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_39__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_39__init__.doc = __pyx_doc_11colibricore_28OrderedUnindexedPatternModel_39__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_28OrderedUnindexedPatternModel_39__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_OrderedUnindexedPatternModel.tp_dict, __pyx_vtabptr_11colibricore_OrderedUnindexedPatternModel) < 0) __PYX_ERR(1, 3366, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_OrderedUnindexedPatternModel, (PyObject *)&__pyx_type_11colibricore_OrderedUnindexedPatternModel) < 0) __PYX_ERR(1, 3366, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_OrderedUnindexedPatternModel) < 0) __PYX_ERR(1, 3366, __pyx_L1_error)
  __pyx_ptype_11colibricore_OrderedUnindexedPatternModel = &__pyx_type_11colibricore_OrderedUnindexedPatternModel;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternModelOptions) < 0) __PYX_ERR(1, 3862, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternModelOptions.tp_print = 0;
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternModelOptions, (PyObject *)&__pyx_type_11colibricore_PatternModelOptions) < 0) __PYX_ERR(1, 3862, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternModelOptions) < 0) __PYX_ERR(1, 3862, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternModelOptions = &__pyx_type_11colibricore_PatternModelOptions;
  __pyx_vtabptr_11colibricore_IndexedCorpus = &__pyx_vtable_11colibricore_IndexedCorpus;
  __pyx_vtable_11colibricore_IndexedCorpus.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedCorpus *, IndexedCorpus *, struct __pyx_opt_args_11colibricore_13IndexedCorpus_bind *__pyx_optional_args))__pyx_f_11colibricore_13IndexedCorpus_bind;
  __pyx_vtable_11colibricore_IndexedCorpus.has = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *))__pyx_f_11colibricore_13IndexedCorpus_has;
  __pyx_vtable_11colibricore_IndexedCorpus.get = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *))__pyx_f_11colibricore_13IndexedCorpus_get;
  __pyx_vtable_11colibricore_IndexedCorpus.getslice = (PyObject *(*)(struct __pyx_obj_11colibricore_IndexedCorpus *, PyObject *, PyObject *))__pyx_f_11colibricore_13IndexedCorpus_getslice;
  if (PyType_Ready(&__pyx_type_11colibricore_IndexedCorpus) < 0) __PYX_ERR(1, 3978, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_IndexedCorpus.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_IndexedCorpus.tp_dictoffset && __pyx_type_11colibricore_IndexedCorpus.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_IndexedCorpus.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedCorpus, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3978, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_13IndexedCorpus___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_13IndexedCorpus___init__.doc = __pyx_doc_11colibricore_13IndexedCorpus___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_13IndexedCorpus___init__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedCorpus, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3978, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_6__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_6__len__.doc = __pyx_doc_11colibricore_13IndexedCorpus_6__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_13IndexedCorpus_6__len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedCorpus, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3978, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_8__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_8__contains__.doc = __pyx_doc_11colibricore_13IndexedCorpus_8__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_13IndexedCorpus_8__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedCorpus, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3978, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_10__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_10__iter__.doc = __pyx_doc_11colibricore_13IndexedCorpus_10__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_13IndexedCorpus_10__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_IndexedCorpus, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 3978, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_13__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_13IndexedCorpus_13__getitem__.doc = __pyx_doc_11colibricore_13IndexedCorpus_13__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_13IndexedCorpus_13__getitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_IndexedCorpus.tp_dict, __pyx_vtabptr_11colibricore_IndexedCorpus) < 0) __PYX_ERR(1, 3978, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IndexedCorpus, (PyObject *)&__pyx_type_11colibricore_IndexedCorpus) < 0) __PYX_ERR(1, 3978, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_IndexedCorpus) < 0) __PYX_ERR(1, 3978, __pyx_L1_error)
  __pyx_ptype_11colibricore_IndexedCorpus = &__pyx_type_11colibricore_IndexedCorpus;
  __pyx_vtabptr_11colibricore_PatternVector = &__pyx_vtable_11colibricore_PatternVector;
  __pyx_vtable_11colibricore_PatternVector.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternVector *, PatternVector &))__pyx_f_11colibricore_13PatternVector_bind;
  __pyx_vtable_11colibricore_PatternVector.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternVector *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_13PatternVector_has;
  __pyx_vtable_11colibricore_PatternVector.append = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternVector *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_13PatternVector_append;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternVector) < 0) __PYX_ERR(1, 4142, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternVector.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternVector.tp_dictoffset && __pyx_type_11colibricore_PatternVector.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternVector.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternVector.tp_dict, __pyx_vtabptr_11colibricore_PatternVector) < 0) __PYX_ERR(1, 4142, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternVector, (PyObject *)&__pyx_type_11colibricore_PatternVector) < 0) __PYX_ERR(1, 4142, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternVector) < 0) __PYX_ERR(1, 4142, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternVector = &__pyx_type_11colibricore_PatternVector;
  __pyx_vtabptr_11colibricore_PatternFeatureVectorMap_float = &__pyx_vtable_11colibricore_PatternFeatureVectorMap_float;
  __pyx_vtable_11colibricore_PatternFeatureVectorMap_float.bind = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, PatternFeatureVectorMap<double>  &))__pyx_f_11colibricore_29PatternFeatureVectorMap_float_bind;
  __pyx_vtable_11colibricore_PatternFeatureVectorMap_float.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_29PatternFeatureVectorMap_float_has;
  __pyx_vtable_11colibricore_PatternFeatureVectorMap_float.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_29PatternFeatureVectorMap_float_getdata;
  __pyx_vtable_11colibricore_PatternFeatureVectorMap_float.setdata = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternFeatureVectorMap_float *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_29PatternFeatureVectorMap_float_setdata;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternFeatureVectorMap_float) < 0) __PYX_ERR(1, 4172, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternFeatureVectorMap_float.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternFeatureVectorMap_float.tp_dictoffset && __pyx_type_11colibricore_PatternFeatureVectorMap_float.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternFeatureVectorMap_float.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternFeatureVectorMap_float.tp_dict, __pyx_vtabptr_11colibricore_PatternFeatureVectorMap_float) < 0) __PYX_ERR(1, 4172, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternFeatureVectorMap_float_2, (PyObject *)&__pyx_type_11colibricore_PatternFeatureVectorMap_float) < 0) __PYX_ERR(1, 4172, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternFeatureVectorMap_float) < 0) __PYX_ERR(1, 4172, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternFeatureVectorMap_float = &__pyx_type_11colibricore_PatternFeatureVectorMap_float;
  __pyx_vtabptr_11colibricore_PatternAlignmentModel_float = &__pyx_vtable_11colibricore_PatternAlignmentModel_float;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.has = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_27PatternAlignmentModel_float_has;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.hastuple = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_27PatternAlignmentModel_float_hastuple;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.write = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_27PatternAlignmentModel_float_write;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *))__pyx_f_11colibricore_27PatternAlignmentModel_float_getinterface;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_27PatternAlignmentModel_float_getdata;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.getfeatures = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, PatternFeatureVector<double>  *))__pyx_f_11colibricore_27PatternAlignmentModel_float_getfeatures;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.getdatatuple = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_27PatternAlignmentModel_float_getdatatuple;
  __pyx_vtable_11colibricore_PatternAlignmentModel_float.add = (PyObject *(*)(struct __pyx_obj_11colibricore_PatternAlignmentModel_float *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_27PatternAlignmentModel_float_add;
  if (PyType_Ready(&__pyx_type_11colibricore_PatternAlignmentModel_float) < 0) __PYX_ERR(1, 4244, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_PatternAlignmentModel_float.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_PatternAlignmentModel_float.tp_dictoffset && __pyx_type_11colibricore_PatternAlignmentModel_float.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_PatternAlignmentModel_float.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4244, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float___len__.doc = __pyx_doc_11colibricore_27PatternAlignmentModel_float___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4244, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_16__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_16__contains__.doc = __pyx_doc_11colibricore_27PatternAlignmentModel_float_16__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_16__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4244, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_18__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_18__getitem__.doc = __pyx_doc_11colibricore_27PatternAlignmentModel_float_18__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_18__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4244, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_20__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_20__iter__.doc = __pyx_doc_11colibricore_27PatternAlignmentModel_float_20__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_20__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4244, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_23__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_23__init__.doc = __pyx_doc_11colibricore_27PatternAlignmentModel_float_23__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_27PatternAlignmentModel_float_23__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_PatternAlignmentModel_float.tp_dict, __pyx_vtabptr_11colibricore_PatternAlignmentModel_float) < 0) __PYX_ERR(1, 4244, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PatternAlignmentModel_float, (PyObject *)&__pyx_type_11colibricore_PatternAlignmentModel_float) < 0) __PYX_ERR(1, 4244, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_PatternAlignmentModel_float) < 0) __PYX_ERR(1, 4244, __pyx_L1_error)
  __pyx_ptype_11colibricore_PatternAlignmentModel_float = &__pyx_type_11colibricore_PatternAlignmentModel_float;
  __pyx_vtabptr_11colibricore_BasicPatternAlignmentModel = &__pyx_vtable_11colibricore_BasicPatternAlignmentModel;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.has = (PyObject *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_26BasicPatternAlignmentModel_has;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.hastuple = (PyObject *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_26BasicPatternAlignmentModel_hastuple;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.write = (PyObject *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, PyObject *, int __pyx_skip_dispatch))__pyx_f_11colibricore_26BasicPatternAlignmentModel_write;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.getinterface = (PatternModelInterface *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *))__pyx_f_11colibricore_26BasicPatternAlignmentModel_getinterface;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.getdata = (PyObject *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *))__pyx_f_11colibricore_26BasicPatternAlignmentModel_getdata;
  __pyx_vtable_11colibricore_BasicPatternAlignmentModel.add = (PyObject *(*)(struct __pyx_obj_11colibricore_BasicPatternAlignmentModel *, struct __pyx_obj_11colibricore_Pattern *, struct __pyx_obj_11colibricore_Pattern *, int __pyx_skip_dispatch))__pyx_f_11colibricore_26BasicPatternAlignmentModel_add;
  if (PyType_Ready(&__pyx_type_11colibricore_BasicPatternAlignmentModel) < 0) __PYX_ERR(1, 4473, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore_BasicPatternAlignmentModel.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore_BasicPatternAlignmentModel.tp_dictoffset && __pyx_type_11colibricore_BasicPatternAlignmentModel.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore_BasicPatternAlignmentModel.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4473, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel___len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel___len__.doc = __pyx_doc_11colibricore_26BasicPatternAlignmentModel___len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel___len__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4473, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_16__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_16__contains__.doc = __pyx_doc_11colibricore_26BasicPatternAlignmentModel_16__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_16__contains__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4473, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_18__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_18__getitem__.doc = __pyx_doc_11colibricore_26BasicPatternAlignmentModel_18__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_18__getitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4473, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_20__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_20__iter__.doc = __pyx_doc_11colibricore_26BasicPatternAlignmentModel_20__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_20__iter__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 4473, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_23__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_23__init__.doc = __pyx_doc_11colibricore_26BasicPatternAlignmentModel_23__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_11colibricore_26BasicPatternAlignmentModel_23__init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_11colibricore_BasicPatternAlignmentModel.tp_dict, __pyx_vtabptr_11colibricore_BasicPatternAlignmentModel) < 0) __PYX_ERR(1, 4473, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BasicPatternAlignmentModel, (PyObject *)&__pyx_type_11colibricore_BasicPatternAlignmentModel) < 0) __PYX_ERR(1, 4473, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_11colibricore_BasicPatternAlignmentModel) < 0) __PYX_ERR(1, 4473, __pyx_L1_error)
  __pyx_ptype_11colibricore_BasicPatternAlignmentModel = &__pyx_type_11colibricore_BasicPatternAlignmentModel;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct____iter__) < 0) __PYX_ERR(1, 299, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct____iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct____iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct____iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct____iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct____iter__ = &__pyx_type_11colibricore___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux) < 0) __PYX_ERR(1, 368, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_1__ngrams_aux = &__pyx_type_11colibricore___pyx_scope_struct_1__ngrams_aux;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_2_parts) < 0) __PYX_ERR(1, 381, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_2_parts.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_2_parts.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_2_parts.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_2_parts.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_2_parts = &__pyx_type_11colibricore___pyx_scope_struct_2_parts;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_3_gaps) < 0) __PYX_ERR(1, 398, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_3_gaps.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_3_gaps.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_3_gaps.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_3_gaps.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_3_gaps = &__pyx_type_11colibricore___pyx_scope_struct_3_gaps;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_4_subngrams) < 0) __PYX_ERR(1, 423, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_4_subngrams.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_4_subngrams.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_4_subngrams.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_4_subngrams.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_4_subngrams = &__pyx_type_11colibricore___pyx_scope_struct_4_subngrams;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_5___iter__) < 0) __PYX_ERR(1, 486, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_5___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_5___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_5___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_5___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_5___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_5___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_6___iter__) < 0) __PYX_ERR(1, 536, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_6___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_6___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_6___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_6___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_6___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_6___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(1, 585, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_7___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_7___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_7___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_7___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_7___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_7___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_8_items) < 0) __PYX_ERR(1, 607, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_8_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_8_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_8_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_8_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_8_items = &__pyx_type_11colibricore___pyx_scope_struct_8_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_9___iter__) < 0) __PYX_ERR(1, 666, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_9___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_9___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_9___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_9___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_9___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_9___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_10_items) < 0) __PYX_ERR(1, 688, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_10_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_10_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_10_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_10_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_10_items = &__pyx_type_11colibricore___pyx_scope_struct_10_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_11___iter__) < 0) __PYX_ERR(1, 746, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_11___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_11___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_11___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_11___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_11___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_11___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_12_items) < 0) __PYX_ERR(1, 768, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_12_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_12_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_12_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_12_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_12_items = &__pyx_type_11colibricore___pyx_scope_struct_12_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_13___iter__) < 0) __PYX_ERR(1, 825, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_13___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_13___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_13___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_13___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_13___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_13___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_14_items) < 0) __PYX_ERR(1, 847, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_14_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_14_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_14_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_14_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_14_items = &__pyx_type_11colibricore___pyx_scope_struct_14_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_15___iter__) < 0) __PYX_ERR(1, 901, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_15___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_15___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_15___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_15___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_15___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_15___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_16_items) < 0) __PYX_ERR(1, 923, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_16_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_16_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_16_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_16_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_16_items = &__pyx_type_11colibricore___pyx_scope_struct_16_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_17___iter__) < 0) __PYX_ERR(1, 1000, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_17___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_17___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_17___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_17___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_17___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_17___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_18_children) < 0) __PYX_ERR(1, 1013, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_18_children.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_18_children.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_18_children.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_18_children.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_18_children = &__pyx_type_11colibricore___pyx_scope_struct_18_children;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_19_items) < 0) __PYX_ERR(1, 1028, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_19_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_19_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_19_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_19_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_19_items = &__pyx_type_11colibricore___pyx_scope_struct_19_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_20___iter__) < 0) __PYX_ERR(1, 1281, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_20___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_20___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_20___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_20___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_20___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_20___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex) < 0) __PYX_ERR(1, 1496, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_21_getreverseindex = &__pyx_type_11colibricore___pyx_scope_struct_21_getreverseindex;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence) < 0) __PYX_ERR(1, 1520, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence = &__pyx_type_11colibricore___pyx_scope_struct_22_getreverseindex_bysentence;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_23_histogram) < 0) __PYX_ERR(1, 1542, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_23_histogram.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_23_histogram.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_23_histogram.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_23_histogram.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_23_histogram = &__pyx_type_11colibricore___pyx_scope_struct_23_histogram;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_24_filter) < 0) __PYX_ERR(1, 1561, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_24_filter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_24_filter.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_24_filter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_24_filter.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_24_filter = &__pyx_type_11colibricore___pyx_scope_struct_24_filter;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_25___iter__) < 0) __PYX_ERR(1, 1610, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_25___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_25___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_25___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_25___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_25___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_25___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_26_items) < 0) __PYX_ERR(1, 1621, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_26_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_26_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_26_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_26_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_26_items = &__pyx_type_11colibricore___pyx_scope_struct_26_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren) < 0) __PYX_ERR(1, 1683, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_27_getsubchildren = &__pyx_type_11colibricore___pyx_scope_struct_27_getsubchildren;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_28_getsubparents) < 0) __PYX_ERR(1, 1710, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_28_getsubparents.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_28_getsubparents.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_28_getsubparents.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_28_getsubparents.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_28_getsubparents = &__pyx_type_11colibricore___pyx_scope_struct_28_getsubparents;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours) < 0) __PYX_ERR(1, 1736, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_29_getleftneighbours = &__pyx_type_11colibricore___pyx_scope_struct_29_getleftneighbours;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours) < 0) __PYX_ERR(1, 1762, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_30_getrightneighbours = &__pyx_type_11colibricore___pyx_scope_struct_30_getrightneighbours;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent) < 0) __PYX_ERR(1, 1788, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_31_getskipcontent = &__pyx_type_11colibricore___pyx_scope_struct_31_getskipcontent;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_32_gettemplates) < 0) __PYX_ERR(1, 1809, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_32_gettemplates.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_32_gettemplates.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_32_gettemplates.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_32_gettemplates.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_32_gettemplates = &__pyx_type_11colibricore___pyx_scope_struct_32_gettemplates;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_33_getinstances) < 0) __PYX_ERR(1, 1832, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_33_getinstances.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_33_getinstances.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_33_getinstances.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_33_getinstances.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_33_getinstances = &__pyx_type_11colibricore___pyx_scope_struct_33_getinstances;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_34_getcooc) < 0) __PYX_ERR(1, 1855, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_34_getcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_34_getcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_34_getcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_34_getcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_34_getcooc = &__pyx_type_11colibricore___pyx_scope_struct_34_getcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc) < 0) __PYX_ERR(1, 1881, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_35_getleftcooc = &__pyx_type_11colibricore___pyx_scope_struct_35_getleftcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc) < 0) __PYX_ERR(1, 1907, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_36_getrightcooc = &__pyx_type_11colibricore___pyx_scope_struct_36_getrightcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_37___iter__) < 0) __PYX_ERR(1, 2107, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_37___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_37___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_37___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_37___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_37___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_37___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex) < 0) __PYX_ERR(1, 2322, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_38_getreverseindex = &__pyx_type_11colibricore___pyx_scope_struct_38_getreverseindex;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence) < 0) __PYX_ERR(1, 2346, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence = &__pyx_type_11colibricore___pyx_scope_struct_39_getreverseindex_bysentence;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_40_histogram) < 0) __PYX_ERR(1, 2368, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_40_histogram.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_40_histogram.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_40_histogram.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_40_histogram.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_40_histogram = &__pyx_type_11colibricore___pyx_scope_struct_40_histogram;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_41_filter) < 0) __PYX_ERR(1, 2387, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_41_filter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_41_filter.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_41_filter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_41_filter.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_41_filter = &__pyx_type_11colibricore___pyx_scope_struct_41_filter;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_42___iter__) < 0) __PYX_ERR(1, 2436, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_42___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_42___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_42___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_42___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_42___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_42___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_43_items) < 0) __PYX_ERR(1, 2447, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_43_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_43_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_43_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_43_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_43_items = &__pyx_type_11colibricore___pyx_scope_struct_43_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren) < 0) __PYX_ERR(1, 2509, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_44_getsubchildren = &__pyx_type_11colibricore___pyx_scope_struct_44_getsubchildren;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_45_getsubparents) < 0) __PYX_ERR(1, 2536, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_45_getsubparents.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_45_getsubparents.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_45_getsubparents.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_45_getsubparents.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_45_getsubparents = &__pyx_type_11colibricore___pyx_scope_struct_45_getsubparents;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours) < 0) __PYX_ERR(1, 2562, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_46_getleftneighbours = &__pyx_type_11colibricore___pyx_scope_struct_46_getleftneighbours;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours) < 0) __PYX_ERR(1, 2588, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_47_getrightneighbours = &__pyx_type_11colibricore___pyx_scope_struct_47_getrightneighbours;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent) < 0) __PYX_ERR(1, 2614, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_48_getskipcontent = &__pyx_type_11colibricore___pyx_scope_struct_48_getskipcontent;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_49_gettemplates) < 0) __PYX_ERR(1, 2635, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_49_gettemplates.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_49_gettemplates.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_49_gettemplates.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_49_gettemplates.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_49_gettemplates = &__pyx_type_11colibricore___pyx_scope_struct_49_gettemplates;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_50_getinstances) < 0) __PYX_ERR(1, 2658, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_50_getinstances.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_50_getinstances.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_50_getinstances.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_50_getinstances.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_50_getinstances = &__pyx_type_11colibricore___pyx_scope_struct_50_getinstances;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_51_getcooc) < 0) __PYX_ERR(1, 2681, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_51_getcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_51_getcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_51_getcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_51_getcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_51_getcooc = &__pyx_type_11colibricore___pyx_scope_struct_51_getcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc) < 0) __PYX_ERR(1, 2707, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_52_getleftcooc = &__pyx_type_11colibricore___pyx_scope_struct_52_getleftcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc) < 0) __PYX_ERR(1, 2733, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_53_getrightcooc = &__pyx_type_11colibricore___pyx_scope_struct_53_getrightcooc;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_54___iter__) < 0) __PYX_ERR(1, 2793, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_54___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_54___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_54___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_54___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_54___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_54___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_55___iter__) < 0) __PYX_ERR(1, 3034, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_55___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_55___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_55___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_55___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_55___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_55___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex) < 0) __PYX_ERR(1, 3249, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_56_getreverseindex = &__pyx_type_11colibricore___pyx_scope_struct_56_getreverseindex;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence) < 0) __PYX_ERR(1, 3273, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence = &__pyx_type_11colibricore___pyx_scope_struct_57_getreverseindex_bysentence;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_58_histogram) < 0) __PYX_ERR(1, 3295, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_58_histogram.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_58_histogram.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_58_histogram.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_58_histogram.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_58_histogram = &__pyx_type_11colibricore___pyx_scope_struct_58_histogram;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_59_filter) < 0) __PYX_ERR(1, 3314, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_59_filter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_59_filter.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_59_filter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_59_filter.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_59_filter = &__pyx_type_11colibricore___pyx_scope_struct_59_filter;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_60_items) < 0) __PYX_ERR(1, 3342, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_60_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_60_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_60_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_60_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_60_items = &__pyx_type_11colibricore___pyx_scope_struct_60_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_61___iter__) < 0) __PYX_ERR(1, 3531, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_61___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_61___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_61___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_61___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_61___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_61___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex) < 0) __PYX_ERR(1, 3746, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_62_getreverseindex = &__pyx_type_11colibricore___pyx_scope_struct_62_getreverseindex;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence) < 0) __PYX_ERR(1, 3770, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence = &__pyx_type_11colibricore___pyx_scope_struct_63_getreverseindex_bysentence;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_64_histogram) < 0) __PYX_ERR(1, 3792, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_64_histogram.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_64_histogram.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_64_histogram.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_64_histogram.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_64_histogram = &__pyx_type_11colibricore___pyx_scope_struct_64_histogram;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_65_filter) < 0) __PYX_ERR(1, 3811, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_65_filter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_65_filter.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_65_filter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_65_filter.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_65_filter = &__pyx_type_11colibricore___pyx_scope_struct_65_filter;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_66_items) < 0) __PYX_ERR(1, 3839, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_66_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_66_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_66_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_66_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_66_items = &__pyx_type_11colibricore___pyx_scope_struct_66_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_67___iter__) < 0) __PYX_ERR(1, 4046, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_67___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_67___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_67___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_67___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_67___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_67___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_68_items) < 0) __PYX_ERR(1, 4072, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_68_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_68_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_68_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_68_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_68_items = &__pyx_type_11colibricore___pyx_scope_struct_68_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_69_findpattern) < 0) __PYX_ERR(1, 4085, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_69_findpattern.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_69_findpattern.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_69_findpattern.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_69_findpattern.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_69_findpattern = &__pyx_type_11colibricore___pyx_scope_struct_69_findpattern;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_70_sentences) < 0) __PYX_ERR(1, 4132, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_70_sentences.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_70_sentences.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_70_sentences.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_70_sentences.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_70_sentences = &__pyx_type_11colibricore___pyx_scope_struct_70_sentences;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_71___iter__) < 0) __PYX_ERR(1, 4163, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_71___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_71___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_71___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_71___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_71___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_71___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_72_items) < 0) __PYX_ERR(1, 4219, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_72_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_72_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_72_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_72_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_72_items = &__pyx_type_11colibricore___pyx_scope_struct_72_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_73___iter__) < 0) __PYX_ERR(1, 4230, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_73___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_73___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_73___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_73___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_73___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_73___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_74___iter__) < 0) __PYX_ERR(1, 4335, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_74___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_74___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_74___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_74___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_74___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_74___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_75_items) < 0) __PYX_ERR(1, 4415, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_75_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_75_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_75_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_75_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_75_items = &__pyx_type_11colibricore___pyx_scope_struct_75_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_76_triples) < 0) __PYX_ERR(1, 4431, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_76_triples.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_76_triples.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_76_triples.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_76_triples.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_76_triples = &__pyx_type_11colibricore___pyx_scope_struct_76_triples;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_77___iter__) < 0) __PYX_ERR(1, 4565, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_77___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_77___iter__.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_77___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_77___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_77___iter__ = &__pyx_type_11colibricore___pyx_scope_struct_77___iter__;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_78_items) < 0) __PYX_ERR(1, 4634, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_78_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_78_items.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_78_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_78_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_78_items = &__pyx_type_11colibricore___pyx_scope_struct_78_items;
  if (PyType_Ready(&__pyx_type_11colibricore___pyx_scope_struct_79_pairs) < 0) __PYX_ERR(1, 4649, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_11colibricore___pyx_scope_struct_79_pairs.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_11colibricore___pyx_scope_struct_79_pairs.tp_dictoffset && __pyx_type_11colibricore___pyx_scope_struct_79_pairs.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_11colibricore___pyx_scope_struct_79_pairs.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_11colibricore___pyx_scope_struct_79_pairs = &__pyx_type_11colibricore___pyx_scope_struct_79_pairs;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initcolibricore(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initcolibricore(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_colibricore(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_colibricore(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_colibricore(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'colibricore' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_colibricore(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("colibricore", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_colibricore) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "colibricore")) {
      if (unlikely(PyDict_SetItemString(modules, "colibricore", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif

  /* "colibricore_wrapper.pyx":23
 * from libcpp.map cimport map as stdmap
 * from libcpp.utility cimport pair
 * import os.path             # <<<<<<<<<<<<<<
 * from collections import Counter
 * from sys import version
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os_path, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":24
 * from libcpp.utility cimport pair
 * import os.path
 * from collections import Counter             # <<<<<<<<<<<<<<
 * from sys import version
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Counter);
  __Pyx_GIVEREF(__pyx_n_s_Counter);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Counter);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Counter); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Counter, __pyx_t_1) < 0) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "colibricore_wrapper.pyx":25
 * import os.path
 * from collections import Counter
 * from sys import version             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_version);
  __Pyx_GIVEREF(__pyx_n_s_version);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_version);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":30
 * 
 * 
 * def encode(s):             # <<<<<<<<<<<<<<
 *     return s.encode('utf-8')
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11colibricore_1encode, NULL, __pyx_n_s_colibricore); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode, __pyx_t_1) < 0) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":34
 * 
 * 
 * class Category:             # <<<<<<<<<<<<<<
 *     """Pattern Category"""
 *     NGRAM=1
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Category, __pyx_n_s_Category, (PyObject *) NULL, __pyx_n_s_colibricore, __pyx_kp_s_Pattern_Category); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "colibricore_wrapper.pyx":36
 * class Category:
 *     """Pattern Category"""
 *     NGRAM=1             # <<<<<<<<<<<<<<
 *     SKIPGRAM=2
 *     FLEXGRAM=3
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_NGRAM, __pyx_int_1) < 0) __PYX_ERR(1, 36, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":37
 *     """Pattern Category"""
 *     NGRAM=1
 *     SKIPGRAM=2             # <<<<<<<<<<<<<<
 *     FLEXGRAM=3
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_SKIPGRAM, __pyx_int_2) < 0) __PYX_ERR(1, 37, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":38
 *     NGRAM=1
 *     SKIPGRAM=2
 *     FLEXGRAM=3             # <<<<<<<<<<<<<<
 * 
 * cdef class ClassEncoder:
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_FLEXGRAM, __pyx_int_3) < 0) __PYX_ERR(1, 38, __pyx_L1_error)

  /* "colibricore_wrapper.pyx":34
 * 
 * 
 * class Category:             # <<<<<<<<<<<<<<
 *     """Pattern Category"""
 *     NGRAM=1
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Category, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Category, __pyx_t_2) < 0) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":157
 *         return self._filename
 * 
 * def patternfromfile(str filename):             # <<<<<<<<<<<<<<
 *     """Builds a single pattern from corpus data, will ignore any newlines. You may want to use IndexedCorpus instead."""
 *     cdef cPattern cpattern = cpatternfromfile(encode(filename))
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11colibricore_3patternfromfile, NULL, __pyx_n_s_colibricore); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_patternfromfile, __pyx_t_1) < 0) __PYX_ERR(1, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4683
 *         self.data.add(pattern.cpattern,pattern2.cpattern)
 * 
 * UNKPATTERN = Pattern()             # <<<<<<<<<<<<<<
 * UNKPATTERN.bindunk()
 * SKIPPATTERN = Pattern()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNKPATTERN, __pyx_t_1) < 0) __PYX_ERR(1, 4683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4684
 * 
 * UNKPATTERN = Pattern()
 * UNKPATTERN.bindunk()             # <<<<<<<<<<<<<<
 * SKIPPATTERN = Pattern()
 * SKIPPATTERN.bindskip()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_UNKPATTERN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bindunk); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4684, __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;

  /* "colibricore_wrapper.pyx":4685
 * UNKPATTERN = Pattern()
 * UNKPATTERN.bindunk()
 * SKIPPATTERN = Pattern()             # <<<<<<<<<<<<<<
 * SKIPPATTERN.bindskip()
 * FLEXPATTERN = Pattern()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SKIPPATTERN, __pyx_t_1) < 0) __PYX_ERR(1, 4685, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4686
 * UNKPATTERN.bindunk()
 * SKIPPATTERN = Pattern()
 * SKIPPATTERN.bindskip()             # <<<<<<<<<<<<<<
 * FLEXPATTERN = Pattern()
 * FLEXPATTERN.bindflex()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SKIPPATTERN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bindskip); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4686, __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;

  /* "colibricore_wrapper.pyx":4687
 * SKIPPATTERN = Pattern()
 * SKIPPATTERN.bindskip()
 * FLEXPATTERN = Pattern()             # <<<<<<<<<<<<<<
 * FLEXPATTERN.bindflex()
 * BOUNDARYPATTERN = Pattern()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLEXPATTERN, __pyx_t_1) < 0) __PYX_ERR(1, 4687, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4688
 * SKIPPATTERN.bindskip()
 * FLEXPATTERN = Pattern()
 * FLEXPATTERN.bindflex()             # <<<<<<<<<<<<<<
 * BOUNDARYPATTERN = Pattern()
 * BOUNDARYPATTERN.bindboundary()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FLEXPATTERN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bindflex); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4688, __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;

  /* "colibricore_wrapper.pyx":4689
 * FLEXPATTERN = Pattern()
 * FLEXPATTERN.bindflex()
 * BOUNDARYPATTERN = Pattern()             # <<<<<<<<<<<<<<
 * BOUNDARYPATTERN.bindboundary()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_11colibricore_Pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BOUNDARYPATTERN, __pyx_t_1) < 0) __PYX_ERR(1, 4689, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "colibricore_wrapper.pyx":4690
 * FLEXPATTERN.bindflex()
 * BOUNDARYPATTERN = Pattern()
 * BOUNDARYPATTERN.bindboundary()             # <<<<<<<<<<<<<<
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BOUNDARYPATTERN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bindboundary); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4690, __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;

  /* "colibricore_wrapper.pyx":1
 * #embedsignature=True             # <<<<<<<<<<<<<<
 * #*****************************
 * # Colibri Core
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init colibricore", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init colibricore");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseArgTupleInvalid */
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,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG)
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* decode_c_bytes */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        stop = length;
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_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
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_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_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
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);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#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);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    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);
    *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;
}

/* dict_iter */
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 (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED 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;
}

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* PyObjectGetAttrStrNoError */
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint32_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint32_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
                            return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
                            return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
                            return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (uint32_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint32_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint32_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint32_t) -1;
        }
    } else {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyInt_As_uint32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint32_t");
    return (uint32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint32_t");
    return (uint32_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint16_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint16_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, 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 (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)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 = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_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;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(void) {
    char ctversion[5];
    int same=1, i, found_dot;
    const char* rt_from_call = Py_GetVersion();
    PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    found_dot = 0;
    for (i = 0; i < 4; i++) {
        if (!ctversion[i]) {
            same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
            break;
        }
        if (rt_from_call[i] != ctversion[i]) {
            same = 0;
            break;
        }
    }
    if (!same) {
        char rtversion[5] = {'\0'};
        char message[200];
        for (i=0; i<4; ++i) {
            if (rt_from_call[i] == '.') {
                if (found_dot) break;
                found_dot = 1;
            } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
                break;
            }
            rtversion[i] = rt_from_call[i];
        }
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
