Test Ar-PHP Functionality Online

header line!
Test PHP Function










Ar-PHP Manual

static method tagText [line 290]

static array tagText( string $str)

Tag all words in a given Arabic string if they are nouns or not



Tags:

return:  Two dimension array where item[i][0] represent the word i in the given string, and item[i][1] is 1 if that word is noun and 0 if it is not
author:  Khaled Al-Sham'aa <khaled@ar-php.org>
access:  public


Parameters:

string   $str   Arabic string you want to tag all its words

Example
  1.      include('./I18N/Arabic.php');
  2.      $obj new I18N_Arabic('WordTag');
  3.  
  4.      $hStr=$obj->highlightText($str,'#80B020');
  5.  
  6.      echo $str '<hr />' $hStr '<hr />';
  7.  
  8.      $taggedText $obj->tagText($str);
  9.  
  10.      foreach($taggedText as $wordTag{
  11.          list($word$tag$wordTag;
  12.  
  13.          if ($tag == 1{
  14.              echo "<font color=#DBEC21>$word is Noun</font>, ";
  15.          }
  16.  
  17.          if ($tag == 0{
  18.              echo "$word is not Noun, ";
  19.          }
  20.      }
Popular
Recent
Links
Ads!
footer line!

No Software Patents! General Public License

Home | Twitter | Blog | Contact

Copyright © 2006 - 2016 Khaled Al-Sham'aa