1. 經過nlp分詞系統得到的結果不準確,該怎麼辦
最近一段時間一直對phpcms v9的搜索功能,幾次想進行大的改動,但是一直沒時間考慮思路,不得已在原來的搜索功能的基礎上把搜索的分詞給改動了下,雖然不如意,但是也能將就著用。進入到phpcms/moles/search/index.php文件,找到//如果分詞結果為空if(!empty($segment_q)) {$sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' $sql_time AND MATCH (`data`) AGAINST ('$segment_q' IN BOOLEAN MODE)";} else {$sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' $sql_time AND `data` like '%$q%'";}修改為:$sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' $sql_time AND `data` like '%$q%'";這樣基本上就能解決一般的搜索功能了。 查看原帖>>
2. 請教下,PHP文章標題的自動分詞(Tag)是怎麼做的
文章分詞需要程序來完成給你推薦個工具,你看看是不是你需要的分詞,這個是靈玖軟體推出的你可以找一下。
3. php中文分詞誰有源碼發我一份吧,謝謝
我看這個不錯
http://www.ftphp.com/scws/index.php
補充:
怎麼用?
看文檔。
如果連文檔都懶的讀,可以直接直接問作者本人。
4. PHP能做到中文分詞嗎
只要能處理字元竄的程序多能做中文分詞, 只是效率問題
其實PHP不適合做中文分詞,執行效率太低
只能是簡單的應用,比如用戶搜索的時候把,把用戶搜索到的關鍵字分離出來加亮啥的
所謂的分詞,是把一句話里有意義的詞語提取出來
比如:
他在游泳 分詞的時候把 他 和 游泳 這兩個字分離出來
不能把游泳 分成 游 和 泳
這個設計到語義分析,概率,啥啥的,很麻煩
中文分詞是中文搜索引擎必須的
5. PHP中文分詞應用到搜索的例子
中文分詞,首先對您輸入的搜索關鍵字進行分詞,然後資料庫中本來就存在一個索引表,就像個詞典,然後當你進行搜索的時候就用你的詞去和那本字典對比,得到索引結果表,然後通過id類似於偏移地址,得到真正的數據源地址,反饋回來,這是我平時做搜索的方法,希望對你有用。順便插播個小廣告bbs.45net.cn。有時間捧個人場。O(∩_∩)O~
6. php 現在中文分詞都使用什麼技術
現在很多用迅搜
7. php 一般使用什麼中文分詞擴展
Robbe是建立在Friso中文分詞器上的一個高性能php中文分詞擴展,除了提供了基本的分詞函數以外,還提供一些編碼轉換函。
Robbe完整版本(PHP測試程序, 開發幫助文檔, WinNT下php各版本的dll文件)下載:code.google.com/p/robbe
一. 關於Robbe:
robbe是建立在friso中文分詞上的一個高性能php中文分詞擴展。了解friso
1.目前最高版本:friso 1.6.0,【源碼無需修改即可在各平台下編譯運行】
2.mmseg四種過濾演算法,分詞准確率達到了98.41%。
3.詳細功能,請訪問friso官方首頁:friso [code.google.com/p/friso]
二. Robbe分詞速度:
測試環境:2.8GHZ/2G/Ubuntu
簡單模式:3.1M/秒
復雜模式:1.4M/秒
(因為php中的大量字元串的復制,性能比friso有些下降)。
8. PHP 英文分詞 有什麼好介紹的嗎
PHP(外文名:PHP: Hypertext Preprocessor,中文名:「超文本預處理器」)是一種通用開源腳本語言。
語法吸收了C語言、Java和Perl的特點,利於學習,使用廣泛,主要適用於Web開發領域。PHP 獨特的語法混合了C、Java、Perl以及PHP自創的語法。
9. 我想用PHP做一個聊天機器人,我調用別人的API實現了中文分詞,我要怎樣構建自己的資料庫呢
可以用SimSimi API:http://developer.simsimi.com/(不需要資料庫)。
根據提示進行注冊(注冊地址:http://developer.simsimi.com/signUp)。
登錄後訪問:http://developer.simsimi.com/apps,
點擊[Get a 7 days Trial Key],你就會獲得一個Trial Key(有效期為7天),然後直接
$key='';//你的TrialKey
$lang='';//語言
$msg='';//用戶說的話
$res=file_get_contents('http://sandbox.api.simsimi.com/request.p?key='.$key.'&lc='.$lang.'&ft=1.0&text='.$msg);
或者你要購買一個Paid Key,也可以。
在http://developer.simsimi.com/apps中,點擊[Get Paid Key],就可以購買。
只是代碼要改為(響應地址不同):
$key='';//你的PaidKey
$lang='';//語言
$msg='';//用戶說的話
$res=file_get_contents('http://api.simsimi.com/request.p??key='.$key.'&lc='.$lang.'&ft=1.0&text='.$msg);
就可以了。注意php.ini中,allow_url_fopen要為On:
allow_url_fopen=On
然後會返回一個JSON字元串,與下面類似:
{
"result":100,
"response":"SimSimi的回答",
"id":本次會話的標識符(int),
"msg":"響應描述"
}
相應描述與result的值相關。
100:OK.//成功
400:BadRequest.//參數錯誤
401:Unauthorized.//Key不存在
404:Notfound.//頁面不存在
500:ServerError.//伺服器出錯
參見:SimSimi API:http://developer.simsimi.com/api
謝謝!
10. php 分詞,搜索引擎,技術
你好,很高興為你解答:
如果你僅僅是要把長句中的單詞分出來,那是很簡單的:
<?php
$str="GoogleTranslateforBusiness!";
$str=preg_replace("{.|,|;|:|'|"|?|!|<|>|(|)}","",$str);//移除所有標點符號
$arr=array_unique(explode("",$str));//以空格分割,並去重
var_mp($arr);
?>
以下是一段測試文本:
(asseeninCorPerl),"something"(inthiscase,output"Hi,I'maPHPscript!").<?phpand?>"PHPmode."
-,.,.,andthenthere'.
,.Don''sfeatures.Youcanjumpin,inashorttime,.
AlthoughPHP'sdevelopmentisfocusedonserver-sidescripting,youcandomuchmorewithit.Readon,andseemoreintheWhatcanPHPdo?section,.
輸出結果:
Instead,of,lots,commands,to,output,HTML,as,seen,in,C,or,Perl,PHP,pages,contain,with,embedded,code,that,does,something,this,case,Hi,Im,a,script,The,is,enclosed,special,start,and,end,processing,instructions,php,,allow,you,jump,into,out,modeWhat,distinguishes,from,like,client-side,JavaScript,the,executed,on,server,generating,which,then,sent,client,would,receive,results,running,but,not,know,what,underlying,was,You,can,even,configure,your,web,process,all,files,theres,really,no,way,users,tell,have,up,sleeveThe,best,things,using,are,it,extremely,simple,for,newcomer,offers,many,advanced,features,professional,programmer,Dont,be,afraid,reading,long,list,PHPs,short,time,writing,scripts,few,hoursAlthough,development,focused,server-side,scripting,do,much,more,Read,see,What,section,go,right,introctory,tutorial,if,only,interested,programming
使用sort()對其進行排序:
C,Dont,HTML,Hi,Im,Instead,JavaScript,PHP,PHPs,Perl,Read,The,What,You,a,advanced,afraid,all,allow,and,are,as,be,best,but,can,case,client,client-side,code,commands,configure,contain,development,distinguishes,do,does,embedded,enclosed,end,even,executed,extremely,features,few,files,focused,for,from,generating,go,have,hoursAlthough,if,in,instructions,interested,into,introctory,is,it,jump,know,like,list,long,lots,many,modeWhat,more,much,newcomer,no,not,of,offers,on,only,or,out,output,pages,php,process,processing,professional,programmer,programming,reading,really,receive,results,right,running,script,scripting,scripts,section,see,seen,sent,server,server-side,short,simple,sleeveThe,something,special,start,tell,that,the,then,theres,things,this,time,to,tutorial,underlying,up,users,using,was,way,web,what,which,with,would,writing,you,your
-----------------------------------
如有疑問歡迎追問!
滿意請點擊右上方【選為滿意回答】按鈕么么噠 o(∩_∩)o