diff options
author | Andrew Dolgov <[email protected]> | 2013-07-31 10:30:14 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-07-31 10:30:17 +0400 |
commit | 6b4617970f2c25ac852daab873f5374d611d5b7e (patch) | |
tree | e7026b5c9879b7489454626aef00e3c2f04e06db /include/rssfuncs.php | |
parent | f035e6dc822e3b8766d55689abff26a6bf52d404 (diff) |
add text_languagedetect to guess article language for better hyphenation
(bump schema)
Diffstat (limited to 'include/rssfuncs.php')
-rw-r--r-- | include/rssfuncs.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php index cfb0e7a46..756ecbfc1 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -354,6 +354,11 @@ $rss->init(); } + require_once "lib/languagedetect/LanguageDetect.php"; + + $lang = new Text_LanguageDetect(); + $lang->setNameMode(2); + // print_r($rss); $feed = db_escape_string($feed); @@ -565,6 +570,15 @@ print "\n"; } + $entry_language = $lang->detect($entry_content, 1); + + if (count($entry_language) > 0) { + $entry_language = array_keys($entry_language); + $entry_language = db_escape_string($entry_language[0]); + + _debug("detected language: $entry_language", $debug_enabled); + } + $entry_comments = $item->get_comments_url(); $entry_author = $item->get_author(); @@ -677,6 +691,7 @@ comments, num_comments, plugin_data, + lang, author) VALUES ('$entry_title', @@ -691,6 +706,7 @@ '$entry_comments', '$num_comments', '$entry_plugin_data', + '$entry_language', '$entry_author')"); $article_labels = array(); |