我是靠谱客的博主 神勇钢笔,这篇文章主要介绍mysql字符串相似度_匹配字符串相似度算法(各个语言版本),现在分享给大家,希望可以做个参考。

C++版

#include

#include

#include

using namespace std;

//算法

int ldistance(const string source,const string target)

{

//step 1

int n=source.length();

int m=target.length();

if (m==0) return n;

if (n==0) return m;

//Construct a matrix

typedef vector< vector > Tmatrix;

Tmatrix matrix(n+1);

for(int i=0; i<=n; i++) matrix[i].resize(m+1);

//step 2 Initialize

for(int i=1;i<=n;i++) matrix[i][0]=i;

for(int i=1;i<=m;i++) matrix[0][i]=i;

//step 3

for(int i=1;i<=n;i++)

{

const char si=source[i-1];

//step 4

for(int j=1;j<=m;j++)

{

const char dj=ta

最后

以上就是神勇钢笔最近收集整理的关于mysql字符串相似度_匹配字符串相似度算法(各个语言版本)的全部内容,更多相关mysql字符串相似度_匹配字符串相似度算法(各个语言版本)内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(134)

评论列表共有 0 条评论

立即
投稿
返回
顶部