Skip to content

Commit d90649a

Browse files
author
tmikolov
committed
changed index of OOV from 0 to -1 (so that first word vector is included in search)
1 parent 7082459 commit d90649a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

distance.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ int main(int argc, char **argv) {
9090
cn++;
9191
for (a = 0; a < cn; a++) {
9292
for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st[a])) break;
93-
if (b == words) b = 0;
93+
if (b == words) b = -1;
9494
bi[a] = b;
9595
printf("\nWord: %s Position in vocabulary: %lld\n", st[a], bi[a]);
96-
if (b == 0) {
96+
if (b == -1) {
9797
printf("Out of dictionary word!\n");
9898
break;
9999
}
100100
}
101-
if (b == 0) continue;
101+
if (b == -1) continue;
102102
printf("\n Word Distance\n------------------------------------------------------------------------\n");
103103
for (a = 0; a < size; a++) vec[a] = 0;
104104
for (b = 0; b < cn; b++) {
105-
if (bi[b] == 0) continue;
105+
if (bi[b] == -1) continue;
106106
for (a = 0; a < size; a++) vec[a] += M[a + bi[b] * size];
107107
}
108108
len = 0;
@@ -132,4 +132,4 @@ int main(int argc, char **argv) {
132132
for (a = 0; a < N; a++) printf("%50s\t\t%f\n", bestw[a], bestd[a]);
133133
}
134134
return 0;
135-
}
135+
}

0 commit comments

Comments
 (0)