declare @w varchar(8000) set @w='常用的分词算法有正向最大匹配、逆向最大匹配、双向最大匹配、最佳匹配法、最少分词法、词网格算法等等。 最大匹配法(Forward Maximum Matching method, FMM法):选取包含6-8个汉字的符号串作为最大符号串,把最大符号串与词典中的单词条目相匹配,如果不能匹配,就削掉一个汉字继续匹配,直到在词典中找到相应的单词为止。匹配的方向是从右向左。 逆向最大匹配法(Backward Maximum Matching method, BMM法):匹配方向与MM法相反,是从左向右。实验表明:对于汉语来说,逆向最大匹配法比最大匹配法更有效。 双向匹配法(Bi-direction Matching method, BM法):比较MM法与RMM法的切分结果,从而决定正确的切分。 最佳匹配法(Optimum Matching method, OM法):将词典中的单词按它们在文本中的出现频度的大小排列,高频度的单词排在前,频度低的单词排在后,从而提高匹配的速度。'declare @tb table(w varchar(10),f int) declare @i int declare @l int declare @theWord varchar(10) set @l=2 while @l<5 begin set @i=1 while @i<len(@w) begin set @theWord=substring(@w,@i,@l) if charindex(' ',@theWord)=0 begin if exists(select w from @tb where w=@theWord) begin update @tb set f=f+1 where w=@theWord end else begin insert @tb(w,f) select @theWord,1 end end set @i=@i+1 end set @l=@l+1 end
select * from @tb where f>len(@w)/70 order by f desc
* 个人博客: http://blog.csdn.net/eaglet; 这个人的还不错。
其它大部分要收费或是有限制。。中科院的速度太慢了。
set @w='常用的分词算法有正向最大匹配、逆向最大匹配、双向最大匹配、最佳匹配法、最少分词法、词网格算法等等。
最大匹配法(Forward Maximum Matching method, FMM法):选取包含6-8个汉字的符号串作为最大符号串,把最大符号串与词典中的单词条目相匹配,如果不能匹配,就削掉一个汉字继续匹配,直到在词典中找到相应的单词为止。匹配的方向是从右向左。
逆向最大匹配法(Backward Maximum Matching method, BMM法):匹配方向与MM法相反,是从左向右。实验表明:对于汉语来说,逆向最大匹配法比最大匹配法更有效。
双向匹配法(Bi-direction Matching method, BM法):比较MM法与RMM法的切分结果,从而决定正确的切分。
最佳匹配法(Optimum Matching method, OM法):将词典中的单词按它们在文本中的出现频度的大小排列,高频度的单词排在前,频度低的单词排在后,从而提高匹配的速度。'declare @tb table(w varchar(10),f int)
declare @i int
declare @l int
declare @theWord varchar(10)
set @l=2
while @l<5
begin
set @i=1
while @i<len(@w)
begin
set @theWord=substring(@w,@i,@l)
if charindex(' ',@theWord)=0 begin
if exists(select w from @tb where w=@theWord)
begin
update @tb set f=f+1 where w=@theWord
end
else
begin
insert @tb(w,f) select @theWord,1
end end
set @i=@i+1
end
set @l=@l+1
end
select * from @tb where f>len(@w)/70 order by f desc
写了一个分词算法
http://www.cnblogs.com/zhenyulu/archive/2007/03/14/675224.html
http://www.codeproject.com/