make language detection optional (closes #779)
This commit is contained in:
parent
a10de509f3
commit
5ddd2705ca
3 changed files with 22 additions and 12 deletions
|
@ -184,6 +184,12 @@
|
||||||
define('CHECK_FOR_NEW_VERSION', true);
|
define('CHECK_FOR_NEW_VERSION', true);
|
||||||
// Check for new versions of tt-rss automatically.
|
// Check for new versions of tt-rss automatically.
|
||||||
|
|
||||||
|
define('DETECT_ARTICLE_LANGUAGE', true);
|
||||||
|
// Detect article language when updating feeds, presently this is only
|
||||||
|
// used for hyphenation. This may increase amount of CPU time used by
|
||||||
|
// update processes, disable if necessary (i.e. you are being billed
|
||||||
|
// for CPU time).
|
||||||
|
|
||||||
define('ENABLE_GZIP_OUTPUT', false);
|
define('ENABLE_GZIP_OUTPUT', false);
|
||||||
// Selectively gzip output to improve wire performance. This requires
|
// Selectively gzip output to improve wire performance. This requires
|
||||||
// PHP Zlib extension on the server.
|
// PHP Zlib extension on the server.
|
||||||
|
|
|
@ -356,10 +356,12 @@
|
||||||
$rss->init();
|
$rss->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "lib/languagedetect/LanguageDetect.php";
|
if (DETECT_ARTICLE_LANGUAGE) {
|
||||||
|
require_once "lib/languagedetect/LanguageDetect.php";
|
||||||
|
|
||||||
$lang = new Text_LanguageDetect();
|
$lang = new Text_LanguageDetect();
|
||||||
$lang->setNameMode(2);
|
$lang->setNameMode(2);
|
||||||
|
}
|
||||||
|
|
||||||
// print_r($rss);
|
// print_r($rss);
|
||||||
|
|
||||||
|
@ -572,15 +574,17 @@
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry_language = $lang->detect($entry_title . " " . $entry_content, 1);
|
$entry_language = "";
|
||||||
|
|
||||||
if (count($entry_language) > 0) {
|
if (DETECT_ARTICLE_LANGUAGE) {
|
||||||
$entry_language = array_keys($entry_language);
|
$entry_language = $lang->detect($entry_title . " " . $entry_content, 1);
|
||||||
$entry_language = db_escape_string(substr($entry_language[0], 0, 2));
|
|
||||||
|
|
||||||
_debug("detected language: $entry_language", $debug_enabled);
|
if (count($entry_language) > 0) {
|
||||||
} else{
|
$entry_language = array_keys($entry_language);
|
||||||
$entry_language = "";
|
$entry_language = db_escape_string(substr($entry_language[0], 0, 2));
|
||||||
|
|
||||||
|
_debug("detected language: $entry_language", $debug_enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry_comments = $item->get_comments_url();
|
$entry_comments = $item->get_comments_url();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<?php # This file has been generated at: Thu May 30 08:39:20 MSK 2013
|
<?php # This file has been generated at: Fri Sep 27 13:42:37 MSK 2013
|
||||||
define('GENERATED_CONFIG_CHECK', 26);
|
define('GENERATED_CONFIG_CHECK', 26);
|
||||||
$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'FEED_CRYPT_KEY', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_SERVER', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'SMTP_SECURE', 'CHECK_FOR_NEW_VERSION', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?>
|
$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'FEED_CRYPT_KEY', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_SERVER', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'SMTP_SECURE', 'CHECK_FOR_NEW_VERSION', 'DETECT_ARTICLE_LANGUAGE', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?>
|
||||||
|
|
Loading…
Reference in a new issue