Example #1
0
function txt_to_array($file, $scrubber = "[^a-zA-Z0-9_\\s]")
{
    // open file, gobble in the text and close
    $FH = fopen($file, "r");
    $textstr = fread($FH, filesize($file));
    fclose($FH);
    $textstr = scrub_text($textstr, $scrubber);
    // explode into array on spaces
    $textarray = explode(" ", $textstr);
    return $textarray;
}
Example #2
0
}
if (isset($_POST["digitsbox"])) {
    $digits = $_POST["digitsbox"];
}
if (isset($_POST["stopwordbox"])) {
    $removeStopWords = $_POST["stopwordbox"];
}
if (isset($_POST["lemmabox"])) {
    $lemmatize = $_POST["lemmabox"];
}
if (isset($_POST["consolidationbox"])) {
    $consolidate = $_POST["consolidationbox"];
}
if (isset($_POST["lowercasebox"])) {
    $lowercase = $_POST["lowercasebox"];
}
if (isset($_POST["specialbox"])) {
    $formatspecial = $_POST["specialbox"];
}
if (isset($_POST["commonbox"])) {
    $common = $_POST["commonbox"];
}
$file = file_get_contents($_SESSION["file"]);
$stopwords = file_get_contents($_SESSION["stopwords"]);
$lemmas = file_get_contents($_SESSION["lemmas"]);
$consolidations = file_get_contents($_SESSION["consolidations"]);
$specials = file_get_contents($_SESSION["specials"]);
$_SESSION["scrubbed"] = scrub_text($file, $formatting, $tags, $punctuation, $digits, $removeStopWords, $lemmatize, $consolidate, $formatspecial, $lowercase, $common, $stopwords, $lemmas, $consolidations, $specials);
header('Location: ' . "display.php");
die;
ob_flush();