Add get_word_frequency function

Change-Id: Idef55f5a8f84c4bcba0a1bfdbe563eb74f26857a
diff --git a/src/collocatordb.cc b/src/collocatordb.cc
index 444a030..57a01d9 100644
--- a/src/collocatordb.cc
+++ b/src/collocatordb.cc
@@ -311,6 +311,8 @@
 
   uint64_t getCorpusSize() const;
 
+  uint64_t getWordFrequency(uint64_t w1);
+
   CollocatorDB(const char *db_name, bool read_only);
 
   // public interface of CollocatorDB.
@@ -813,6 +815,10 @@
   return total;
 }
 
+uint64_t CollocatorDB::getWordFrequency(uint64_t w1) {
+  return _vocab[w1].freq;
+}
+
 string CollocatorDB::collocators2json(uint32_t w1,
                                                const vector<Collocator>& collocators) {
   ostringstream s;
@@ -923,6 +929,10 @@
 
 DLL_EXPORT uint64_t get_corpus_size(COLLOCATORS *db) { return db->getCorpusSize(); };
 
+DLL_EXPORT uint64_t get_word_frequency(COLLOCATORS *db, uint64_t w1) {
+  return db->getWordFrequency(w1);
+}
+
 #ifdef __clang__
 #pragma clang diagnostic push
 #endif
diff --git a/src/collocatordb.h b/src/collocatordb.h
index 8bb3402..74f2f0e 100644
--- a/src/collocatordb.h
+++ b/src/collocatordb.h
@@ -131,5 +131,6 @@
 extern char *get_version();
 extern uint64_t get_word_id(COLLOCATORDB *db, const char *word);
 extern uint64_t get_corpus_size(COLLOCATORDB *db);
+extern uint64_t get_word_frequency(COLLOCATORDB *db, uint64_t w1);
 
 #endif