MediaWiki  REL1_22
LanguageJa.php
Go to the documentation of this file.
00001 <?php
00029 class LanguageJa extends Language {
00030 
00035     function segmentByWord( $string ) {
00036         // Strip known punctuation ?
00037         // $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
00038 
00039         // Space strings of like hiragana/katakana/kanji
00040         $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
00041         $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
00042         $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
00043             . '|[\xe4-\xe8][\x80-\xbf]{2}'
00044             . '|\xe9[\x80-\xa5][\x80-\xbf]'
00045             . '|\xe9\xa6[\x80-\x99])';
00046             # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
00047         $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
00048         $s = self::insertSpace( $string, $reg );
00049         return $s;
00050     }
00051 
00059     function emphasize( $text ) {
00060         return $text;
00061     }
00062 }