PHP Classes

File: Examples.php

Recommend this page to a friend!
  Classes of Lionel F. Lebeau   PHP Get All Words   Examples.php   Download  
File: Examples.php
Role: Example script
Content type: text/plain
Description: Examples
Class: PHP Get All Words
Extract all words from string excluding stop words
Author: By
Last change:
Date: 8 years ago
Size: 1,727 bytes
 

Contents

Class file image Download
<?php
// français
//$text = "Un été à Quibron.";
//$stopwords = array('un','à');

// anglais avec apostrophe et I dans les deux casses
//$text = "Now in 2016, it's 12:28. I am mikel and i from USA";
//$stopwords = array('a','I','the');

// anglais multilignes
/*$text = "After having owned the BMW X3, the MDX is a pleasure to drive.
 Reliability is great for 25,000 miles. Only things wrong are Bluetooth; rings and cannot hear whose on the other end and many viable addresses do not show up on Navigation system.
 Dealer service excellent.
 A few miss-steps in design; no lights for A/C controls at night; rear view pic doesn't come on in reverse for 10 seconds, some wind noise, transmission can be rough and erratic. No ipod plug which I didn't realize until after I purchased. Front end design could be improved, very masculine.
 Sounds like a lot but I do really like this car.
 Also test drove BMW X5 and Lexus 400.";*/
//$stopwords = array('a','I','the','no');

// chinois
/*$text = "????????????????????????????????????????????????????????

????????

?????";*/
//$stopwords = array('?????','???');

// arabe :
//$text = "???? ?? ???.";
//$stopwords = array('??');

// hébreux :
//$text = "???? ??? ???.";
//$stopwords = array('???');

// allemand :
//$text = "Können Sie mir helfen Über das? ";
//$stopwords = array('über');

$getwords = new get_words($text,$stopwords,true);
$words = $getwords->getWords();
//var_dump($words);
if(PHP_SAPI != 'cli'){
    print
'<pre>';
   
print_r($words);
    print
'</pre>';
}else{
   
print_r($words);
}
?>