網站建設

PC + 手機 + 微信網站 + 小程序 + APP,五端合一(yī / yì /yí)

當前位置:首頁>新聞資訊>網站建設

基于(yú)discuz在(zài)線分詞批量優化Dedecms文章關鍵詞

時(shí)間:2025-04-06   訪問量:1110

基于(yú)discuz在(zài)線分詞批量優化Dedecms文章關鍵詞

dedecms本身自帶tag(keywords)提取功能(北京網站制作),但分詞總是(shì)不(bù)夠精确。當然,對于(yú)日更新十數篇且對seo精确執行的(de)用戶來(lái)說(shuō),手工輸入能更好的(de)控制(高端網站建設)。但對于(yú)主題比較寬泛、内容更新量大(dà)的(de)用戶來(lái)說(shuō),dede split是(shì)不(bù)大(dà)完美的(de)。

discuz在(zài)線分詞是(shì)一(yī / yì /yí)個(gè)在(zài)線免費的(de)提詞接口。後有數十萬中文論壇、supsite用戶,對于(yú)語境、細胞詞庫的(de)完善有更多的(de)數據。 這(zhè)個(gè)小程序是(shì)基于(yú)discuz在(zài)線分詞批量更新已發内容的(de)keywords(tag),如果數據量大(dà)(大(dà)于(yú)5萬)的(de)或者虛拟主機用戶的(de)話,最好環境搭到(dào)本地(dì / de)。速度會快一(yī / yì /yí)點。

使用方法,cms安裝目錄,新建c.php,拷入以(yǐ)下内容,自己對應編碼用notepad設置相應gbk或utf8。運行 yourwebsite/c.php?id=1

require_once(dirname(__FILE__).”/include/common.inc.php”);

$id = isset($id) && is_numeric($id) ? $id : 0;

for ($a=$id; $a<$id+10; $a++){

$row = $dsql->GetOne(” SELECT arc.title,tp.body FROM `@__archives` arc LEFT JOIN `@__addonarticle` tp ON arc.id=tp.aid where arc.id=’$a’ “);

if(is_array($row))

{

$title = $row['title'];

$body = $row['body'];

$keywords=zhgetkey($title.$body);

$dsql->ExecuteNoneQuery(” Update `@__archives` set keywords=’$keywords’ where id=’$a’ “);

echo $a.’:’.$keywords.’
’;

}

}

if ($a>80000){break;}

echo “<script>”;

echo “setTimeout(”location.replace(‘c.php?id=$a’)”,0)”;

echo “”;

function zhgetkey($contents){

$rows = strip_tags($contents);

$arr = array(‘ ‘,’ ‘,”s”, “rn”, “n”, “r”, “t”, “>”, ““”, “””,”
”);

$qc_rows = str_replace($arr, ”, $rows);

if(strlen($qc_rows)>2400){

$qc_rows = substr($qc_rows, ’0′, ’2400′);

}

$data = @implode(”, file(“http://keyword.discuz.com/related_kw.html?title=$qc_rows&ics=gbk&ocs=gbk”));

preg_match_all(“/(.*)A[(.*)]](.*)>/”,$data, $out, PREG_SET_ORDER);

$key=”";

for($i=0;$i<5;$i++){

$key=$key.$out[$i][2];

if($out[$i][2])$key=$key.”,”;

}

return $key;

}

function cutstr_html($string, $sublen)

{

$string = strip_tags($string);

$string = preg_replace (‘/n/is’, ”, $string);

$string = preg_replace (‘/ | /is’, ”, $string);

$string = preg_replace (‘/ /is’, ”, $string);

preg_match_all(“/[x01-x7f]|[xc2-xdf][x80-xbf]|xe0[xa0-xbf][x80-xbf]|[xe1-xef][x80-xbf][x80-xbf]|xf0[x90-xbf][x80-xbf][x80-xbf]|[xf1-xf7][x80-xbf][x80-xbf][x80-xbf]/”, $string, $t_string);

if(count($t_string[0]) – 0 > $sublen) $string = join(”, array_slice($t_string[0], 0, $sublen)).”…”;

else $string = join(”, array_slice($t_string[0], 0, $sublen));

return $string;

}

?>

上(shàng)一(yī / yì /yí)篇:企業建網站在(zài)網頁效果圖中如何正确合理的(de)搭配色彩

下一(yī / yì /yí)篇:企業做網站圖像顔色

發表評論:

評論記錄:

未查詢到(dào)任何數據!

在(zài)線咨詢

點擊這(zhè)裏給我發消息 售前咨詢專員

點擊這(zhè)裏給我發消息 售後服務專員

在(zài)線咨詢

免費通話

24小時(shí)免費咨詢

請輸入您的(de)聯系電話,座機請加區号

免費通話

微信掃一(yī / yì /yí)掃

微信聯系
返回頂部