Example #1
0
function checkSpelling($Word, $WordArray, $UsedWords)
{
    $BloomConverted = join('', bloomFilter($Word));
    //echo 'Spell rande';
    //print_r($WordArray);
    if (search($BloomConverted, $UsedWords) == True) {
        return True;
    } else {
        if (search($BloomConverted, $WordArray) == True) {
            $UsedWords[] = $BloomConverted;
            $_SESSION['usedwords'] = $UsedWords;
            //echo 'Word in here:'.$Word.'<br/>';
            return True;
        } else {
            return False;
        }
    }
}
Example #2
0
<?php

include "../lib/bloomfilter.php";
set_time_limit(600);
$WordArray = file("../dictionary/dictionary.txt");
$BloomedArray = array();
foreach ($WordArray as $Word) {
    unset($BloomString);
    $BloomString = bloomFilter($Word);
    $BloomedArray[] = join('', $BloomString);
}
sort($BloomedArray);
print_r($BloomedArray);
$BloomedArray = array_unique($BloomedArray);
file_put_contents("../dictionary/bloomed.txt", join("\r\n", $BloomedArray));