collocatordb: add collocation analysis
diff --git a/collocatordb.h b/collocatordb.h
index 3aea4bd..95848a3 100644
--- a/collocatordb.h
+++ b/collocatordb.h
@@ -10,6 +10,12 @@
#define W2(key) (uint64_t)((key >> 24) & 0xffffff)
#define DIST(key) (int8_t)((uint64_t)((key >> 56) & 0xff))
+
+typedef struct {
+ uint64_t freq;
+ char *word;
+} vocab_entry;
+
#ifdef __cplusplus
namespace rocksdb {
class CollocatorIterator : public Iterator {
@@ -46,3 +52,6 @@
extern COLLOCATORS *open_collocators(char *s);
extern void inc_collocators(COLLOCATORS *db, uint64_t w1, uint64_t w2, int8_t dist);
extern void dump_collocators(COLLOCATORS *db, uint32_t w1, uint32_t w2, int8_t dist);
+extern void get_collocators(COLLOCATORS *db, uint32_t w1, vocab_entry *vocab, uint64_t total);
+extern char *get_collocators_as_json(COLLOCATORS *db, uint32_t w1, vocab_entry *vocab, uint64_t total);
+