mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Crowdin localization integration prepare and stopwords removal
This commit is contained in:
parent
e87f1beff0
commit
4b9965b062
51 changed files with 3145 additions and 1894 deletions
|
@ -365,9 +365,6 @@ function extract_search_words($text)
|
|||
// short & long words
|
||||
// $text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#u', ' ', $text);
|
||||
|
||||
$text = remove_stopwords($text);
|
||||
# $text = replace_synonyms($text);
|
||||
|
||||
// Trim 1+ spaces to one space and split this string into unique words
|
||||
$text = array_unique(explode(' ', str_compact($text)));
|
||||
|
||||
|
@ -388,23 +385,6 @@ function extract_search_words($text)
|
|||
return $text;
|
||||
}
|
||||
|
||||
function replace_synonyms($text)
|
||||
{
|
||||
static $syn_match = null, $syn_replace = null;
|
||||
|
||||
if (is_null($syn_match)) {
|
||||
preg_match_all("#(\w+) (\w+)(\r?\n|$)#", @file_get_contents(LANG_DIR . 'search_synonyms.txt'), $m);
|
||||
|
||||
$syn_match = $m[2];
|
||||
$syn_replace = $m[1];
|
||||
|
||||
array_deep($syn_match, 'pad_with_space');
|
||||
array_deep($syn_replace, 'pad_with_space');
|
||||
}
|
||||
|
||||
return ($syn_match && $syn_replace) ? str_replace($syn_match, $syn_replace, $text) : $text;
|
||||
}
|
||||
|
||||
function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue