w2v-server: some adjustments for acii export
diff --git a/w2v-server.pl b/w2v-server.pl
index 99c957d..50ac2cd 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -295,6 +295,7 @@
push(@lists, $res->{paradigmatic});
}
}
+
$word =~ s/ *\| */ | /g;
if($json) {
return $c->render(json => {word => $word, list => \@lists, collocators=>$res->{syntagmatic}});
@@ -1433,9 +1434,9 @@
int dump_vecs(char *fname) {
long i, j;
FILE *f;
- if(words>100000)
+/* if(words>100000)
words=100000;
-
+*/
if((f=fopen(fname, "w")) == NULL) {
fprintf(stderr, "cannot open %s for writing\n", fname);
return(-1);
@@ -1454,14 +1455,7 @@
int dump_for_numpy(char *fname) {
long i, j;
FILE *f;
- int max;
- if(merged_end > 0)
- max = 150000;
- else
- max = 300000;
-
- if(words>300000)
- words=300000;
+ int max = 300000;
if((f=fopen(fname, "w")) == NULL) {
fprintf(stderr, "cannot open %s for writing\n", fname);
@@ -1471,13 +1465,14 @@
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) {
+ printf("%s\r\n", &vocab[i * max_w]);
+ }
+ if(merged_end > 0) {
+ for (i=0; i < max; i++) {
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]);
+ printf("_%s\r\n", &vocab[i * max_w]);
}
}
fclose(f);