We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8d571d commit 99e546eCopy full SHA for 99e546e
word2vec.c
@@ -51,17 +51,17 @@ int *table;
51
52
void InitUnigramTable() {
53
int a, i;
54
- long long train_words_pow = 0;
55
- real d1, power = 0.75;
+ double train_words_pow = 0;
+ double d1, power = 0.75;
56
table = (int *)malloc(table_size * sizeof(int));
57
for (a = 0; a < vocab_size; a++) train_words_pow += pow(vocab[a].cn, power);
58
i = 0;
59
- d1 = pow(vocab[i].cn, power) / (real)train_words_pow;
+ d1 = pow(vocab[i].cn, power) / train_words_pow;
60
for (a = 0; a < table_size; a++) {
61
table[a] = i;
62
- if (a / (real)table_size > d1) {
+ if (a / (double)table_size > d1) {
63
i++;
64
- d1 += pow(vocab[i].cn, power) / (real)train_words_pow;
+ d1 += pow(vocab[i].cn, power) / train_words_pow;
65
}
66
if (i >= vocab_size) i = vocab_size - 1;
67
0 commit comments