Clarify vocab docs (#13273)

* add line to ensure that apple is in fact in the vocab

* add that the vocab may be empty
This commit is contained in:
Sofie Van Landeghem 2024-01-26 10:58:48 +01:00 committed by GitHub
parent a493981163
commit 7496e03a2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ between `Doc` objects.
<Infobox variant ="warning">
Note that a `Vocab` instance is not static. It increases in size as texts with
new tokens are processed.
new tokens are processed. Some models may have an empty vocab at initialization.
</Infobox>
@ -93,6 +93,7 @@ given string, you need to look it up in
> #### Example
>
> ```python
> nlp("I'm eating an apple")
> apple = nlp.vocab.strings["apple"]
> oov = nlp.vocab.strings["dskfodkfos"]
> assert apple in nlp.vocab