[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Presentation and question about quran project



On Sunday 22 September 2002 20:58, Amin Moro wrote:

> Salam
>
> I'm Amin. First of all, say hello and congratulation for all your great
> work and efforts.
Thanks, and sorry for this late
> I'm very interested in quran project. I have just downloaded cvs code and i
> see quran texts are in xml. I'd like to work in a spanish version, if no
> one is doing it. 2 questions:
> 	-Is a certain license for the text required nor just permission to this
> project would be enough (to look for a good spanish translation) ?
Most (if not all) translators don't expect/want any money from their work in
translating the Qur'an, so I don't think they would mind if we used their 
translation, but anyway a permission to use their text would be nice :-)
> 	-Is there any automated engine to generate the xml?
well, that depends, if you have the text in a database it will be trivial
to write a script to generate the xml file (Hatem already did that)
If you have the text in a file, there should be another way to parse it
For example , Shaykh Ahmad Darwish <mosque at mosque dot com>
sent me an english translation in M$ Word format, I looked at it and find
it to be organized this way :

114 People -An-Nas

In the Name of Allah, the Merciful, the Most Merciful 

[114.1] Say: 'I take refuge with the Lord of people, 
[114.2] the King of people, 
[114.3] the God of people, 
[114.4] from the evil of the slinking whisperer.
[114.5] who whispers in the chests of people,
[114.6] both jinn and people.'

so I opened it with KWord and copied it to Katoob and saved it as quran.txt
Then I wrote the attached php script to parse quran.txt and output 
quran.en.xml !

I hope that was helpful
Thanks again for your interest :-)


-- 
Mohammed Yousif
"She is in my mind and soul, I love her with all my heart and blood".
We _will_ restore OUR Jerusalem.

<?php
$text = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
$text .= "      <quran>\n";
$text .= "            <translatedby name=\"Grand Shaykh, Professor Hasan Qaribullah and Shaykh, Ahmad Darwish\"/>\n";
$fp = @fopen ("quran.txt", "r");
$isFirstSura = 1;
while (!feof ($fp)) {
    $line = fgets($fp, 4096);
    if ($line[0] == 'I' && $line[1] == 'n' && $line[2] == ' ' && $line[3] == 't')
       continue;
    if ( $line[1] == ' ' || $line[2] == ' ' || $line[3] == ' ') {
       $sura_id = $line[0];      //If the id is only one digit
       if ( $line[2] == ' ' ) {      //If the id consists of two digits
          $sura_id .= $line[1];
       }
       if ( $line[3] == ' ' ) {      //If the id consists of three digits
          $sura_id .= $line[1].$line[2];
       }
       $temp = explode (" -", $line);
       $english = str_replace ("$sura_id ", '', $temp[0]);
       $arabic = trim($temp[1]);
       $sura_n = $english." (".$arabic.")";
       if (!$isFirstSura)
          $text .= "            </sura>\n";
       $text .= "            <sura id=\"$sura_id\" name=\"$sura_n\">\n";
       if ($isFirstSura)
          $isFirstSura = 0;
    }

    if ( $line[0] == '[' ) {
       $temp1 = explode (']', $line);
       $temp = explode ('.', $temp1[0]);
       $aya_id = $temp[1];
       $aya_text = trim($temp1[1]);
       $text .= "                  <aya id=\"$aya_id\">\n";
       $text .= "                        <qurantext>$aya_text</qurantext>\n";
       $text .= "                  </aya>\n";
    }
}
@fclose ($fp);
$text .= "            </sura>\n";
$text .= "      </quran>\n";
$fp = @fopen ("quran.en.xml", "w");
fwrite ($fp, $text);
@fclose ($fp);
?>