mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-19 13:00:35 +03:00
Restructure imports to export find_matches
This commit is contained in:
parent
3c6f1d7e3a
commit
7862a6eb01
|
@ -1,4 +1,26 @@
|
||||||
from preshed.maps cimport key_t
|
from libcpp.vector cimport vector
|
||||||
|
|
||||||
|
from cymem.cymem cimport Pool
|
||||||
|
from preshed.maps cimport key_t, MapStruct
|
||||||
|
|
||||||
|
from ..attrs cimport attr_id_t
|
||||||
|
from ..tokens.doc cimport Doc
|
||||||
|
from ..vocab cimport Vocab
|
||||||
|
|
||||||
|
|
||||||
|
cdef class PhraseMatcher:
|
||||||
|
cdef Vocab vocab
|
||||||
|
cdef attr_id_t attr
|
||||||
|
cdef object _callbacks
|
||||||
|
cdef object _keywords
|
||||||
|
cdef object _docs
|
||||||
|
cdef bint _validate
|
||||||
|
cdef MapStruct* c_map
|
||||||
|
cdef Pool mem
|
||||||
|
cdef key_t _terminal_hash
|
||||||
|
|
||||||
|
cdef void find_matches(self, Doc doc, vector[MatchStruct] *matches) nogil
|
||||||
|
|
||||||
|
|
||||||
cdef struct MatchStruct:
|
cdef struct MatchStruct:
|
||||||
key_t match_id
|
key_t match_id
|
||||||
|
|
|
@ -3,19 +3,12 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from libc.stdint cimport uintptr_t
|
from libc.stdint cimport uintptr_t
|
||||||
from libc.stdio cimport printf
|
|
||||||
from libcpp.vector cimport vector
|
|
||||||
|
|
||||||
from cymem.cymem cimport Pool
|
from preshed.maps cimport map_init, map_set, map_get, map_clear, map_iter
|
||||||
|
|
||||||
from preshed.maps cimport MapStruct, map_init, map_set, map_get, map_clear
|
from ..attrs cimport ORTH, POS, TAG, DEP, LEMMA
|
||||||
from preshed.maps cimport map_iter, key_t
|
|
||||||
|
|
||||||
from ..attrs cimport ORTH, POS, TAG, DEP, LEMMA, attr_id_t
|
|
||||||
from ..vocab cimport Vocab
|
|
||||||
from ..structs cimport TokenC
|
from ..structs cimport TokenC
|
||||||
from ..tokens.token cimport Token
|
from ..tokens.token cimport Token
|
||||||
from ..tokens.doc cimport Doc, get_token_attr
|
|
||||||
|
|
||||||
from ._schemas import TOKEN_PATTERN_SCHEMA
|
from ._schemas import TOKEN_PATTERN_SCHEMA
|
||||||
from ..errors import Errors, Warnings, deprecation_warning, user_warning
|
from ..errors import Errors, Warnings, deprecation_warning, user_warning
|
||||||
|
@ -33,18 +26,6 @@ cdef class PhraseMatcher:
|
||||||
MIT License (see `LICENSE`)
|
MIT License (see `LICENSE`)
|
||||||
Copyright (c) 2017 Vikash Singh (vikash.duliajan@gmail.com)
|
Copyright (c) 2017 Vikash Singh (vikash.duliajan@gmail.com)
|
||||||
"""
|
"""
|
||||||
cdef Vocab vocab
|
|
||||||
cdef attr_id_t attr
|
|
||||||
cdef object _callbacks
|
|
||||||
cdef object _keywords
|
|
||||||
cdef object _docs
|
|
||||||
cdef bint _validate
|
|
||||||
|
|
||||||
cdef MapStruct* c_map
|
|
||||||
cdef Pool mem
|
|
||||||
cdef key_t _terminal_hash
|
|
||||||
|
|
||||||
cdef void find_matches(self, Doc doc, vector[MatchStruct] *matches) nogil
|
|
||||||
|
|
||||||
def __init__(self, Vocab vocab, max_length=0, attr="ORTH", validate=False):
|
def __init__(self, Vocab vocab, max_length=0, attr="ORTH", validate=False):
|
||||||
"""Initialize the PhraseMatcher.
|
"""Initialize the PhraseMatcher.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user