-
Notifications
You must be signed in to change notification settings - Fork 1
/
diCrunch_preprocess.php
61 lines (39 loc) · 1.33 KB
/
diCrunch_preprocess.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?PHP
/* More options */
if (!empty($_POST['vtob'])) {
$text = str_replace("v", "b", $text);
}
if (!empty($_POST['removedot'])) {
$text = str_replace(".", "", $text);
}
if (!empty($_POST['swapy'])) {
$text = str_replace("y", "*y*", $text);
$text = str_replace("Y", "y", $text);
$text = str_replace("*y*", "Y", $text);
}
if (!empty($_POST['c_search'])) {
$se = explode(";", $_POST['c_search']);
$re = explode(";", $_POST['c_replace']);
$text = str_replace($se, $re, $text);
}
if ($_POST['src'] == "unicode") // support both Ms in input by standardizing
{
$text = str_replace("ṃ", "ṁ", $text);
}
/* First character of line as full vowel in scripts */
$text = str_replace("\n", "\n ", $text);
/* Exceptions */
if (!empty($_POST['src'])) {
/* Evading the ~n to .s (Bal) and .t (CSX) problem by temporary renaming */
if ($_POST['src'] == "balaram" || $_POST['src'] == "csx") {
$ch[$_POST['tgt']]['ex']['7'] = $ch[$_POST['tgt']]['7'];
$ch[$_POST['tgt']]['7'] = "--j--";
}
/* ITRANS alternative normalizing */
if ($_POST['src'] == "itrans") {
$se = array("AUM", "aa", "ii", "uu", "RRi", "RRI","LLi", "LLI", "N^", "ssh", "GY", "dny", "JN", "x", ".m", ".n");
$re = array("oM", "A", "I", "U", "R^i", "R^I", "L^i", "L^I", "~N", "Sh", "j~n", "j~n", "j~n","kS", "M", "M");
$text = str_replace($se, $re, $text);
}
}
?>