blob: fb4c5d1843f0aee8a4a3751d46dc78db79c3f14a [file] [log] [blame]
Marc Kupietz678185d2018-06-05 13:37:02 +02001#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <math.h>
Marc Kupietzc2e43212021-03-13 18:05:14 +01005#include "../src/collocatordb.h"
Marc Kupietz678185d2018-06-05 13:37:02 +02006
Marc Kupietz88d116b2021-03-13 18:05:14 +01007char dbpath[] = "../models/dereko-2021-i";
8const int testword = 431; // Grund
Marc Kupietz678185d2018-06-05 13:37:02 +02009
10int main(int argc, char* argv[]) {
11 COLLOCATORDB *cdb;
12
13 fprintf(stderr, "opening collocatordb for reading: %s ...\n", dbpath);
14 if(!(cdb = open_collocatordb(dbpath))) {
15 fprintf(stderr, "Error opening %s exiting.\n", dbpath);
16 exit(1);
17 }
18 fprintf(stderr, "Successfully opened %s.\n", dbpath);
19
Marc Kupietz88d116b2021-03-13 18:05:14 +010020 printf("associations between two words:\n %s", get_collocation_scores_as_json(cdb, 431, 218717));
Marc Kupietz678185d2018-06-05 13:37:02 +020021 /*
22 printf("raw dump of all ā€œ%sā€-neighbour positions and frequencies:\n", get_word(cdb, testword));
23 dump_collocators(cdb, testword, 0, 0);
24 */
25
26 printf("printing collocators of ā€œ%sā€ as json:\n", get_word(cdb, testword));
27 printf("%s\n", get_collocators_as_json(cdb, testword));
28
29 return 0;
30}