(vector)
| 94 | |
| 95 | |
| 96 | def vector2word(vector): |
| 97 | max_cos = -10000 |
| 98 | match_word = '' |
| 99 | for word in word_vector_dict: |
| 100 | v = word_vector_dict[word] |
| 101 | cosine = vector_cosine(vector, v) |
| 102 | if cosine > max_cos: |
| 103 | max_cos = cosine |
| 104 | match_word = word |
| 105 | return (match_word, max_cos) |
| 106 | |
| 107 | |
| 108 | class MySeq2Seq(object): |
no test coverage detected