본문으로 바로가기

https://github.com/rapidfuzz/rapidfuzz-cpp

rapidfuzz-cpp-main.zip
0.34MB

 

두 개의 스트링이 얼마나 유사한지 비교하는 라이브러리.. 요놈은 참 응용할 때가  많음.

#include <rapidfuzz/fuzz.hpp>

...

// score is 96.55171966552734
double score = rapidfuzz::fuzz::ratio("this is a test", "this is a test!");
    
// score is 100
double score = rapidfuzz::fuzz::partial_ratio("this is a test", "this is a test!");
    
// score is 90.90908813476562
double score = rapidfuzz::fuzz::ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear");

// score is 100
double score = rapidfuzz::fuzz::token_sort_ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear");
    
// score is 83.8709716796875
double score = rapidfuzz::fuzz::token_sort_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear");

// score is 100
double score = rapidfuzz::fuzz::token_set_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear");