From 1fa6ba8130212fa3b9e32e51fada7807815fd95d Mon Sep 17 00:00:00 2001 From: ines Date: Wed, 3 Jan 2018 16:59:38 +0100 Subject: [PATCH] Fix Doc.from_array example to make it work (see #1527) --- website/api/doc.jade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/api/doc.jade b/website/api/doc.jade index ac91ad427..fd2fc34ef 100644 --- a/website/api/doc.jade +++ b/website/api/doc.jade @@ -401,11 +401,11 @@ p +aside-code("Example"). from spacy.attrs import LOWER, POS, ENT_TYPE, IS_ALPHA from spacy.tokens import Doc - doc = nlp(text) + doc = nlp("Hello world!") np_array = doc.to_array([LOWER, POS, ENT_TYPE, IS_ALPHA]) - doc2 = Doc(doc.vocab) + doc2 = Doc(doc.vocab, words=[t.text for t in doc]) doc2.from_array([LOWER, POS, ENT_TYPE, IS_ALPHA], np_array) - assert doc.text == doc2.text + assert doc[0].pos_ == doc2[0].pos_ +table(["Name", "Type", "Description"]) +row