MediaWiki REL1_30
generateNormalizerDataMl.php
Go to the documentation of this file.
1<?php
24require_once __DIR__ . '/../Maintenance.php';
25
34 public function __construct() {
35 parent::__construct();
36 $this->addDescription( 'Generate the normalizer data file for Malayalam' );
37 }
38
39 public function getDbType() {
41 }
42
43 public function execute() {
44 $hexPairs = [
45 # From http://unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
46 '0D23 0D4D 200D' => '0D7A',
47 '0D28 0D4D 200D' => '0D7B',
48 '0D30 0D4D 200D' => '0D7C',
49 '0D32 0D4D 200D' => '0D7D',
50 '0D33 0D4D 200D' => '0D7E',
51
52 # From http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
53 '0D15 0D4D 200D' => '0D7F',
54 ];
55
56 $pairs = [];
57 foreach ( $hexPairs as $hexSource => $hexDest ) {
58 $source = UtfNormal\Utils::hexSequenceToUtf8( $hexSource );
59 $dest = UtfNormal\Utils::hexSequenceToUtf8( $hexDest );
60 $pairs[$source] = $dest;
61 }
62
63 global $IP;
64 file_put_contents( "$IP/serialized/normalize-ml.ser", serialize( $pairs ) );
65 echo "ml: " . count( $pairs ) . " pairs written.\n";
66 }
67}
68
69$maintClass = 'GenerateNormalizerDataMl';
70require_once RUN_MAINTENANCE_IF_MAIN;
serialize()
Generates the normalizer data file for Malayalam.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
const DB_NONE
Constants for DB access type.
addDescription( $text)
Set the description text.
$IP
Definition update.php:3
require_once RUN_MAINTENANCE_IF_MAIN
$source