mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-01 19:53:06 +03:00
* Fix open apostrophe bug
This commit is contained in:
parent
bc6c1f6156
commit
87bf205b82
|
@ -36,7 +36,8 @@ cdef class English(spacy.Language):
|
||||||
cdef bint is_punct(unicode word, size_t i, size_t length):
|
cdef bint is_punct(unicode word, size_t i, size_t length):
|
||||||
# Don't count appostrophes as punct if the next char is a letter
|
# Don't count appostrophes as punct if the next char is a letter
|
||||||
if word[i] == "'" and i < (length - 1) and word[i+1].isalpha():
|
if word[i] == "'" and i < (length - 1) and word[i+1].isalpha():
|
||||||
return False
|
# ...Unless we're at 0
|
||||||
|
return i == 0
|
||||||
# Don't count commas as punct if the next char is a number
|
# Don't count commas as punct if the next char is a number
|
||||||
if word[i] == "," and i < (length - 1) and word[i+1].isdigit():
|
if word[i] == "," and i < (length - 1) and word[i+1].isdigit():
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user