Fix code sample for span.set_extension (#2286)

This commit is contained in:
Alex Villarreal 2018-05-02 17:39:22 -05:00 committed by Ines Montani
parent 13d562e1a4
commit 647f2544c5

View File

@ -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