PHP Classes

File: testsummarizer1.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Mo´se  >  PHP Lazy Copy Summary Text  >  testsummarizer1.php  >  Download  
File: testsummarizer1.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP Lazy Copy Summary Text
Parse text copy to extract most relevant phrases
Author: By
Last change:
Date: 4 years ago
Size: 2,810 bytes


Class file image Download
require_once 'KeywordGenerator.php';
set_time_limit(0);//useless in most of cases;

$kwObj =new summarizer( new KeywordGenerator);
$str ="
Many articles on Internet are alike but they do not have at all the same importance as they don't have the same content.Because the advices for choose a good title are always the same, bloggers and other copy-writers are inclined to choose similar title when they come to talk about the same theme.

Users hate wasting their time.For many,time is money.And they won't read all the articles they see on the same theme exactly like you won't never click on every links on a search results page.Sometimes they click on a link that leads to your article but unfortunately they return because your article is very long and the start is boring...

How then,bring the users to know what to choose and give them not the feeling of waste of time but the good feeling and the desire to read again many articles or just your articles?

The present package is built with the intention to summarize copy and show your article in its best angle.

You can use it to get a summary of a book, an article or anything else that contains text to be understood.
This package can return the most relevant phrase or phrases , paragraph or paragraphs ,the shortest or the longest to summarize your content. And the number of phrase or paragraph to show can be chosen.
//show the most relevant paragraphs.
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'paragraph').'</div>');
//show most relevant phrase.
echo ('<div style="width:800px">'.$kwObj->getSummary($str).'</div>');
//show 3 short most relevant phrases
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'',true,true,null,true,3).'<div>');
//show 3 long most relevant phrases
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'',false,true,null,true,3).'<div>');
//show the short most relevant phrase
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'',true,true,null,true,1).'<div>');
//show the long most relevant phrase
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'',false,true,null,true,1).'<div>');
//show 3 short most relevant paragraphs
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'paragraph',true,true,null,true,3).'<div>');
//show 6 long most relevant paragraphs
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'paragraph',false,true,null,true,6).'<div>');
//show the short most relevant paragraphs
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'paragraph',true,true,null,true,1).'<div>');
//show the long most relevant paragraphs
echo ('<div style="width:800px">'.$kwObj->getSummary($str,'paragraph',false,true,null,true,1).'<div>');

For more information send a message to info at phpclasses dot org.