w2v-server: numpy export: "zip" special and reference vectors if applicable
diff --git a/w2v-server.pl b/w2v-server.pl
index fec8796..2ec8c40 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -1331,17 +1331,31 @@
int dump_for_numpy(char *fname) {
long i, j;
FILE *f;
- /* if(words>200000) */
- /* words=200000; */
+ int max;
+ if(merged_end > 0)
+ max = 150000;
+ else
+ max = 300000;
+
+ if(words>300000)
+ words=300000;
if((f=fopen(fname, "w")) == NULL) {
fprintf(stderr, "cannot open %s for writing\n", fname);
return(-1);
}
- for (i=0; i < words; i++) {
+ for (i=0; i < max; i++) {
for(j=0; j < size - 1; j++)
fprintf(f, "%f\t", M[i*size + j]);
fprintf(f, "%f\n", M[i*size + j]);
+ printf("%s\n", &vocab[i * max_w]);
+
+ if(merged_end > 0) {
+ for(j=0; j < size - 1; j++)
+ fprintf(f, "%f\t", M[(merged_end + i)*size + j]);
+ fprintf(f, "%f\n", M[(merged_end + i)*size + j]);
+ printf("_%s\n", &vocab[i * max_w]);
+ }
}
fclose(f);
return(0);