mirror of https://github.com/explosion/spaCy.git
* Fix docs bug
This commit is contained in:
parent
773d209405
commit
274b802830
|
@ -147,7 +147,7 @@ cosine metric:
|
||||||
>>> from numpy.linalg import norm
|
>>> from numpy.linalg import norm
|
||||||
|
|
||||||
>>> cosine = lambda v1, v2: dot(v1, v2) / (norm(v1) * norm(v2))
|
>>> cosine = lambda v1, v2: dot(v1, v2) / (norm(v1) * norm(v2))
|
||||||
>>> words = [w for w in nlp.vocab if w.lower]
|
>>> words = [w for w in nlp.vocab if w.has_repvec]
|
||||||
>>> words.sort(key=lambda w: cosine(w.repvec, pleaded.repvec))
|
>>> words.sort(key=lambda w: cosine(w.repvec, pleaded.repvec))
|
||||||
>>> words.reverse()
|
>>> words.reverse()
|
||||||
>>> print('1-20', ', '.join(w.orth_ for w in words[0:20]))
|
>>> print('1-20', ', '.join(w.orth_ for w in words[0:20]))
|
||||||
|
|
Loading…
Reference in New Issue