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

Re: TashkeelHandler: A QT C++ Class



Wa aleykum as-salaam Abdalla,

Mashallah TashkeelHandler sounds very powerful. I would be delighted to see a version of QT GUI that provides the user the option to view the Quran text with varying levels of marks. I lack the C++ skills to do this myself though. If you add this feature by any chance in a future GUI version that would be neat.

Thank you,
Mete

---------- Original Message ----------------------------------
From: Abdalla Alothman <abdalla at pheye dot net>
Reply-To: abdalla at pheye dot net,Development Discussions <developer at arabeyes dot org>
Date:  Thu, 1 Sep 2005 00:12:36 +0300

>Asalamu alaikum, Mete
>
>On Wednesday 31 August 2005 22:39, Mete Kural wrote:
>
>> Is it possible to use this new "Removing all diacritical
>> marks from an Arabic string" feature in TashkilHandler to
>> enable an option in QT to display Quran text without diacritical
>> marks?
>
>You could rewrite the driver, and call removeTashkeel(line, tashkeel_set)
>(see example below).
>
>If you want to remove tashkeel from all of the Quran, you can do it with
>this class. But you have to write a program that passes all the Quran
>to removeTashkeel.
>
>> Also I think more options that enable the user to select the level of diacritical
>> marks to use would be neat too (for example possible options could be: "Don't
>> display tajweed marks", "Don't display tajweed marks and vowel marks",
>> "Don't display any marks").
>
>This can be done by providing a value (a regexp string) for "a."
>I am sending a blank string when I say QString a(""); It could be
>any regex (A QString, not a QRegExp). The regex I use is found in
>the constructor:
>
>tashkeelstr = QString::fromUtf8("([ًٌٍَُِّْ]){0,2}");
>
>the brackets contain all tasheel marks. You can initialize "a" as:
>
>QString a("([dhammafatHa]){0,2}"); // see example below.
>
>instead of:
>
>> >        QString a("");
>
>And then send it
>
>> >        h1->removeTashkeel(line, a);
>
>This will leave the sukoons, shadda, etc. See the output file after
>you try the second example below. The first line is the aya without
>any tashkeel, the second is with the dhamma and fatHa removed -- rest
>of the marks are there:
>في مقعد صدق عند مليك مقتدر
>فِي مقْعدِ صِدْقٍ عِند ملِيكٍ مّقْتدِرٍ
>
>This is handled in the beginning of the member function:
>
>> >  void TashkeelHandler::removeTashkeel(QString &in, QString &r1)
>> > {
>> >    QString rule1;
>> >   if(r1.isEmpty())
>> >   {
>> >     rule1 = tashkeelstr.utf8();
>> >   }
>> >   else rule1 = r1;
>
>It first checks if you have provided a tashkeel set. If not, it uses
>the default tashkeel set, tashkeelstr, which includes all diacritical
>marks.
>
>This doesn't apply to tajweed symbols. I think tajweed symbols need to
>be classified separately by their usage. For example, a class for stops
>and continues,  additions but no pronunciation, pronounce  letter "seen"
>instead of Saad, sujood al-tilawa, etc.
>
>Wishing you peace and good health.
>
>Salam,
>Abdalla Alothman
>
>///////////////////////////////////////////////////////////////////
>// FILE: removet.cc
>// Test drives class TashkeelHandler
>// By Abdalla Alothman - abdalla at pheye dot net - August 31, 2005
>//
>// compile with: g++ tashkeelhandler.cc removet.cc -o removet -lqt
>///////////////////////////////////////////////////////////////////
>
>#include "tashkeelhandler.h"
>#include <qfile.h>
>#include <iostream>
>#include <string>
>#include <memory>
>#include <qtextstream.h>
>// Class declared in namespace trule1, so use using
>// qualify the instance(s)
>using namespace trule1;
>using namespace std;
>
>int main()
>{
>  QFile f1("054-alqamar-utf.txt");
>  QFile f2("notashkeel.txt");
>  QTextStream tstream2(&f2);
>  tstream2.setEncoding(QTextStream::UnicodeUTF8);
>  QString a("");
>
>  if(f1.open(IO_ReadOnly) && f2.open(IO_WriteOnly))
>  {
>    QString line("");
>    auto_ptr<TashkeelHandler> h1(new TashkeelHandler);
>    QTextStream tstream(&f1);
>
>    while( !tstream.eof() )
>    {
>      a = ""; // reset a
>      line = tstream.readLine();
>      QString line2(line);
>      // remove all tashkeel
>      h1->removeTashkeel(line, a);
>      tstream2 << line
>               << endl;
>       // a now contains dhamma and fatHa
>       a = "([َُ]){0,2}";
>       // remove only dhamma and fatHa.
>       h1->removeTashkeel(line2, a);
>       tstream2 << line2 << endl;
>    }
>  }
>  return 0;
>}
>_______________________________________________
>Developer mailing list
>Developer at arabeyes dot org
>http://lists.arabeyes.org/mailman/listinfo/developer
>

--
Mete Kural
Touchtone Corporation
714-755-2810
--