mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Fix small bug in code of mark-adverbs tutorial
This commit is contained in:
parent
271a120d30
commit
603a3f40c5
|
@ -78,7 +78,7 @@ p A simple work-around is to average the vectors of several words, and use that
|
|||
+code.
|
||||
>>> say_verbs = ['pleaded', 'confessed', 'remonstrated', 'begged', 'bragged', 'confided', 'requested']
|
||||
>>> say_vector = sum(nlp.vocab[verb].vector for verb in say_verbs) / len(say_verbs)
|
||||
>>> words.sort(key=lambda w: cosine(w.vector * say_vector))
|
||||
>>> words.sort(key=lambda w: cosine(w.vector, say_vector))
|
||||
>>> words.reverse()
|
||||
>>> print('1-20', ', '.join(w.orth_ for w in words[0:20]))
|
||||
1-20 bragged, remonstrated, enquired, demurred, sighed, mused, intimated, retorted, entreated, motioned, ranted, confided, countersued, gestured, implored, interceded, muttered, marvelled, bickered, despaired
|
||||
|
|
Loading…
Reference in New Issue
Block a user