Marc Kupietz | 678185d | 2018-06-05 13:37:02 +0200 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <string.h> |
| 4 | #include <math.h> |
| 5 | #include "collocatordb.h" |
| 6 | |
Marc Kupietz | 88d116b | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 7 | char dbpath[] = "../models/dereko-2021-i"; |
| 8 | const int testword = 431; // Grund |
Marc Kupietz | 678185d | 2018-06-05 13:37:02 +0200 | [diff] [blame] | 9 | |
| 10 | int 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 Kupietz | 88d116b | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 20 | printf("associations between two words:\n %s", get_collocation_scores_as_json(cdb, 431, 218717)); |
Marc Kupietz | 678185d | 2018-06-05 13:37:02 +0200 | [diff] [blame] | 21 | /* |
| 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 | } |