We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6261414 commit 485f30fCopy full SHA for 485f30f
1 file changed
word2vec.c
@@ -163,6 +163,7 @@ void SortVocab() {
163
train_words += vocab[a].cn;
164
}
165
166
+ vocab_size++;
167
vocab = (struct vocab_word *)realloc(vocab, vocab_size * sizeof(struct vocab_word));
168
// Allocate memory for the binary tree construction
169
for (a = 0; a < vocab_size; a++) {
@@ -385,8 +386,8 @@ void *TrainModelThread(void *id) {
385
386
while (1) {
387
word = ReadWordIndex(fi);
388
if (feof(fi)) break;
- word_count++;
389
if (word == -1) continue;
390
+ word_count++;
391
if (word == 0) break;
392
// The subsampling randomly discards frequent words while keeping the ranking same
393
if (sample > 0) {
@@ -681,4 +682,4 @@ int main(int argc, char **argv) {
681
682
683
TrainModel();
684
return 0;
-}
685
+}
0 commit comments