Add some directory structure
Change-Id: I052849c6aff9fd0f311984de67c35a306735c9a9
diff --git a/examples/hello_world.c b/examples/hello_world.c
new file mode 100644
index 0000000..fb4c5d1
--- /dev/null
+++ b/examples/hello_world.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "../src/collocatordb.h"
+
+char dbpath[] = "../models/dereko-2021-i";
+const int testword = 431; // Grund
+
+int main(int argc, char* argv[]) {
+ COLLOCATORDB *cdb;
+
+ fprintf(stderr, "opening collocatordb for reading: %s ...\n", dbpath);
+ if(!(cdb = open_collocatordb(dbpath))) {
+ fprintf(stderr, "Error opening %s exiting.\n", dbpath);
+ exit(1);
+ }
+ fprintf(stderr, "Successfully opened %s.\n", dbpath);
+
+ printf("associations between two words:\n %s", get_collocation_scores_as_json(cdb, 431, 218717));
+ /*
+ printf("raw dump of all “%s”-neighbour positions and frequencies:\n", get_word(cdb, testword));
+ dump_collocators(cdb, testword, 0, 0);
+ */
+
+ printf("printing collocators of “%s” as json:\n", get_word(cdb, testword));
+ printf("%s\n", get_collocators_as_json(cdb, testword));
+
+ return 0;
+}