PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   ArWordTag   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArWordTag
Determining the type of Arabic words
Author: By
Last change: Richer example
Date: 17 years ago
Size: 1,955 bytes
 

 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=windows-1256" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Tagging Arabic Text</title>
</head>

<body>

<center>
<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="example.php">Example</a>
  <a class="tab" href="about.html">About</a>
</div>

<div class="Paragraph">

<h2>Tagging Arabic Text Example:</h2><br />


<?php
   
include('ArWordTag.class.php');
   
$obj = new ArWordTag();

   
$str = "ÇáãÚÑÖ ÓíÞÇã Úáì ÃÑÖ ãÏíäÉ ÇáãÚÇÑÖ Ýí ÏãÔÞ æ ÊÔÇÑß Ýíå ãÌãæÚÉ ãä ãÄÓÓÇÊ ÇáÞØÇÚ ÇáÚÇã æ ÇáÎÇÕ Ýí ÓæÑíÉ æÐáß ÈÊÇÑíÎ 2 ÃÛÓØÓ 2005";
   
$str = 'æÍÓÈ ÅÍÕÇÆíÉ áæÒÇÑÉ ÇáÏÝÇÚ ÇáÃãíÑßíÉ ãÇ ÒÇá äÍæ 375 ãÚÊÞáÇ íÞÈÚæä Ýí ÛæÇäÊÇäÇãæ Ýí ÅØÇÑ ãÇ íÓãì " ÇáÍÑÈ Úáì ÇáÅÑåÇÈ "¡ ãäåã ßËíÑæä ãÍÊÌÒæä ãäÐ ÃßËÑ ãä ÎãÓ ÓäæÇÊ æãä Èíäåã ãÕæÑ ÞäÇÉ ÇáÌÒíÑÉ ÓÇãí ÇáÍÇÌ ÇáÐí áã ÊæÌå áå Ãí ÊåãÉ ÑÓãíÉ æáã íÍÙ ÈÃí ãÍÇßãÉ ÍÊì ÇáÂä.';
   
$highlightStr = $obj->highlightText($str);
    echo
'<div dir="rtl" align="justify">'.$str.'<hr />'.$highlightStr.'<hr /></div>';

   
$taggedText = $obj->tagText($str);

    foreach(
$taggedText as $wordTag){
        list(
$word, $tag) = $wordTag;

        if(
$tag == 1){
            echo
"<font color=blue>$word is Noun</font><br>";
        }

        if(
$tag == 0){
            echo
"<font color=red>$word is not Noun</font><br>";
        }
    }

?>

</div>
<br />
</div>
</center>
          <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
          </script>
          <script type="text/javascript">
          _uacct = "UA-1268287-1";
          urchinTracker();
          </script>
</body>
</html>