Перекодировка в utf-8

This commit is contained in:
Фёдор Подлеснов 2016-07-14 16:29:26 +03:00
parent 43f501a5e2
commit df2e65a670
80 changed files with 668 additions and 668 deletions

View file

@ -5,7 +5,7 @@ require_once 'core/search/stemmer.php';
require_once 'core/path.php';
/**
* Индексирование файлов
* Индексирование файлов
*/
class Index
{
@ -25,7 +25,7 @@ class Index
return "";
}
// Выбираем основу слова
// Выбираем основу слова
function clean ($word)
{
return Stemmer::russian(strtolower($word));
@ -34,14 +34,14 @@ class Index
function process ($base, $files)
{
$path = new Path($base);
// Список документов
// Список документов
foreach ($path->getContentRec($files) as $file) {
$content = file_get_contents ($file);
$text = stripText($content);
// $title = self::getTitle ($content);
$title = pathinfo($file, PATHINFO_BASENAME);
// echo $file, "\n";
// Список слов в документе
// Список слов в документе
$list = tokenize($text);
foreach ($list as $word) {
$preword = self::clean($word);
@ -49,7 +49,7 @@ class Index
$index = $this->index[$preword];
if ( ! in_array ($this->count, $index)) $this->index[$preword] [] = $this->count;
} else {
// Не записываем слова длинна которых меньше 2
// Не записываем слова длинна которых меньше 2
if (strlen($preword) > 1) {
$this->index[$preword] = array ($this->count);
}
@ -62,12 +62,12 @@ class Index
}
/**
* Сохранение результата поиска
* Сохранение результата поиска
*/
function saveData ($file)
{
$file = fopen($file, "w");
// Количество слов и текстов
// Количество слов и текстов
fwrite ($file, pack("SS", count($this->index), count($this->text)));
foreach ($this->index as $word => $value) {
$length = strlen($word);