make language detection optional (closes #779)

This commit is contained in:
Andrew Dolgov 2013-09-27 13:45:21 +04:00
parent a10de509f3
commit 5ddd2705ca
3 changed files with 22 additions and 12 deletions

View file

@ -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.

View file

@ -356,10 +356,12 @@
$rss->init(); $rss->init();
} }
if (DETECT_ARTICLE_LANGUAGE) {
require_once "lib/languagedetect/LanguageDetect.php"; 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,6 +574,9 @@
print "\n"; print "\n";
} }
$entry_language = "";
if (DETECT_ARTICLE_LANGUAGE) {
$entry_language = $lang->detect($entry_title . " " . $entry_content, 1); $entry_language = $lang->detect($entry_title . " " . $entry_content, 1);
if (count($entry_language) > 0) { if (count($entry_language) > 0) {
@ -579,8 +584,7 @@
$entry_language = db_escape_string(substr($entry_language[0], 0, 2)); $entry_language = db_escape_string(substr($entry_language[0], 0, 2));
_debug("detected language: $entry_language", $debug_enabled); _debug("detected language: $entry_language", $debug_enabled);
} else{ }
$entry_language = "";
} }
$entry_comments = $item->get_comments_url(); $entry_comments = $item->get_comments_url();

View file

@ -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'); ?>