collocatordb: c_testanalysis -> hello_world
diff --git a/Makefile b/Makefile
index ad47992..ff8a9b0 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,9 @@
LIBOBJECTS = $(LIB_SOURCES:.cc=.o)
INSTALL_PATH = /usr/local
+hello_world: hello_world.c collocatordb.h collocatordb.o Makefile
+ $(CC) $(CFLAGS) -L. -L/usr/local/lib $@.c -o$@ collocatordb.o /vol/work/kupietz/rocksdb/librocksdb.a -std=gnu99 -lstdc++ -lm $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS)
+
testcdb: testcdb.cc collocatordb.h collocatordb.o Makefile
$(CXX) $(CXXFLAGS) -L. -L/usr/local/lib $@.cc -o$@ collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
@@ -25,9 +28,6 @@
c_testcdb: c_testcdb.c collocatordb.h collocatordb.o Makefile
$(CC) $(CFLAGS) -L. -L/usr/local/lib $@.c -o$@ collocatordb.o -std=gnu99 -lstdc++ -lm -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS)
-c_testanalysis: c_testanalysis.c collocatordb.h collocatordb.o Makefile
- $(CC) $(CFLAGS) -L. -L/usr/local/lib $@.c -o$@ collocatordb.o -std=gnu99 -lstdc++ -lm -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS)
-
collocatordb: collocatordb.cc Makefile
$(CXX) $(CXXFLAGS) -L/usr/local/lib $@.cc -o$@ -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
diff --git a/c_testanalysis.c b/c_testanalysis.c
deleted file mode 100644
index de0d227..0000000
--- a/c_testanalysis.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "collocatordb.h"
-
-int main() {
- COLLOCATORDB *cdb = open_collocatordb("/vol/work/kupietz/Work2/kl/trunk/Analysemethoden/wang2vec/sample");
- for(int i=100; i < 1000; i++)
- get_collocators(cdb, i);
- printf("%s\n", get_collocators_as_json(cdb, 500));
- return 0;
-}
diff --git a/hello_world.c b/hello_world.c
new file mode 100644
index 0000000..b96979f
--- /dev/null
+++ b/hello_world.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "collocatordb.h"
+
+char dbpath[] = "/vol/work/kupietz/Work2/kl/trunk/Analysemethoden/word2vec/models/dereko-2017-ii";
+const int testword = 259; // Welt
+
+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("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;
+}