function extract_matrix($text, $stop_words) { global $CONFIG; set_time_limit(0); //this avoids timeouts include $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/config.php"; //given the text of the document (with this configuration it is only 1), for each word (excluding stop words) calculates statistics (position in the text) and saves them in the D object $text_info = create_index($text, $stop_words); $keywords = extract_keywords($text_info["positions"]); //most present keywords are extracted from the text, till the limit established by the variable keywords_limit $response = array(); if ($context_limit == 0) { foreach ($keywords as $keyword => $recurrence) { $response[$keyword][$keyword] = $recurrence; } } else { $response = sliding_window_ri($keywords, $width_sliding_window, $text_info["text"]); } //it applies the sliding window algorithm to each keyword to extract the contexts return $response; }
function extract_matrix($text, $stop_words) { global $width_sliding_window, $IndexingClassificationPath, $context_limit, $IOdir; //given the text of the document (with this configuration it is only 1), for each word (excluding stop words) calculates statistics (position in the text) and saves them in the D object $text_info = create_index($text, $stop_words); $keywords = extract_keywords($text_info["positions"]); //most present keywords are extracted from the text, till the limit established by the variable keywords_limit $response = array(); if ($context_limit == 0) { foreach ($keywords as $keyword => $recurrence) { $response[$keyword][$keyword] = $recurrence; } } else { $response = sliding_window_ri($keywords, $width_sliding_window, $text_info["text"]); } //it applies the sliding window algorithm to each keyword to extract the contexts return $response; }