PHP Classes

File: Example.php

Recommend this page to a friend!
  Classes of Pashkov Denis Igorevich   PHP Text Classification   Example.php   Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example
Class: PHP Text Classification
Classify and cluster text by root words
Author: By
Last change: noith
Date: 11 years ago
Size: 3,551 bytes
 

Contents

Class file image Download
<?php
use webndesign\Parser;

 

include
"Parser.php";
include
"Word.php" ;
use \
webndesign;
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;


//Examples Stack for the :
$parser = new Parser(array(
       
"we are cool persons like server one",
       
"upiter is the fifth planet from the Sun and the largest planet in the Solar System.[13] It is a gas giant with mass one-thousandth that of the Sun but is two and a half times the mass of all the other planets in the Solar System combined. Jupiter is classified as a gas giant along with Saturn, Uranus and Neptune. Together, these four planets are sometimes referred to as the Jovian or outer planets.",
       
"Wilde was born in New York City. Her mother, Leslie Cockburn (née Redlich), is an American-born 60 Minutes producer and journalist. Her father, Andrew Myles Cockburn, a journalist, was born in London to British parents, and raised in Ireland; her uncles, Alexander Cockburn and Patrick Cockburn, also worked as journalists. Wilde's older sister, Chloe Cockburn, is a civil rights attorney in New York; her aunt, Sarah Caudwell, was a writer, and her paternal grandfather, Claud Cockburn, was a novelist and journalist.",
       
" Combs was born in San Diego, California. At the time of her birth, her mother, Lauralei Combs (née Berckhem), was sixteen years old and her father was seventeen.[4] Combs' biological parents married, but the two split up after two years,[5] feeling they were too young to make a marriage work. While Combs was learning to walk, she hit her head on a marble table, resulting in a scar over her right eyebrow. "
       
,"exa Doig was born Alexandra Lecciones Doig in Toronto, Ontario, Canada on June 8, 1973. Nicknamed she is the younger child of Gloria B. Lecciones and David W. Doig. Her mother is a Filipino Registered Nurse who originally came from Dumaguete City, Philippines, and her father is a Canadian engineer of Scottish and Irish descent who was a petroleum Executive Officer in Toronto.[7]"
       
,"Mars is the fourth planet from the Sun and the second smallest planet in the Solar System. Named after the Roman god of war, it is often described as the, as the iron oxide prevalent on its surface gives it a reddish appearance.[14] Mars is a terrestrial planet with a thin atmosphere, having surface features reminiscent both of the impact craters of the Moon and the volcanoes, valleys, deserts, and polar ice caps of Earth. The rotational period and seasonal cycles of Mars are likewise similar to those of Earth, as is the tilt that produces the seasons. "
       
, "Venus is the second planet from the Sun, orbiting it every 224.7 Earth days. The planet is named after the Roman goddess of love and beauty.",
       
"server is cool so cool man "
       
)) ;


//$parser->setClusterLimit(10);
echo " Testing Values Stack <br> ";
 
$parser->parse();
 
  echo
"<p> Clustered </p>";
 
 
 
// Get lowes Delimetr...
 
echo $parser->getminDLI() ;
 
 
 
 
// Set how many items per cluster
 
$parser->setDelim($parser->getminDLI());
 
 foreach (
$parser->classify() as $c){
     echo
$c . "<br>";
 }
 
 echo
"<hr> <p> Words And Roots </p>";
 
$parser = new Parser(array("Person word persons "));
 
$parser->parse();
 
 
print_r($parser->getResult());
 
 
 
$time = microtime();
 
$time = explode(' ', $time);
 
$time = $time[1] + $time[0];
 
$finish = $time;
 
$total_time = round(($finish - $start), 4);
 echo
'<h3> Page generated in '.$total_time.' seconds.</h3>';