w2v-server: hack for merged l2 vectors (?)
diff --git a/w2v-server.pl b/w2v-server.pl
index 0e14b20..26dd100 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -64,7 +64,6 @@
$mergedEnd = mergeVectors($opt_m);
}
-
if($opt_d) { # -d: dump vecs and exit
dump_vecs($opt_d);
exit;
@@ -728,6 +727,7 @@
char st[100][max_size], sep[100];
long a, b=0, c=0, cn=0;
int unmerged;
+ int index = 0;
while (1) {
st[cn][b] = st1[c];
@@ -743,11 +743,17 @@
}
cn++;
for (a = 0; a < cn; a++) {
- if(search_backw) {
- for (b = words - 1; b >= 0; b--) if (!strcmp(&vocab[b * max_w], st[a])) break;
- } else {
- for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st[a])) break;
- }
+ b = 0;
+ int i;
+ for(i=0; i < strlen(st[a]) && st[a][i] >= '0' && st[a][i] <= '9'; i++)
+ b = b*10+st[a][i]-'0';
+ if(i < strlen(st[a]) || i==0) {
+ if(search_backw) {
+ for (b = words - 1; b >= 0; b--) if (!strcmp(&vocab[b * max_w], st[a])) break;
+ } else {
+ for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st[a])) break;
+ }
+ }
if (b == words) b = -1;
wl->wordi[a] = b;
fprintf(stderr, "Word: \"%s\" Position in vocabulary: %lld\n", st[a], wl->wordi[a]);