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

ASP
利用ASP输出excel文件一例
asp中使用js的encodeURIComponent
ASP动态网站制作中使用MYSQL的分析
如何编写通用的ASP防SQL注入攻击程序
ASP脚本变量、函数、过程和条件语句
ASP内建对象Application和Session
ASP基础教程:常用的 ASP ActiveX 组件
ASP程序漏洞解析及黑客入侵防范方法
ASP访问带多个参数的存储过程
用ASP和SQL语句动态的创建Access表
ASP初学者学习ASP指令
ASP开发中有用的函数(function)集合(1)
ASP开发中有用的函数(function)集合(2)
ASP开发中有用的函数(function)集合(3)
ASP网站程序自动升级实现的方法
ASP开发中的(VBScript)类基础学习
ASP代码:防止重复多次提交表单的方法
在ASP中使用类,实现模块化
ASP基础教程之学习ASP中子程序的应用
ASP技巧:ASP中三个常用语句的使用技巧

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 130 ::
收藏到网摘: 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都是用,来分割的,读取的时候自己研究下就可以