MediaWiki
REL1_31
generateNormalizerDataMl.php
Go to the documentation of this file.
1
<?php
24
require_once __DIR__ .
'/../Maintenance.php'
;
25
33
class
GenerateNormalizerDataMl
extends
Maintenance
{
34
public
function
__construct
() {
35
parent::__construct();
36
$this->
addDescription
(
'Generate the normalizer data file for Malayalam'
);
37
}
38
39
public
function
getDbType
() {
40
return
Maintenance::DB_NONE
;
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::class;
70
require_once
RUN_MAINTENANCE_IF_MAIN
;
serialize
serialize()
Definition
ApiMessage.php:184
GenerateNormalizerDataMl
Generates the normalizer data file for Malayalam.
Definition
generateNormalizerDataMl.php:33
GenerateNormalizerDataMl\execute
execute()
Do the actual work.
Definition
generateNormalizerDataMl.php:43
GenerateNormalizerDataMl\__construct
__construct()
Default constructor.
Definition
generateNormalizerDataMl.php:34
GenerateNormalizerDataMl\getDbType
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Definition
generateNormalizerDataMl.php:39
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
maintenance.txt:39
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition
Maintenance.php:66
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:291
$IP
$IP
Definition
update.php:3
$maintClass
$maintClass
Definition
generateNormalizerDataMl.php:69
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition
maintenance.txt:50
$source
$source
Definition
mwdoc-filter.php:46
maintenance
language
generateNormalizerDataMl.php
Generated on Mon Nov 25 2024 15:36:02 for MediaWiki by
1.10.0