mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
* More slight cleaning for lang.pyx
This commit is contained in:
parent
3d82ed1e5e
commit
ff79dbac2e
|
@ -176,18 +176,12 @@ cdef class Language:
|
|||
cdef int _find_prefix(self, Py_UNICODE* chars, size_t length) except -1:
|
||||
cdef unicode string = chars[:length]
|
||||
match = self.prefix_re.search(string)
|
||||
if match is None:
|
||||
return 0
|
||||
else:
|
||||
return match.end() - match.start()
|
||||
return (match.end() - match.start()) if match is not None else 0
|
||||
|
||||
cdef int _find_suffix(self, Py_UNICODE* chars, size_t length):
|
||||
cdef unicode string = chars[:length]
|
||||
match = self.suffix_re.search(string)
|
||||
if match is None:
|
||||
return 0
|
||||
else:
|
||||
return match.end() - match.start()
|
||||
return (match.end() - match.start()) if match is not None else 0
|
||||
|
||||
def _load_special_tokenization(self, token_rules):
|
||||
'''Load special-case tokenization rules.
|
||||
|
|
Loading…
Reference in New Issue
Block a user