Sorensen–Dice coefficient: Difference between revisions

m
C++ - changed function name
m (C++ - minor performance improvement)
m (C++ - changed function name)
Line 59:
using bigram = std::pair<char, char>;
 
std::multiset<bigram> splitbigrams(const std::string& phrase) {
std::multiset<bigram> result;
std::istringstream is(phrase);
Line 80:
 
double sorensen(const std::string& s1, const std::string& s2) {
auto a = splitbigrams(s1);
auto b = splitbigrams(s2);
std::multiset<bigram> c;
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(),
1,777

edits