mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-05 04:40:20 +03:00
fixed pizza example
This commit is contained in:
parent
90e2059200
commit
fc0780600e
|
@ -62,13 +62,13 @@ a convenient API:
|
||||||
>>> from spacy.en import English
|
>>> from spacy.en import English
|
||||||
>>> nlp = English()
|
>>> nlp = English()
|
||||||
>>> tokens = nlp(u'I ate the pizza with anchovies.')
|
>>> tokens = nlp(u'I ate the pizza with anchovies.')
|
||||||
>>> pizza = tokens[3]
|
>>> ate = tokens[1]
|
||||||
>>> (pizza.orth, pizza.orth_, pizza.head.lemma, pizza.head.lemma_)
|
>>> (ate.orth, ate.orth_, ate.head.lemma, ate.head.lemma_)
|
||||||
... (14702, u'pizza', 14702, u'eat')
|
... (216, u'ate', 669, u'eat')
|
||||||
|
|
||||||
spaCy maps all strings to sequential integer IDs --- a common trick in NLP.
|
spaCy maps all strings to sequential integer IDs --- a common trick in NLP.
|
||||||
If an attribute `Token.foo` is an integer ID, then `Token.foo_` is the string,
|
If an attribute `Token.foo` is an integer ID, then `Token.foo_` is the string,
|
||||||
e.g. `pizza.orth` and `pizza.orth_` provide the integer ID and the string of
|
e.g. `ate.orth` and `ate.orth_` provide the integer ID and the string of
|
||||||
the original orthographic form of the word.
|
the original orthographic form of the word.
|
||||||
|
|
||||||
.. note:: en.English.__call__ is stateful --- it has an important **side-effect**.
|
.. note:: en.English.__call__ is stateful --- it has an important **side-effect**.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user