当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp中利用CSW中文分词组件来实现自己网站的内容关键词自动提取

ASP
保护 XML Web 服务免受黑客攻击
开发BtoC电子商务系统(ASP.NET)
用asp.net实现的把本文推荐给好友功能
尝尝ASP.NET中的小甜饼
web.config一个中文解释
使用ASP.NET加密口令
在SQL Server中保存和输出图片
ASP 中健壮的页结构的异常处理
如何使你的机器运行ASP?
asp(Active Server Page)的语言特性
关于inc文件
IE4 的 模 式 对 话 框 设 计
亲密接触ASP.net(6)
亲密接触ASP.Net(7)
用ASP.Net写一个发送ICQ信息的程序
用ASP.Net编写的查询域名的程序
使用 ASP+ 列表绑定控件(上)
使用 ASP+ 列表绑定控件(中)
使用 ASP+ 列表绑定控件(下)
揭开ASP神秘面纱(1)

ASP 中的 asp中利用CSW中文分词组件来实现自己网站的内容关键词自动提取


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 219 ::
收藏到网摘: n/a

比如标题是:腾讯QQ 2006 珊瑚虫集成版 v4.5b
分词后:[此资源关键词:腾讯 QQ 珊瑚虫 集成 ]
并且把关键词做成专题,可以为每个内容页面生成相关连接了
用CSW中文分词组件
下载:http://www.vgoogle.net/Product_CSW.asp
下面是我的ASP代码,比较粗浅,但实用
codecsw 得到输出的所有分词结果,用它的组建里面有个ASP文件,你一看就知道怎么得到分词结果了,这个不详细说了。
复制代码 代码如下:

fcon=split(htm," ")
fcs=ubound(fcon)
for fci=0 to fcs
if fci mod 2=0 then
fcn=fcn&fcon(fci)&"$fc^#$" '我这里用$fc^#$来分割每个分词
else
fcw=fcw&fcon(fci)&"$fc^#$"
end if
next
fcn=left(fcn,len(fcn)-12) '去掉最前面的$fc^#$
fcw=left(fcw,len(fcw)-6) 去掉最后面的$fc^#$
don=split(fcn,"$fc^#$")
donn=split(fcw,"$fc^#$")
dos=ubound(don)
for doi=0 to dos
fcname=don(doi) '得到分词
fcsx=donn(doi) '得到分词属性
'下面是判断分词符合我所提出的属性,比如名词、名动词、动词等,排除了数词、状词和连接词等。
if fcsx="/b" or fcsx="/nz" or fcsx="/n" or fcsx="/an" or fcsx="/nx" or fcsx="/f" or fcsx="/i" or fcsx="/l" or fcsx="/ng" or fcsx="/nr" or fcsx="/ns" or fcsx="/nt" or fcsx="/nz" or fcsx="/v" or fcsx="/vn" or fcsx="/s" or fcsx="/g" then
if len(fcname)>1 then
if instr(fcname1,fcname&"$") then
else
if fcname<>" " and fcname<>"" then
fcname=replace(replace(replace(trim(fcname),chr(10),""),chr(13),""),chr(10)&chr(13),"") '去除分词的换行和回车键
if len(fcname)>1 then
'这里是分词入库,我的分词库只有三个字段,自动ID、分词名称和分词所属的内容ID
Set Rs = CreateObject("ADODB.Recordset")
sql="select top 1 * from fc where fcname='"&fcname&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
end if
rs("fcname")=fcname
if instr(rs("mid"),","&id&",") then
else
rs("mid")=rs("mid")&","&id&","
end if
rs.update
rs.close
set rs=nothing
'分词入库结束
end if
end if
response.write fcname&"("&fcsx&")<br>"
mfc=mfc&fcname&","
end if
fcname1=fcname1&fcname&"$"
end if
end if
next
'这里是将分词添加到内容表,在内容表我只多加了一个分词字段mfc
if right(mfc,1)="$" then mfc=left(mfc,len(mfc)-1)
Set Rs = CreateObject("ADODB.Recordset")
sql="select top 1 mfc from m where mid="&id
rs.open sql,conn,1,3
rs("mfc")=mfc
rs.update
rs.close
set rs=nothing
end if

就这样实现了,呵呵,在分词表的内容ID都是用,来分割的,读取的时候自己研究下就可以