fcon=split(htm," ") fcs=ubound(fcon) for fci=0 to fcs if fci mod 2=0 then fcn=fcn&fcon(fci)&"$fc^#$" '我這里用$fc^#$來(lái)分割每個(gè)分詞 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) '得到分詞屬性 '下面是判斷分詞符合我所提出的屬性,比如名詞、名動(dòng)詞、動(dòng)詞等,排除了數(shù)詞、狀詞和連接詞等。 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 '這里是分詞入庫(kù),我的分詞庫(kù)只有三個(gè)字段,自動(dòng)ID、分詞名稱和分詞所屬的內(nèi)容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 '分詞入庫(kù)結(jié)束 end if end if response.write fcname&"("&fcsx&")<br>" mfc=mfc&fcname&"," end if fcname1=fcname1&fcname&"$" end if end if next '這里是將分詞添加到內(nèi)容表,在內(nèi)容表我只多加了一個(gè)分詞字段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