用mssql如何实现简单的分词?(用字典建立索引)
 tab1两个字段,col1是语料,其实就是一标题,比如:综合利用颜色和纹理特征的图像检索 
 col2是希望通过SQL语句得到的一堆关键字。   
 tab2是搜狗的词典,只有一个字段col,就是那好多万个词。。   
 目标是把col1的语料实现简单的分词,得到col2,比如:综合,利用,颜色,纹理,特征,图像,检索   
 请问用SQL语句写麻烦吗?写一个巨大的charindex循环吗? 
------解决方案--------------------是这样的意思吗:   
 declare @key varchar(1000) 
 set @key =  ' ' 
 select @key = @key +  ', ' + col from tab2  
 where charindex(col,  '综合利用颜色和纹理特征的图像检索 ')  <>  0 
 set @key = stuff(@key, 1, 1,  ' ') 
 print @key 
------解决方案--------------------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