MediaWiki master
LanguageJa.php
Go to the documentation of this file.
1<?php
22
28class LanguageJa extends Language {
29
31 private const WORD_SEG_HIRAGANA = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))';
32
34 private const WORD_SEG_KATAKANA = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))';
35
37 private const WORD_SEG_KANJI =
38 '(?:\xe3[\x88-\xbf][\x80-\xbf]|[\xe4-\xe8][\x80-\xbf]{2}|\xe9[\x80-\xa5][\x80-\xbf]|\xe9\xa6[\x80-\x99])';
39
40 private const WORD_SEGMENTATION_REGEX =
41 '/(' . self::WORD_SEG_HIRAGANA . '+|' . self::WORD_SEG_KATAKANA . '+|' . self::WORD_SEG_KANJI . '+)/';
42
43 public function segmentByWord( $string ) {
44 return self::insertSpace( $string, self::WORD_SEGMENTATION_REGEX );
45 }
46
54 public function emphasize( $text ) {
55 return $text;
56 }
57}
Japanese (日本語)
segmentByWord( $string)
Some languages such as Chinese require word segmentation, Specify such segmentation when overridden i...
emphasize( $text)
Italic is not appropriate for Japanese script.
Base class for language-specific code.
Definition Language.php:79
static insertSpace( $string, $pattern)