collocatordb: return f(w2) as f2 in json output for classic ca
diff --git a/collocatordb.cc b/collocatordb.cc
index 1169a67..dd5a3df 100644
--- a/collocatordb.cc
+++ b/collocatordb.cc
@@ -47,6 +47,7 @@
class Collocator {
public:
uint64_t w2;
+ uint64_t f2;
uint64_t raw;
double pmi;
double npmi;
@@ -600,7 +601,8 @@
bestWindow = bitmask;
}
}
- collocators.push_back ( {last_w2, sum, pmi, pmi / (-log2(o/total/true_window_size)), /* normalize to [-1,1] */
+ collocators.push_back ( {last_w2, f2, sum,
+ pmi, pmi / (-log2(o/total/true_window_size)), /* normalize to [-1,1] */
llr, lfmd, md,
left_lfmd,
right_lfmd,
@@ -718,7 +720,7 @@
first = false;
s << "{"
"\"word\":\"" << (string(_vocab[c.w2].word).compare("<num>") == 0? string("###") : string(_vocab[c.w2].word)) << "\"," <<
- "\"rank\":" << c.w2 << "," <<
+ "\"f2\":" << c.f2 << "," <<
"\"f\":" << c.raw << "," <<
"\"npmi\":" << c.npmi << "," <<
"\"pmi\":" << c.pmi << "," <<
diff --git a/collocatordb.h b/collocatordb.h
index 70c6c11..dae2047 100644
--- a/collocatordb.h
+++ b/collocatordb.h
@@ -15,6 +15,7 @@
class Collocator {
public:
uint64_t w2;
+ uint64_t f2;
uint64_t raw;
double pmi;
double npmi;