<commit_before>from libcpp cimport bool
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref, preincrement as inc

from atomspace cimport *

# @todo use the guide here to separate out into a hierarchy
# http://wiki.cython.org/PackageHierarchy

cdef api string get_path_as_string() with gil:
    import sys
    return str(sys.path).encode('UTF-8')

cdef convert_handle_seq_to_python_list(vector[cHandle] handles, AtomSpace atomspace):
    cdef vector[cHandle].iterator handle_iter
    cdef cHandle handle
    result = []
    handle_iter = handles.begin()
    while handle_iter != handles.end():
        handle = deref(handle_iter)
        result.append(Atom.createAtom(handle, atomspace))
        inc(handle_iter)
    return result

cdef AtomSpace_factory(cAtomSpace *to_wrap):
    cdef AtomSpace instance = AtomSpace.__new__(AtomSpace)
    instance.atomspace = to_wrap
    # print "Debug: atomspace factory={0:x}".format(<long unsigned int>to_wrap)<commit_msg>Return correct Atom class for outgoing and incoming set<commit_after>from libcpp cimport bool
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref, preincrement as inc

from atomspace cimport *

# @todo use the guide here to separate out into a hierarchy
# http://wiki.cython.org/PackageHierarchy

cdef api string get_path_as_string() with gil:
    import sys
    return str(sys.path).encode('UTF-8')

cdef convert_handle_seq_to_python_list(vector[cHandle] handles, AtomSpace atomspace):
    cdef vector[cHandle].iterator handle_iter
    cdef cHandle handle
    result = []
    handle_iter = handles.begin()
    while handle_iter != handles.end():
        handle = deref(handle_iter)
        value = create_value_by_type(handle.get().get_type(),
                                    PtrHolder.create(<shared_ptr[void]&>handle),
                                    atomspace)
        result.append(value)
        inc(handle_iter)
    return result

cdef AtomSpace_factory(cAtomSpace *to_wrap):
    cdef AtomSpace instance = AtomSpace.__new__(AtomSpace)
    instance.atomspace = to_wrap
    # print "Debug: atomspace factory={0:x}".format(<long unsigned int>to_wrap)
{'fraction_non_alphanumeric': 0.08466819221967964, 'fraction_numerical': 0.0018306636155606408, 'mean_word_length': 3.762527233115468, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3215901', 'n_tokens_mistral': 667, 'n_tokens_neox': 658, 'n_words': 172}