alhoqbani / ar-php Goto Github PK
View Code? Open in Web Editor NEWBasic utilities to support Arabic in PHP
License: GNU General Public License v3.0
Basic utilities to support Arabic in PHP
License: GNU General Public License v3.0
The same as in #14 doRateSummarize has the same undefined variable.
Method cleanCommon performs str_replace
on the full string, without parsing the string into separate words.
This will remove stopwords from the string even if it was part of a word. For example, الأهل
will be replaced with الأ
because هل
, which is part of the word, is a stopword.
It should use preg_replace
to replace only fill words, or explode the string into array of words.
The method allForms is returning a string of words after processing the argument by allWordForms
which returns an array.
There should an option to return the array without imploding into a string.
normaliseLamaleph
method has undefined variables and indexes.
It should be fixed or removed.
For now, It will be disabled because it causing the main method normalise
to fail.
From the example file:
"ٍمخصمغ لاعف سعقثمغ"
is swapped as: Slowly ghut surely
where it should be: Slowly but surely
.
It's shown in the test at line 68
When passing an array to setArrFields
, class I18N_Arabic:: __call
does not pass the arguments.
This is because in #10 we put a condition to pass params only if string or numeric.
The array should be passed directly, or after calling iconv
on all elements.
The method dateCorrection
is supposed to calculate the correction factor for the Hijri date conversion based on Um Alqura calendar. It supports date range 1420-1459, and should return a correction factor range from -2 to +2.
However, the method is not working and almost always returns 0.
I have tested every month from the supported range (1420-1459). Out of 456 tested months, only 21 months returned a value different than 0, which does not seem right.
This commit a121197 adds a test to check the functionality of the method.
$this->_chars['HAMZA_ABOVE,HAMZA_BELOW']
seems to have a typo which throw a notice causing the test to fail.
Notice: Undefined index: HAMZA_ABOVE,HAMZA_BELOW in /Users/hamoud/Sites/i18n/Arabic/Normalise.php on line 176
doSummarize
method in line 298 is passing undefind $style
to summarize
method, but it does not accept style parameter.
It should be removed.
Some methods calls, for example, setMode on the Date class will throw a warning causing the test to fail.
This is because setMode is returning the object which is passed to iconv as the third parameters.
For now, iconv should be wrapped on an if statement to be called when the value is string.
Method str2int1
cause an error on line 433 when checking $segment[$key]
because it might not be defined.
Undefined offset: 27 in Line 291
mehtod unshape
is not working.
It should replace Arabic letter for its joined form to the standalone shape.
e.g. أحمد should be أ ح م د with no spaces !!
it failed to do the replacement when passed a string. However, it can replace a single character which is not useful.
Also, the use case for this method is not clear to me.
setlocale at line 189 in the Transliteration class is causing a problem in other parts of the code.
When running the full test suit, codes with preg_split fail.
I have no idea, why. but for now I will comment out this line.
This method is not used anywhere and it's already defined in ArUnicode.constants.php
It should be removed.
On line 587 an Undefined offset notice is thrown. This is because $sentences
and $stemmedSentences
don't have the same elements count.
The char_names array references Unicode Character 0x0670
twice with the keys SMALL_ALEF and MINI_ALEF.
This is casing the method isSamll()
to fail when passed a small Alef, because the the array search return the first key SMALL_ALEF
.
The duplication must be resolved by removing one of the two elements.
The stemmer class outcome needs improvements. The results are close to useless.
When the date is changed using one of Carbon methods, e.g. addDays
, the Hijri date does not change accordingly.
$arD = ArUtil::date()->arCreateFromDate(1438, 10, 15);
$arD->addDays(10);
echo $arD->arDay // 15 <- should be 25
Method str2graph
from Hiero class will fail the test when passed Arabic text with a space.
This is because the array of arabic letters does not have a space. And line 225 $char = $arabic[$char]
checks for a space which casues an undefined index notice when a text has a space.
We either add the space to the array or check if the index is set.
Error in defining constants at line 152
When changes were made to the method __call
in the main Arabic class to address #10 & #19. Some params are not passed to the called method if it's not one of the types (string, numeric, and array) specified in the foreach which applied to filter the params.
For example, when trying to implement #29 by passing a boolean flag to the method, it was not passed to the target method.
There should a catch all clause to pass any params which is not processed by the foreach.
All example pages need to be updated.
The example code part of the page should be updated to show the new usage after using composer.
When any of these methods is called (setMode, getMode & setLang
) , line 255 will try to reload their respective classes. This is because different classes have methods with the same name (Date, Query, Soundex, CompressStr).
However, this leads to invoking the wrong class. For example, calling Query::setMode, will invoke Date::setMode because Date comes before Query in the config.xml
When using arFromat
, the method setOutputMode
will change the output language and month names.
For example:
اللئيم
to be
اللييم
and تهنِئة
to تهنِية
It does not normalize YEH_HAMZA or WAW_HAMZA.
This is caused by typo in the array
Method isHaraka and isTashkeel are closely similar.
The only difference is that isHaraka
does not include SHADDA.
Do we need them both?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.