mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Fix code sample for span.set_extension (#2286)
This commit is contained in:
parent
13d562e1a4
commit
647f2544c5
|
@ -127,7 +127,7 @@ p
|
|||
|
||||
+aside-code("Example").
|
||||
from spacy.tokens import Span
|
||||
city_getter = lambda span: span.text in ('New York', 'Paris', 'Berlin')
|
||||
city_getter = lambda span: any(city in span.text for city in ('New York', 'Paris', 'Berlin'))
|
||||
Span.set_extension('has_city', getter=city_getter)
|
||||
doc = nlp(u'I like New York in Autumn')
|
||||
assert doc[1:4]._.has_city
|
||||
|
|
Loading…
Reference in New Issue
Block a user