wiki.techinc.nl/languages/classes/LanguageZh_hans.php
Mark A. Hershberger 560b72c4ab * Implement normalization of fullwidth latin characters for all Languages, not just Japanese and Chinese.
* Tune Language::convertDoubleWidth() so that it is 8-10x faster.  (See http://xrl.us/bg2mon)
2010-03-23 19:50:59 +00:00

33 lines
No EOL
677 B
PHP

<?php
/**
* @ingroup Language
*/
class LanguageZh_hans extends Language {
function hasWordBreaks() {
return false;
}
/**
* Eventually this should be a word segmentation;
* for now just treat each character as a word.
* @todo Fixme: only do this for Han characters...
*/
function segmentByWord( $string ) {
$reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
$s = self::insertSpace( $string, $reg );
return $s;
}
function normalizeForSearch( $string ) {
wfProfileIn( __METHOD__ );
// Double-width roman characters
$s = parent::normalizeForSearch( $s );
$s = trim( $s );
$s = self::segmentByWord( $s );
wfProfileOut( __METHOD__ );
return $s;
}
}