by Radim · 8y ago · 0 comments
TL;DR:
1. Build a special distance(word1, word2) metric using a set of word vectors trained elsewhere (such as GloVe). This distance works better than cosine distance.
2. Given a document (a sentence, a paragraph… basically, a sequence of words), calculate the "importance" of each word as a sigmoid over distances(word, avg(all_words)).
3. To embed a document, simply do a weighted average of its word vectors, where the weight of each word equals the importance above.
Apologies if all of this is blindingly obvious. I’m a fascinated amateur.
(disclaimer: i dr)
https://github.com/ransomw/botiful-soup/blob/master/mibot/sr...
as i recall, there's a lot of neato REPL-y graphvis to try in
https://github.com/ransomw/botiful-soup/tree/master/mibot/de...
----
while i'm here, let me mention: Gärdenfors books like "Geometry of Meaning" are hearty food for thought about natural language semantics