<commit_before># Cython imports
from libcpp.map cimport map as cpp_map
from libcpp.set cimport set as cpp_set
from libcpp.vector cimport vector as cpp_vector
from cython.operator cimport dereference as deref
from cython.operator cimport preincrement as inc

# Python Imports
#cimport collections
import collections

cimport numpy as np
import numpy as np

# Local imports
cimport std


#
# Map conversions
#

# <int, int> conversions
cdef cpp_map[int, int] dict_to_map_int_int(dict)
cdef dict map_to_dict_int_int(cpp_map[int, int])

# <int, double> conversions
cdef cpp_map[int, double] dict_to_map_int_dbl(dict)
cdef dict map_to_dict_int_dbl(cpp_map[int, double])

# <string, int> conversions
cdef cpp_map[std.string, int] dict_to_map_str_int(dict)
cdef dict map_to_dict_str_int(cpp_map[std.string, int])

# <int, string> conversions
cdef cpp_map[int, std.string] dict_to_map_int_str(dict)
cdef dict map_to_dict_int_str(cpp_map[int, std.string])

# <string, double> conversions
cdef cpp_map[std.string, double] dict_to_map_str_dbl(dict)
cdef dict map_to_dict_str_dbl(cpp_map[std.string, double])


#
# Set conversions
#

# Integer sets
cdef cpp_set[int] py_to_cpp_set_int(set)
cdef set cpp_to_py_set_int(cpp_set[int])

# String sets
cdef cpp_set[std.string] py_to_cpp_set_str(set)
cdef set cpp_to_py_set_str(cpp_set[std.string])


#
# Vector conversions
#

# 1D Float arrays
cdef cpp_vector[double] array_to_vector_1d_dbl(np.ndarray[np.float64_t, ndim=1])
cdef np.ndarray[np.float64_t, ndim=1] vector_to_array_1d_dbl(cpp_vector[double])


# 1D Integer arrays
cdef cpp_vector[int] array_to_vector_1d_int(np.ndarray[np.int32_t, ndim=1])
cdef np.ndarray[np.int32_t, ndim=1] vector_to_array_1d_int(cpp_vector[int])


# 2D Float arrays
cdef cpp_vector[cpp_vector[double]] array_to_vector_2d_dbl(np.ndarray[np.float64_t, ndim=2])
cdef np.ndarray[np.float64_t, ndim=2] vector_to_array_2d_dbl(cpp_vector[cpp_vector[double]])


# 3D Float arrays
cdef cpp_vector[cpp_vector[cpp_vector[double]]] array_to_vector_3d_dbl(np.ndarray[np.float64_t, ndim=3])
cdef np.ndarray[np.float64_t, ndim=3] vector_to_array_3d_dbl(cpp_vector[cpp_vector[cpp_vector[double]]])



#
# Map-Vector Conversions
#

# {int: np.array()} 
cdef cpp_map[int, cpp_vector[double]] dict_to_map_int_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_1d_dbl(cpp_map[int, cpp_vector[double]])

cdef cpp_map[int, cpp_vector[cpp_vector[double]]] dict_to_map_int_array_to_vector_2d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_2d_dbl(cpp_map[int, cpp_vector[cpp_vector[double]]])

cdef cpp_map[int, cpp_vector[cpp_vector[cpp_vector[double]]]] dict_to_map_int_array_to_vector_3d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_3d_dbl(cpp_map[int, cpp_vector[cpp_vector[cpp_vector[double]]]])

# {string: np.array()} 
cdef cpp_map[std.string, cpp_vector[double]] dict_to_map_str_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_str_vector_to_array_1d_dbl(cpp_map[std.string, cpp_vector[double]])


#
# Map-Map-Vector Conversions
#


# {int: {int: np.array()}}
cdef cpp_map[int, cpp_map[int, cpp_vector[double]]] dict_to_map_int_int_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_int_int_vector_to_array_1d_dbl(cpp_map[int, cpp_map[int, cpp_vector[double]]])


#
# Proxy Classes
#

# These classes have to be declared individually
# because Cython does not yet support templating 
# metaprogramming.

#
# --- Sets
#

# Int
cdef class SetIterInt(object):
    cdef cpp_set[int].iterator * iter_now
    cdef cpp_set[int].iterator * iter_end
    cdef void init(SetIterInt, cpp_set[int] *)

cdef class _SetProxyInt:
    cdef cpp_set[int] * set_ptr
    cdef void init(_SetProxyInt, cpp_set[int] *)


# Str
cdef class SetIterStr(object):
    cdef cpp_set[std.string].iterator * iter_now
    cdef cpp_set[std.string].iterator * iter_end
    cdef void init(SetIterStr, cpp_set[std.string] *)

cdef class _SetProxyStr:
    cdef cpp_set[std.string] * set_ptr
    cdef void init(_SetProxyStr, cpp_set[std.string] *)


#
# --- Maps
#

# (Str, Int)
cdef class MapIterStrInt(object):
    cdef cpp_map[std.string, int].iterator * iter_now
    cdef cpp_map[std.string, int].iterator * iter_end
    cdef void init(MapIterStrInt, cpp_map[std.string, int] *)

cdef class _MapProxyStrInt:
    cdef cpp_map[std.string, int] * map_ptr
    cdef void init(_MapProxyStrInt, cpp_map[std.string, int] *)


# (Int, Str)
cdef class MapIterIntStr(object):
    cdef cpp_map[int, std.string].iterator * iter_now
    cdef cpp_map[int, std.string].iterator * iter_end
    cdef void init(MapIterIntStr, cpp_map[int, std.string] *)

cdef class _MapProxyIntStr:
    cdef cpp_map[int, std.string] * map_ptr
    cdef void init(_MapProxyIntStr, cpp_map[int, std.string] *)



# (Int, Double)
cdef class MapIterIntDouble(object):
    cdef cpp_map[int, double].iterator * iter_now
    cdef cpp_map[int, double].iterator * iter_end
    cdef void init(MapIterIntDouble, cpp_map[int, double] *)

cdef class _MapProxyIntDouble:
    cdef cpp_map[int, Double] * map_ptr
    cdef void init(_MapProxyIntDouble, cpp_map[int, double] *)

<commit_msg>Fixed stupid Double -> double typo.<commit_after># Cython imports
from libcpp.map cimport map as cpp_map
from libcpp.set cimport set as cpp_set
from libcpp.vector cimport vector as cpp_vector
from cython.operator cimport dereference as deref
from cython.operator cimport preincrement as inc

# Python Imports
#cimport collections
import collections

cimport numpy as np
import numpy as np

# Local imports
cimport std


#
# Map conversions
#

# <int, int> conversions
cdef cpp_map[int, int] dict_to_map_int_int(dict)
cdef dict map_to_dict_int_int(cpp_map[int, int])

# <int, double> conversions
cdef cpp_map[int, double] dict_to_map_int_dbl(dict)
cdef dict map_to_dict_int_dbl(cpp_map[int, double])

# <string, int> conversions
cdef cpp_map[std.string, int] dict_to_map_str_int(dict)
cdef dict map_to_dict_str_int(cpp_map[std.string, int])

# <int, string> conversions
cdef cpp_map[int, std.string] dict_to_map_int_str(dict)
cdef dict map_to_dict_int_str(cpp_map[int, std.string])

# <string, double> conversions
cdef cpp_map[std.string, double] dict_to_map_str_dbl(dict)
cdef dict map_to_dict_str_dbl(cpp_map[std.string, double])


#
# Set conversions
#

# Integer sets
cdef cpp_set[int] py_to_cpp_set_int(set)
cdef set cpp_to_py_set_int(cpp_set[int])

# String sets
cdef cpp_set[std.string] py_to_cpp_set_str(set)
cdef set cpp_to_py_set_str(cpp_set[std.string])


#
# Vector conversions
#

# 1D Float arrays
cdef cpp_vector[double] array_to_vector_1d_dbl(np.ndarray[np.float64_t, ndim=1])
cdef np.ndarray[np.float64_t, ndim=1] vector_to_array_1d_dbl(cpp_vector[double])


# 1D Integer arrays
cdef cpp_vector[int] array_to_vector_1d_int(np.ndarray[np.int32_t, ndim=1])
cdef np.ndarray[np.int32_t, ndim=1] vector_to_array_1d_int(cpp_vector[int])


# 2D Float arrays
cdef cpp_vector[cpp_vector[double]] array_to_vector_2d_dbl(np.ndarray[np.float64_t, ndim=2])
cdef np.ndarray[np.float64_t, ndim=2] vector_to_array_2d_dbl(cpp_vector[cpp_vector[double]])


# 3D Float arrays
cdef cpp_vector[cpp_vector[cpp_vector[double]]] array_to_vector_3d_dbl(np.ndarray[np.float64_t, ndim=3])
cdef np.ndarray[np.float64_t, ndim=3] vector_to_array_3d_dbl(cpp_vector[cpp_vector[cpp_vector[double]]])



#
# Map-Vector Conversions
#

# {int: np.array()} 
cdef cpp_map[int, cpp_vector[double]] dict_to_map_int_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_1d_dbl(cpp_map[int, cpp_vector[double]])

cdef cpp_map[int, cpp_vector[cpp_vector[double]]] dict_to_map_int_array_to_vector_2d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_2d_dbl(cpp_map[int, cpp_vector[cpp_vector[double]]])

cdef cpp_map[int, cpp_vector[cpp_vector[cpp_vector[double]]]] dict_to_map_int_array_to_vector_3d_dbl(dict)
cdef dict map_to_dict_int_vector_to_array_3d_dbl(cpp_map[int, cpp_vector[cpp_vector[cpp_vector[double]]]])

# {string: np.array()} 
cdef cpp_map[std.string, cpp_vector[double]] dict_to_map_str_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_str_vector_to_array_1d_dbl(cpp_map[std.string, cpp_vector[double]])


#
# Map-Map-Vector Conversions
#


# {int: {int: np.array()}}
cdef cpp_map[int, cpp_map[int, cpp_vector[double]]] dict_to_map_int_int_array_to_vector_1d_dbl(dict)
cdef dict map_to_dict_int_int_vector_to_array_1d_dbl(cpp_map[int, cpp_map[int, cpp_vector[double]]])


#
# Proxy Classes
#

# These classes have to be declared individually
# because Cython does not yet support templating 
# metaprogramming.

#
# --- Sets
#

# Int
cdef class SetIterInt(object):
    cdef cpp_set[int].iterator * iter_now
    cdef cpp_set[int].iterator * iter_end
    cdef void init(SetIterInt, cpp_set[int] *)

cdef class _SetProxyInt:
    cdef cpp_set[int] * set_ptr
    cdef void init(_SetProxyInt, cpp_set[int] *)


# Str
cdef class SetIterStr(object):
    cdef cpp_set[std.string].iterator * iter_now
    cdef cpp_set[std.string].iterator * iter_end
    cdef void init(SetIterStr, cpp_set[std.string] *)

cdef class _SetProxyStr:
    cdef cpp_set[std.string] * set_ptr
    cdef void init(_SetProxyStr, cpp_set[std.string] *)


#
# --- Maps
#

# (Str, Int)
cdef class MapIterStrInt(object):
    cdef cpp_map[std.string, int].iterator * iter_now
    cdef cpp_map[std.string, int].iterator * iter_end
    cdef void init(MapIterStrInt, cpp_map[std.string, int] *)

cdef class _MapProxyStrInt:
    cdef cpp_map[std.string, int] * map_ptr
    cdef void init(_MapProxyStrInt, cpp_map[std.string, int] *)


# (Int, Str)
cdef class MapIterIntStr(object):
    cdef cpp_map[int, std.string].iterator * iter_now
    cdef cpp_map[int, std.string].iterator * iter_end
    cdef void init(MapIterIntStr, cpp_map[int, std.string] *)

cdef class _MapProxyIntStr:
    cdef cpp_map[int, std.string] * map_ptr
    cdef void init(_MapProxyIntStr, cpp_map[int, std.string] *)



# (Int, Double)
cdef class MapIterIntDouble(object):
    cdef cpp_map[int, double].iterator * iter_now
    cdef cpp_map[int, double].iterator * iter_end
    cdef void init(MapIterIntDouble, cpp_map[int, double] *)

cdef class _MapProxyIntDouble:
    cdef cpp_map[int, double] * map_ptr
    cdef void init(_MapProxyIntDouble, cpp_map[int, double] *)


{'fraction_non_alphanumeric': 0.10512367491166077, 'fraction_numerical': 0.009030231645072634, 'mean_word_length': 6.404796511627907, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3686879', 'n_tokens_mistral': 4239, 'n_tokens_neox': 4173, 'n_words': 768}