mirror of
https://github.com/explosion/spaCy.git
synced 2024-09-23 20:39:20 +03:00
Fix node matching bug caused by lower function
This commit is contained in:
parent
4ca8a396a2
commit
d010f5a123
|
@ -282,10 +282,6 @@ def match_token(token,
|
||||||
'lemma': lambda t: t.lemma_,
|
'lemma': lambda t: t.lemma_,
|
||||||
}
|
}
|
||||||
|
|
||||||
if lower:
|
|
||||||
bind_map = {key: lambda t: func(t).lower() for key, func in
|
|
||||||
bind_map.items()}
|
|
||||||
|
|
||||||
for target_key, target_value in target_attributes.items():
|
for target_key, target_value in target_attributes.items():
|
||||||
is_special_key = target_key[0] == '_'
|
is_special_key = target_key[0] == '_'
|
||||||
|
|
||||||
|
@ -298,6 +294,9 @@ def match_token(token,
|
||||||
if target_key in bind_map:
|
if target_key in bind_map:
|
||||||
token_attr = bind_map[target_key](token)
|
token_attr = bind_map[target_key](token)
|
||||||
|
|
||||||
|
if lower:
|
||||||
|
token_attr = token_attr.lower()
|
||||||
|
|
||||||
if hasattr(target_value, 'match'): # if it is a compiled regex
|
if hasattr(target_value, 'match'): # if it is a compiled regex
|
||||||
if target_value.match(token_attr) is None:
|
if target_value.match(token_attr) is None:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue
Block a user