mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
spacy-101 vocab doc giving valid variable names (#2236)
This commit is contained in:
parent
b4d35c7dfb
commit
df389e5b74
|
@ -96,13 +96,13 @@ p
|
|||
assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
|
||||
|
||||
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
|
||||
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
|
||||
assert doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
|
||||
assert new_doc.vocab.strings[3197928453018144401] == u'coffee' # 👍
|
||||
|
||||
p
|
||||
| If the vocabulary doesn't contain a string for #[code 3197928453018144401],
|
||||
|
|
Loading…
Reference in New Issue
Block a user