collocatordb: read vocab and calc total in lib
diff --git a/c_testanalysis.c b/c_testanalysis.c
index 5a660cb..bb40f4a 100644
--- a/c_testanalysis.c
+++ b/c_testanalysis.c
@@ -4,34 +4,10 @@
#include <math.h>
#include "collocatordb.h"
-uint64_t total=0;
-
-vocab_entry vocab[100000];
-
-void read_vocab(char *fname) {
- char strbuf[2048];
- long long freq;
- FILE *fin = fopen(fname, "rb");
- if (fin == NULL) {
- printf("Vocabulary file not found\n");
- exit(1);
- }
- uint64_t i = 0;
- while(!feof(fin)) {
- fscanf(fin, "%s %lld", strbuf, &freq);
- vocab[i].word = strdup(strbuf);
- vocab[i].freq = freq;
- total += freq;
- i++;
- }
- fclose(fin);
-}
-
int main() {
COLLOCATORS *cdb = open_collocators_for_read("/vol/work/kupietz/Work2/kl/trunk/Analysemethoden/wang2vec/sample");
- read_vocab("/vol/work/kupietz/Work2/kl/trunk/Analysemethoden/wang2vec/sample.vocab");
for(int i=100; i < 1000; i++)
- get_collocators(cdb, i, vocab, total);
- printf("%s\n", get_collocators_as_json(cdb, 500, vocab, total));
+ get_collocators(cdb, i);
+ printf("%s\n", get_collocators_as_json(cdb, 500));
return 0;
}