2018-05-05 23:26:53 +02:00
|
|
|
#ifndef CPP_UTILITIES_LEVENSHTEIN_H
|
|
|
|
#define CPP_UTILITIES_LEVENSHTEIN_H
|
|
|
|
|
|
|
|
#include "../global.h"
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <string>
|
|
|
|
|
2019-06-10 21:56:46 +02:00
|
|
|
namespace CppUtilities {
|
2018-05-05 23:26:53 +02:00
|
|
|
|
|
|
|
CPP_UTILITIES_EXPORT std::size_t computeDamerauLevenshteinDistance(const char *str1, std::size_t size1, const char *str2, std::size_t size2);
|
|
|
|
|
|
|
|
inline std::size_t computeDamerauLevenshteinDistance(const std::string &str1, const std::string &str2)
|
|
|
|
{
|
|
|
|
return computeDamerauLevenshteinDistance(str1.data(), str1.size(), str2.data(), str2.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline std::size_t computeDamerauLevenshteinDistance(const char *str1, const char *str2)
|
|
|
|
{
|
|
|
|
return computeDamerauLevenshteinDistance(str1, std::strlen(str1), str2, std::strlen(str2));
|
|
|
|
}
|
|
|
|
|
2019-06-10 21:56:46 +02:00
|
|
|
} // namespace CppUtilities
|
2018-05-05 23:26:53 +02:00
|
|
|
|
|
|
|
#endif // CPP_UTILITIES_LEVENSHTEIN_H
|