【excel VBA】excel 计算字符串相似度
来源:互联网 发布:c语言黑色编程界面 编辑:程序博客网 时间:2024/06/05 04:59
Private Function min(one As Integer, two As Integer, three As Integer) min = one If (two < min) Then min = two End If If (three < min) Then min = three End If End Function Private Function ld(str1 As String, str2 As String) Dim n, m, i, j As Integer Dim ch1, ch2 As String n = Len(str1) m = Len(str2) Dim temp As Integer If (n = 0) Then ld = m End If If (m = 0) Then ld = n End If Dim d As Variant ReDim d(n + 1, m + 1) As Variant For i = 0 To n d(i, 0) = i Next i For j = 0 To m d(0, j) = j Next j For i = 1 To n ch1 = Mid(str1, i, 1) For j = 1 To m ch2 = Mid(str2, j, 1) If (ch1 = ch2) Then temp = 0 Else temp = 1 End If d(i, j) = min(d(i - 1, j) + 1, d(i, j - 1) + 1, d(i - 1, j - 1) + temp) Next j Next i ld = d(n, m) End Function Public Function sim(str1 As String, str2 As String) Dim ldint As Integer ldint = ld(str1, str2) Dim strlen As Integer If (Len(str1) >= Len(str2)) Then strlen = Len(str1) Else strlen = Len(str2) End If sim = 1 - ldint / strlen End Function
阅读全文
0 0
- 【excel VBA】excel 计算字符串相似度
- EXCEL VBA字符串替换
- 计算字符串相似度
- 字符串相似度计算
- 字符串相似度计算
- 字符串相似度计算
- 计算字符串相似度
- excel vba应用---相似筛选、筛选后处理
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- Excel VBA
- Excel VBA
- Excel VBA
- VBA Excel
- EXCEL VBA 公式计算问题小结
- 通过 Excel 使用 VBA 计算协方差
- Java Web项目中使用Freemarker生成Word文档
- Zookeeper 的学习与运用
- 程序员技术练级攻略-程序员技术浅谈
- Rsync命令使用
- CardView、RecyclerView简单使用
- 【excel VBA】excel 计算字符串相似度
- windows批处理SFTP上传文件到linux,并处理回车换行符号
- linux系统安装mysql
- Qt之二维绘图
- 激光雷达--数据采集
- C# 正则表达式 使用介绍(备查阅)
- 两道有趣的算法题(只有思路)
- 用nvm管理不同版本的node和npm
- 每天一个Linux命令(57):ss命令