FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Chinese(Japanese Korea.....) word segment
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Chinese(Japanese Korea.....) word segment [message #11058] Tue, 17 June 2003 10:11 Go to next message
ezdb is currently offline  ezdb   China
Messages: 158
Registered: May 2002
Location: china
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user


$body="abcde";
split $body to
'ab' 'bc' 'cd' 'de'

when we search "bcd abc"

split "bcd" to "bc" "cd"
split "abc" to "ab" "bc"

($key='bc' and $key='cd') or ($key='ab' and $key='bc')

Cool Confused Mad Mad Sad Crying or Very Sad

icon7.gif  Re: Chinese(Japanese Korea.....) word segment [message #11192 is a reply to message #11058] Sat, 21 June 2003 02:07 Go to previous message
ezdb is currently offline  ezdb   China
Messages: 158
Registered: May 2002
Location: china
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user

function sp_str($str)
{

$str=preg_replace("/,|\\\\|\.|\;|:|\"|!|~|`|\^|\(|\)|)|(|.|。|:|,|!| ;|“|”|’|‘|[|]|\?|?|、|-|—|\t|\n|'|<|>|\r|\r\n| | |《|》|-|…|【|】|/","",$str);

$n=strlen($str);
$m=0;
$j=0;
$ahz=array();
for($i=0;$i<$n;$i++)
{
if(ord($str[$i])>128)
{
$hz[$m]=$str[$i].$str[$i+1];
if($m>0)
{
$ahz[$j]=$hz[$m-1].$hz[$m];
$j++;
}
$m++;
$i++;

}
else
{
$en.=$str[$i];
}

}

$a_e=preg_split("/[\s,]+/",$en);
$n_e=count($a_e);
$n_a=count($ahz);
for($u=0;$u < $n_e;$u++)
{
if(strlen($a_e[$u])<4||strlen($a_e[$u])>50)
continue;
$ahz[$n_a]=strtolower($a_e[$u]);
$n_a++;
}

return $ahz;
}
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Does anyone have Traditional Chinese translation?
Next Topic: 2.5.0 RCx - Atomic theme rebuilds
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Oct 19 18:05:17 EDT 2017

Total time taken to generate the page: 0.00642 seconds