vendor/tomotopy/src/Labeling/Phraser.hpp in tomoto-0.2.2 vs vendor/tomotopy/src/Labeling/Phraser.hpp in tomoto-0.2.3

- old
+ new

@@ -314,11 +314,11 @@ vocabFreqs, vocabDf, validPairs, candMinCnt, candMinDf, maxNgrams ); } } - float totN = std::accumulate(vocabFreqs.begin(), vocabFreqs.end(), (size_t)0); + float totN = (float)std::accumulate(vocabFreqs.begin(), vocabFreqs.end(), (size_t)0); const float logTotN = std::log(totN); // calculating PMIs std::vector<label::Candidate> candidates; for (auto& p : bigramCnt) @@ -487,11 +487,11 @@ npmi /= std::log(totN / p.second); if (npmi < minNPMI) continue; float rbe = branchingEntropy(trieNodes[0].getNext(bigram.first)->getNext(bigram.second), candMinCnt); float lbe = branchingEntropy(trieNodesBw[0].getNext(bigram.second)->getNext(bigram.first), candMinCnt); - float nbe = std::sqrt(rbe * lbe) / std::log(p.second); + float nbe = std::sqrt(rbe * lbe) / (float)std::log(p.second); if (nbe < minNBE) continue; candidates.emplace_back(npmi * nbe, bigram.first, bigram.second); candidates.back().cf = p.second; candidates.back().df = bigramDf[bigram]; } @@ -510,10 +510,10 @@ npmi /= (logTotN - std::log((float)node->val)) * (rkeys.size() - 1); if (npmi < minNPMI) return; float rbe = branchingEntropy(node, candMinCnt); float lbe = branchingEntropy(trieNodesBw[0].findNode(rkeys.rbegin(), rkeys.rend()), candMinCnt); - float nbe = std::sqrt(rbe * lbe) / std::log(node->val); + float nbe = std::sqrt(rbe * lbe) / (float)std::log(node->val); if (nbe < minNBE) return; candidates.emplace_back(npmi * nbe, rkeys); candidates.back().cf = node->val; }, rkeys); }