-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtransliterate.php
45 lines (29 loc) · 1.17 KB
/
transliterate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?PHP
// Pre-Correction : Textual Replacements made in Harvard Kyoto Encoded Text
// Post-Correction : Textual Replacements made in Unicode Indic Text
function transliterate($text,$source,$target)
{
include "./diCrunch/diCrunch_config-en.php";
include "./diCrunch/diCrunch_charsets.php";
include "./diCrunch/diCrunch_preprocess.php";
$text = stripslashes($text);
if (!empty($text)) {
$text = str_replace($ch[$source], $ch['hk'], $text);
include "./diCrunch/diCrunch_Pre_Correction.php";
$text = str_replace($ch['hk'], $ch[$target], $text);
}
include "./diCrunch/diCrunch_postprocess.php";
/* Script cruncher */
if (in_array($source, $indic_scripts)) {
include "./diCrunch/diCrunch_{$source}.php";
include "./diCrunch/diCrunch_indic_source.php";
include "./diCrunch/diCrunch_Pre_Correction.php";
$text = str_replace($ch['hk'], $ch[$target], $text);
}
if (in_array($target, $indic_scripts)) {
include "./diCrunch/diCrunch_{$target}.php";
include "./diCrunch/diCrunch_indic_target.php";
}
include "./diCrunch/diCrunch_Post_Correction.php";
return $text;
}