惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
博客园 - 叶小钗
S
SegmentFault 最新的问题
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
L
Lohrmann on Cybersecurity
量子位
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
J
Java Code Geeks
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 三生石上(FineUI控件)
Attack and Defense Labs
Attack and Defense Labs
AI
AI
The Cloudflare Blog
T
Tailwind CSS Blog
S
Schneier on Security
爱范儿
爱范儿
PCI Perspectives
PCI Perspectives
Stack Overflow Blog
Stack Overflow Blog
S
Secure Thoughts
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
V2EX - 技术
V2EX - 技术
S
Securelist
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
C
Cisco Blogs
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
K
Kaspersky official blog
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Simon Willison's Weblog
Simon Willison's Weblog

博客园 - DotCat

幽默的David Solomon MSDN上ReportViewer的两个代码下载地址 .NET threading in C# Training Highlights sharing Converting RDL and RDLC Files VS打SP1后reportviewer用custom assembly的变化 Meet 牛人 @ April: Jeffrey Richter & David Solomon 当你聊天你会想起谁--Vista Sidebar Gadget DIY 哈,IE7!--dudu的CNBlogs DotText 1.0 Beta 2中FreeTextBox对IE7的不兼容性 CCS bug之8: 有关设置精华帖的操作在帖子的操作历史里浏览出错 CCS bug之7: 设置精华帖后在精华区不能看到 MSN和Windows Live Messenger机器人大赛 [CodeProject每日一荐]实现Double Metaphone语音匹配算法[二]:Visual Basic的COM实现和关系数据库解决方案 [CodeProject每日一荐]实现Double Metaphone语音匹配算法[一]:介绍与C++实现 [CodeProject每日一荐] 基于xml的在线选择题小测试(调查问卷) 解决问题: .Net异常 Method not found: Void System.Web.UI.WebControls.BaseDataList.set_Caption(System.String). 解决问题: sql server 2000 企业管理器打不开了 推荐解除文件锁定软件: unlocker CuteChat3.0 (for CommunityServer2.0) 发布了 CommunityServer 2.1 的消息
[CodeProject每日一荐]实现Double Metaphone语音匹配算法[三,四] VBScript调用COM;存储过程实现及高级话题
DotCat · 2006-06-09 · via 博客园 - DotCat

Implement Phonetic ("Sounds-like") Name Searches with Double Metaphone Part III: VBScript and ASP & Database Solutions By Adam Nelson

[三] 就一笔带过了:因为VB只是类型化的变量,而脚本语言是无类型的.所以COM必须为脚本语言单独实现一个版本,然后在脚本语言VBcript,JScript,以及ASP里面的VBcript就可以调用了.

Implement Phonetic ("Sounds-like") Name Searches with Double Metaphone Part IV: SQL Server and Advanced Database Topics By Adam Nelson

[四] 还蛮有意思的.作为数据库开发人员出身的作者(作者语),推介了存储过程的种种好处,并展示了用Sql Server的使用技巧.

[使用存储过程]
SQL Server的扩展存储过程是用 Win32 DLL的. 安装只需把DLL复制到SQL Server 安装目录的Binn 的目录下,然后在master数据库运行sp_addextendedproc,如
use master
exec sp_addextendedproc ‘xp_metaphone’, ‘XPMetaphone.dll’
存储过程只做了采用unsigned short 的优化版本.预先把key都算出来存起来,就可以使用select语句来查询了.

[创建集簇索引]
一个表只能创建一个集簇索引列,让物理存储上按该列排序,在数据规模很大时肯定要使用的.如果是把语音key和应用程序其他信息存在一张表里,key往往没有重要到建集簇索引的份.

[减少与现有程序数据表的耦合]
把语音key单独存个表,至少就可以有个集簇索引列了,这种建立数据库的方法减少耦合,当然是好的.

[用触发器更新key]
算法可能会变,新词来了也需要插入key.使用更新和插入时的触发器来维护单词的相应key

[在select里给匹配打分]
(译者:这种case平时我都忽略了,久了不用简直都遗忘了)

select 
word,
(
case 
     
when key1 = @primaryKey then 
     
1--Strong match

     
when key2 = @primaryKey then
     
2--Normal match

     
when key1 = @alternateKey then
     
2--Normal match

     
when key2 = @alternateKey then
     
3--Minimal match

     
else
     
4--No match
end
as matchScore
from Words
where
     key1 
= @primaryKey
     
or
     key2 
= @primaryKey
     
or
     key1 
= @alternateKey
     
or
     key2 
= @alternateKey
order by word
go

[把搜索逻辑也封装在存储过程中]
这下彻底了,应用程序只需简单调用一条存储过程,不用再拼sql语句什么的了,代码重用又一招.