blob: 671a16e7cc45dd6480ca462343d2358be36d034d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* Simplified Chinese
*
* @ingroup Language
*/
class LanguageZh_hans extends Language {
/**
* @return bool
*/
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...
*
* @param $string string
*
* @return string
*/
function segmentByWord( $string ) {
$reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
$s = self::insertSpace( $string, $reg );
return $s;
}
/**
* @param $s
* @return string
*/
function normalizeForSearch( $s ) {
wfProfileIn( __METHOD__ );
// Double-width roman characters
$s = parent::normalizeForSearch( $s );
$s = trim( $s );
$s = $this->segmentByWord( $s );
wfProfileOut( __METHOD__ );
return $s;
}
}
|