collocatordb: add function getWord
diff --git a/collocatordb.cc b/collocatordb.cc
index cf5d339..a7ac04a 100644
--- a/collocatordb.cc
+++ b/collocatordb.cc
@@ -44,8 +44,8 @@
using namespace std;
namespace rocksdb {
- class Collocator {
- public:
+ class Collocator {
+ public:
uint64_t w2;
uint64_t raw;
double pmi;
@@ -248,6 +248,7 @@
void read_vocab(string fname);
public:
+ string getWord(uint32_t w1);
CollocatorDB(const char *db_name, bool read_only);
// public interface of CollocatorDB.
@@ -661,6 +662,10 @@
};
+string rocksdb::CollocatorDB::getWord(uint32_t w1) {
+ return _vocab[w1].word;
+}
+
string rocksdb::CollocatorDB::collocators2json(vector<Collocator> collocators) {
ostringstream s;
int i = 0;