<commit_before>import numpy as np
cimport numpy as np
cimport cython


DTYPE = np.int
ctypedef np.int_t DTYPE_INT_t


@cython.boundscheck(False)
cpdef _add_to_stack(DTYPE_INT_t l, DTYPE_INT_t j,
                    np.ndarray[DTYPE_INT_t, ndim=1] s,
                    np.ndarray[DTYPE_INT_t, ndim=1] delta,
                    np.ndarray[DTYPE_INT_t, ndim=1] donors):

    """
    Adds node l to the stack and increments the current index (j).
    """
    cdef int m, n, delta_l, delta_lplus1

    s[j] = l
    j += 1
    delta_l = delta[l]
    delta_lplus1 = delta[l+1]

    for n in range(delta_l, delta_lplus1):
        m = donors[n]
        if m != l:
            j = _add_to_stack(m, j, s, delta, donors)

    return j

@cython.boundscheck(False)
cpdef _add_to_stack_route_N(DTYPE_INT_t l, DTYPE_INT_t j,
                        np.ndarray[DTYPE_INT_t, ndim=1] s,
                        np.ndarray[DTYPE_INT_t, ndim=1] delta,
                        np.ndarray[DTYPE_INT_t, ndim=1] donors,
                        np.ndarray[DTYPE_INT_t, ndim=1] lastIndex):

        """
        Adds node l to the stack and increments the current index (j).
        Keeps track of last index used for each node for route-to-N
        functionality
        """
        cdef int m, n, delta_l, delta_lplus1

        s[j] = l
        lastIndex[l] = j
        j += 1
        delta_l = delta[l]
        delta_lplus1 = delta[l+1]

        for n in range(delta_l, delta_lplus1):
            m = donors[n]
            if m != l:
                j = _add_to_stack(m, j, s, delta, donors, lastIndex)

        return j<commit_msg>Going to attempt modifying this to use sets and where instead of the B&W2013 style recursion. Start by removing the new cfuncs code<commit_after>import numpy as np
cimport numpy as np
cimport cython


DTYPE = np.int
ctypedef np.int_t DTYPE_INT_t


@cython.boundscheck(False)
cpdef _add_to_stack(DTYPE_INT_t l, DTYPE_INT_t j,
                    np.ndarray[DTYPE_INT_t, ndim=1] s,
                    np.ndarray[DTYPE_INT_t, ndim=1] delta,
                    np.ndarray[DTYPE_INT_t, ndim=1] donors):

    """
    Adds node l to the stack and increments the current index (j).
    """
    cdef int m, n, delta_l, delta_lplus1

    s[j] = l
    j += 1
    delta_l = delta[l]
    delta_lplus1 = delta[l+1]

    for n in range(delta_l, delta_lplus1):
        m = donors[n]
        if m != l:
            j = _add_to_stack(m, j, s, delta, donors)

    return j
{'fraction_non_alphanumeric': 0.09205190592051905, 'fraction_numerical': 0.011759935117599351, 'mean_word_length': 2.0232843137254903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3819178', 'n_tokens_mistral': 935, 'n_tokens_neox': 888, 'n_words': 246}