<?php
require_once "./Extractor.php";
$mode = new Model_Extractor() ;
error_reporting(0) ;
echo "
<h4> Extractor Class </h4>
<hr>
<p>
This class can be used to
Extract Repeated Patterns.<br>
First You need Provide Example text that contains patterns that you want to extract from other text( For Example it can be Phone Numbers Or Int numbers Or emails etc)<br>
NExt You need to call ExtractFromText MEthod Or ExtractTextBin method > differences beetween methods is that Bin method use hard compare algorythm.
<br>
And Finally all extracted data will be handled by from_text attrbuted and from_text_bin.<br>
Other MEthods :
<br>
finalExtractor() - Method that used one more try to extract patterns from text it used combination of native and bin methods for extraction.
<br>
isNormal() - Method return Int that indicates is similar Words Exists in example data It be used for Spam Check and Bad Words.
int >0 bad words int <= 0 similar word exist in example text.
<a href='ex.zip'> Download </a>
</p><hr>
<br><br><br><br><br><br><br>
" ;
/*
*
*
*Tests
*
*/
echo ' <h4> Test1 </h4>
<p> Examples Input : $mode->setExamples(array(
"my phone is 80972929292 phone " , " 0993455444 ", "cool 24234324234 phone " , " 98888433 ", " Here it is phone 80632627234",
"Phone number is 097723123232", "like 234234242342" , " state" ,"806782917317"
)); </p> ';
$mode->setExamples(array(
"my phone is 80972929292 phone " , " 0993455444 ", "cool 24234324234 phone " , " 98888433 ", " Here it is phone 80632627234",
"Phone number is 097723123232", "like 234234242342" , " state" ,"806782917317"
));
$mode->extractFromText(" like a sure phone 380672917326 80932627234 yeah and it slike 8093 old number 80993444543 9987");
$mode->extractFromTextBin(" 80622424234 ");
echo "<p>REsult: </p>";
print_r($mode->from_text);
echo "<h5> Bin Method </h5> ";
print_r($mode->from_text_bin);
echo '<h4> test 2 </h4>';
$mat = new Model_Extractor();
echo '
<p> Examples Input : $ $mat->setExamples(array("server_the_best_6555x344.swf","456","2342","234234","344","344","3322")); </p> ';
$mat->setExamples(array("server_the_best_6555x344.swf","456","2342","234234","344","344","3322"));
$mat->extractFromText("some_file_ord_567x433.swf") ;$mat->finalExtractor() ;
echo "result:";
print_r($mat->from_text_bin);
echo "<h4> Test 3 </h4> ";
$mat = new Model_Extractor();
$mat->setExamples(array("super_host_flash_1280x122.swf","123","1234","12345"));
$mat->extractFromText("some_flash_host_1233x98.swf");
$mat->finalExtractor();
echo "REsult : " ;
print_r($mat->from_text_bin);
echo "<h5> SERVER IsWord Normal Test </h5> ";
//server lexa test ///
$mat = new Model_Extractor();
// unComment this line to see that words that exists in examples will be ignored and int value will be 0
//$mat->setExamples(array("xoxoxoxoxoxoxoxo","lol","ahahah"));
echo $mat->isNormal("xoxoxoxoxo") ."<br>";
echo $mat->isNormal("ahahaha")."<br>";
echo $mat->isNormal("fuuuuuuuck")."<br>";
echo $mat->isNormal("suck")."<br>" ;
//$mat->isMatch("sadad");
|