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: 16 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>