2020-01-24 00:01:54 +03:00
|
|
|
cimport numpy as np
|
2023-06-14 18:48:41 +03:00
|
|
|
from cymem.cymem cimport Pool
|
2021-04-26 17:54:23 +03:00
|
|
|
from libc.stdint cimport uint64_t
|
2023-06-14 18:48:41 +03:00
|
|
|
from preshed.maps cimport PreshMap
|
2015-08-28 03:02:33 +03:00
|
|
|
|
2015-08-27 10:16:11 +03:00
|
|
|
from .strings cimport StringStore
|
2023-06-14 18:48:41 +03:00
|
|
|
from .structs cimport MorphAnalysisC
|
2021-04-26 17:54:23 +03:00
|
|
|
from .typedefs cimport attr_t, hash_t
|
2015-08-28 03:02:33 +03:00
|
|
|
|
2020-03-02 13:48:10 +03:00
|
|
|
|
2015-08-26 20:17:35 +03:00
|
|
|
cdef class Morphology:
|
2015-08-28 03:02:33 +03:00
|
|
|
cdef readonly Pool mem
|
2015-08-28 04:44:54 +03:00
|
|
|
cdef readonly StringStore strings
|
2023-07-19 13:03:31 +03:00
|
|
|
cdef PreshMap tags # Keyed by hash, value is pointer to tag
|
2020-03-02 13:48:10 +03:00
|
|
|
|
2020-01-24 00:01:54 +03:00
|
|
|
cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except *
|
|
|
|
cdef int insert(self, MorphAnalysisC tag) except -1
|
2020-03-02 13:48:10 +03:00
|
|
|
|
2019-03-07 20:33:06 +03:00
|
|
|
|
2020-01-24 00:01:54 +03:00
|
|
|
cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil
|
|
|
|
cdef list list_features(const MorphAnalysisC* morph)
|
|
|
|
cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field)
|
2023-07-19 13:03:31 +03:00
|
|
|
cdef int get_n_by_field(
|
|
|
|
attr_t* results,
|
|
|
|
const MorphAnalysisC* morph,
|
|
|
|
attr_t field,
|
|
|
|
) nogil
|