PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   ArAutoSummarize   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArAutoSummarize
Extract summary phrases from an Arabic text
Author: By
Last change: Fix bug in reading ratio value!
Date: 16 years ago
Size: 2,825 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" />
<meta name="description" content="Block template has been developed to be used in RAMA CMS" />
<meta name="keywords" content="xhtml, css, html, printing, template" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Arabic Auto Summarize Class</title>
</head>

<body dir="rtl">

<center>
<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />

<div class="Paragraph">

<h2 dir="ltr">Arabic Auto Summarize Class</h2><br />
<font face="Tahoma" size="2">
<?php
@ini_set('zend.ze1_compatibility_mode', '1');

include_once(
'ArAutoSummarize.class.php');
$obj = new ArAutoSummarize();
$dir = 'folder/';

if(!isset(
$_GET['file'])){
    if(!isset(
$_GET['rate'])){ $rate = 20; }else{ $rate = $_GET['rate']; }

    echo
'<form action="example.php" method="get" name="setRate">
          <select name="rate" onChange="document.setRate.submit()">'
;

    for(
$i=10; $i<50; $i+=10){
        if(
$i == $rate){ $selected = 'selected'; }else{ $selected = ''; }
        echo
"<option value=\"$i\" $selected>%$i من حجم الوثيقة الأصلية</option>";
    }

    echo
'</select></form><hr>';

    if (
$dhandle = opendir($dir)) {
        while (
false !== ($file = readdir($dhandle))) {
            if (
$file != "." && $file != "..") {
               
// get contents of a file into a string
               
$fhandle = fopen($dir.$file, "r");
               
$contents = fread($fhandle, filesize($dir.$file));
               
fclose($fhandle);

               
$summary = $obj->doRateSummarize($contents, $rate, $_GET['q']);
                echo
"<b><a href=\"example.php?file=$file&rate=$rate\">$file</a>:</b><br />$summary<hr>";
            }
        }
       
closedir($dhandle);
    }
}else{
   
$file = $_GET['file'];
   
$rate = $_GET['rate'];

   
// get contents of a file into a string
   
$fhandle = fopen($dir.$file, "r");
   
$contents = fread($fhandle, filesize($dir.$file));
   
fclose($fhandle);

   
$highlighted = $obj->highlightRateSummary($contents, $rate, $_GET['q']);
   
$metaKeywords = $obj->getMetaKeywords($contents, $rate);
   
    echo
"<b>$file:</b><br />$metaKeywords<hr />$highlighted<br /><br /><a href=\"example.php?rate=$rate\">Back</a>";
}
?>
</font>
</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>