00001 <?php
00002
00008 class LanguageJa extends Language {
00009 function wordSegmentation( $string ) {
00010
00011
00012
00013
00014 $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
00015 $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
00016 $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
00017 . '|[\xe4-\xe8][\x80-\xbf]{2}'
00018 . '|\xe9[\x80-\xa5][\x80-\xbf]'
00019 . '|\xe9\xa6[\x80-\x99])';
00020 # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
00021 $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
00022 $s = self::insertSpace( $string, $reg );
00023 return $s;
00024 }
00025
00026 function normalizeForSearch( $string ) {
00027
00028 $s = self::convertDoubleWidth( $string );
00029
00030 # Do general case folding and UTF-8 armoring
00031 return parent::normalizeForSearch( $s );
00032 }
00033
00034 # Italic is not appropriate for Japanese script
00035 # Unfortunately most browsers do not recognise this, and render <em> as italic
00036 function emphasize( $text ) {
00037 return $text;
00038 }
00039 }