Recommend this page to a friend! |
Download |
Info | Example | Screenshots | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 59 | All time: 10,513 This week: 46 |
Version | License | PHP version | Categories | |||
php-awr-class 5 | The PHP License | 5 | PHP 5, Text processing |
Description | Author | |
This package is specific mainly for applications used in Saudi Arabia .
This package can process text to apply rules to display arabic text. Innovation Award
|
<meta charset="utf-8" />
|
awr is an advance wordprocessor/rulemaking for the Arabic language especially used for apply/showing Quran tajwid rules in real-time online demo :
with this class, you can make rules based on characters and their position to each other, tag them an show them with different colors
$verse = "quran text";
$verse2 = new awr_process($verse);
$verse2->register_filter("filter_qalqala");
$verse2->register_filter("filter_ghunna");
$verse2->register_filter("filter_lqlab");
$verse2->register_filter("filter_ikhfaa");
$verse2->register_filter("filter_idgham");
$verse2->register_filter("filter_idgham_without_ghunna");
$verse2->register_filter("filter_maddah");
$verse2->process();
$verse2->reorder();
$verse2->render();
$awr = new awr_process($text);
there are 7 rules that I created as part of tajwid rules
in order for filters/rules to work they must be registered you can register filters/rules with
$awr->register_filter("filter name");
for example
$awr->register_filter("filter_qalqala");
in order to fillters to work you have to call process() function . it will run every filter for every charecter in the text
$awr->process();
after that reorder() must be called to restore characters original forms
$awr->reorder();
to render the final results you have to call render() function . it will echo processed character in <n> tag
$awr->render();
render has 2 parameters
$awr->render($tag,$return);
$tag can be used to change the "n" in <n> tag
$return can be used to switch between echo and return
private function wordrule_applyer($wordkey, $key, $tag, $words, $attachedby=false, $followedby=false, $followedbyattach=false, $lastlettercheck=false, $erab_flag=false)
all the filters in the class are using wordrule_applyer to set a custom rule to check in the word.
the function will return true if it finds the rule in the current position.
after understanding the wordrule_applyer you can simply create your Arabic rules
let's take look at some of the filters in the class :
public function filter_qalqala($key1, $key2)
{
$charecters = array(
'\u0642',
'\ufed5',
'\ufed6', //?
'\ufed7',
'\ufed8',
'\u0637',
'\ufec1',
'\ufec2', //?
'\ufec3',
'\ufec4',
'\u0628',
'\ufe8f',
'\ufe90', //?
'\ufe91',
'\ufe92',
'\u062c',
'\ufe9d',
'\ufe9e', //?
'\ufea0',
'\ufe9f',
'\u062f',
'\ufea9', //?
'\ufeaa'
);
$sukun = array("\u0652");
$rule1 = $this->wordrule_applyer($key1, $key2, "qalqala", $charecters, $sukun);
$rule2 = $this->wordrule_applyer($key1, $key2, "qalqala", $charecters, false, false, false, true, true);
/*
some of Quran surah that I checked manually for this filter :
falaq,ikhlas,masadd,nasr,kafiroon,kauther
*/
return ($rule1 || $rule2);
}
this is qalqala filter . in this filter we are looking for
public function filter_lqlab($key1, $key2)
{
$erabha = array(
'\u064b',
'\u064d',
'\u064c'
);
$n = array(
'\u0646',
'\ufee5',
'\ufee6', //?
'\ufee8',
'\ufee7'
);
$b = array(
'\u0628',
'\ufe8f',
'\ufe90', //?
'\ufe91',
'\ufe92'
);
$sukon = array("\u0652");
$rule1 = $this->wordrule_applyer($key1, $key2, "lqlab", $erabha, $b);
$rule2 = $this->wordrule_applyer($key1, $key2, "lqlab", $erabha, array("erab"), $b);
$rule3 = $this->wordrule_applyer($key1, $key2, "lqlab", $n, $sukon, $b);
$rule4 = $this->wordrule_applyer($key1, $key2, "lqlab", $n, $b);
/*
some of Quran surah that I checked manually for this filter :
baqara:10,18,19,27,31,33
*/
return ($rule1 || $rule2 || $rule3 || $rule4);
}
or in the lqlab filter - $rule1 we are looking for a list of Arabic Irabs "$erabha" that are attached by "$b" ( "?" ) - $rule2 is like the previous rule but with one level we are accepting additional Irabs between "$erabha" and "$b" - $rule3 we are looking for the "$n" ( "?" ) that are attached by "$sukon" ( special Arabic irab ) and are followed by "$b" - $rule4 is like the previous rule but we don't check for "$sukon" because sukon basically means a word without irab so if we check for the $n and $b that there is nothing between them is like checking for $sukon in rule3.
Screenshots (2) | ||
Files (11) |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
persian_log2vis-2.0 (3 files) | ||||
awr_process.php | Class | Class source | ||
demo.php | Example | Example script | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files (11) | / | .github | / | ISSUE_TEMPLATE |
File | Role | Description |
---|---|---|
bug_report.md | Data | Auxiliary data |
feature_request.md | Data | Auxiliary data |
Files (11) | / | persian_log2vis-2.0 |
File | Role | Description |
---|---|---|
bidi.php | Class | Class source |
persian_log2vis.php | Example | Example script |
unicode_data.php | Aux. | Auxiliary script |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
81% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
github url |