From e237b69247d06dfdba5b9cc73b60f91b88d7e42e Mon Sep 17 00:00:00 2001 From: MatthieuBizien Date: Sun, 25 Jan 2015 19:30:50 +0100 Subject: [PATCH] Bug fix on the documentation --- docs/source/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index bc56581a4..9d26ac0ab 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -78,7 +78,7 @@ particularly egregious: >>> nlp = spacy.en.English() >>> tokens = nlp("‘Give it back,’ he pleaded abjectly, ‘it’s mine.’", tag=True, parse=False) - >>> print(''.join(tok.string.upper() if tok.pos == ADV else tok.string) for t in tokens) + >>> print(''.join(tok.string.upper() if tok.pos == ADV else tok.string for tok in tokens)) ‘Give it BACK,’ he pleaded ABJECTLY, ‘it’s mine.’ @@ -144,7 +144,7 @@ cosine metric: >>> from numpy import dot >>> from numpy.linalg import norm >>> cosine = lambda v1, v2: dot(v1, v2) / (norm(v1), norm(v2)) - >>> words = [w for w in nlp.vocab if w.is_lower] + >>> words = [w for w in nlp.vocab if w.lower] >>> words.sort(key=lambda w: cosine(w, pleaded)) >>> words.reverse() >>> print('1-20', ', '.join(w.orth_ for w in words[0:20]))