wiki.techinc.nl/languages/classes/LanguageYue.php
Mark A. Hershberger 54badce2d8 Follow-up r61856
* Rename wordSegmentation() to segmentByWord().
* Consolidate search index locking and iteration to Maintenance.php
* Add maintenance/updateDoubleWidthSearch.php to take care of new
  format for normalized double-width roman characters.
* Add error checking to updateSearchIndex.php for creating $posFile.
* Add note to UPGRADE about running updateDoubleWidthSearch.php.
2010-03-10 21:54:23 +00:00

32 lines
684 B
PHP

<?php
/**
* @ingroup Language
*/
class LanguageYue 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 = self::convertDoubleWidth( $string );
$s = trim( $s );
$s = parent::normalizeForSearch( $s );
wfProfileOut( __METHOD__ );
return $s;
}
}