(tokens)
| 66 | |
| 67 | # now let's create our input matrices - just indicator variables for this example - works better than proportions |
| 68 | def tokens_to_vector(tokens): |
| 69 | x = np.zeros(len(word_index_map)) |
| 70 | for t in tokens: |
| 71 | i = word_index_map[t] |
| 72 | x[i] += 1 |
| 73 | return x |
| 74 | |
| 75 | N = len(all_tokens) |
| 76 | D = len(word_index_map) |