spacy-101 vocab doc giving valid variable names (#2236)

This commit is contained in:
Pradeep Kumar Tippa 2018-04-19 03:24:26 +05:30 committed by Ines Montani
parent b4d35c7dfb
commit df389e5b74
1 changed files with 3 additions and 3 deletions

View File

@ -96,13 +96,13 @@ p
assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍 assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
empty_doc = Doc(Vocab()) # new Doc with empty Vocab empty_doc = Doc(Vocab()) # new Doc with empty Vocab
# doc.vocab.strings[3197928453018144401] will raise an error :( # empty_doc.vocab.strings[3197928453018144401] will raise an error :(
empty_doc.vocab.strings.add(u'coffee') # add "coffee" and generate hash empty_doc.vocab.strings.add(u'coffee') # add "coffee" and generate hash
assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍 assert empty_doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
new_doc = Doc(doc.vocab) # create new doc with first doc's vocab new_doc = Doc(doc.vocab) # create new doc with first doc's vocab
assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍 assert new_doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
p p
| If the vocabulary doesn't contain a string for #[code 3197928453018144401], | If the vocabulary doesn't contain a string for #[code 3197928453018144401],