Beispiel #1
0
$normalise = new Arabic('ArNormalise');

$file = fopen('./Normalization/sample.txt', 'r');

echo <<<END
<p>Processing <a href="./Normalization/sample.txt" target=_blank>input file</a> line by line</p>
<table border="0" cellpadding="5" cellspacing="2" dir="rtl">
END;

while($read = fgets($file)) {
    echo '<tr><th style="background-color: #E5E5E5">Function</th>
          <th style="background-color: #E5E5E5">Text</th></tr>';

    echo "<tr bgcolor=#F0F8FF><th>Original</th><td>$read</td></tr>";
    
    $n1 = $normalise->unshape($read);
    echo "<tr bgcolor=#F0F8FF><th>Unshape</th><td>$n1</td></tr>";
  
    $n2 = $normalise->utf8Strrev($n1);
    echo "<tr bgcolor=#F0F8FF><th>UTF8 Reverse</th><td>$n2</td></tr>";
  
    $n3 = $normalise->stripTashkeel($n2);
    echo "<tr bgcolor=#F0F8FF><th>Strip Tashkeel</th><td>$n3</td></tr>";
  
    $n4 = $normalise->stripTatweel($n3);
    echo "<tr bgcolor=#F0F8FF><th>Strip Tatweel</th><td>$n4</td></tr>";
  
    $n5 = $normalise->normaliseHamza($n4);
    echo "<tr bgcolor=#F0F8FF><th>Normalise Hamza</th><td>$n5</td></tr>";
  
    $n6 = $normalise->normaliseLamaleph($n5);