diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-10-25 01:57:18 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-10-29 22:00:06 +0100 |
commit | 8e4c5db766ce23d05b8507991b04fece743147de (patch) | |
tree | 55c89f2c145f47245e7d32380c92256051d6a8f2 /vendor/pear/text_languagedetect/README.rst | |
parent | fe5f1e4d67d999ed3c6ef78dc4d49f5dd1a93056 (diff) | |
download | volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.tar.gz volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.tar.bz2 volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.zip |
:arrow_up: Update Text_LanguageDetect.
Update from v0.3.0 (2012) to v1.0.0 (2017) which should remove some
warnings and improve PHP7 support.
Using composer to handle this PEAR library now.
Fix a problem in FeedutilsTest.
Diffstat (limited to 'vendor/pear/text_languagedetect/README.rst')
-rw-r--r-- | vendor/pear/text_languagedetect/README.rst | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/vendor/pear/text_languagedetect/README.rst b/vendor/pear/text_languagedetect/README.rst new file mode 100644 index 000000000..9381c7f7e --- /dev/null +++ b/vendor/pear/text_languagedetect/README.rst @@ -0,0 +1,157 @@ +******************* +Text_LanguageDetect +******************* +PHP library to identify human languages from text samples. +Returns confidence scores for each. + + +Installation +============ + +PEAR +---- +:: + + $ pear install Text_LanguageDetect + +Composer +-------- +:: + + $ composer require pear/text_languagedetect + + +Usage +===== +Also see the examples in the ``docs/`` directory and +the `official documentation`__. + +__ http://pear.php.net/package/Text_LanguageDetect/docs + +Language detection +------------------ +Simple language detection:: + + <?php + require_once 'Text/LanguageDetect.php'; + + $text = 'Was wäre, wenn ich Ihnen das jetzt sagen würde?'; + + $ld = new Text_LanguageDetect(); + $language = $ld->detectSimple($text); + + echo $language; + //output: german + +Show the three most probable languages with their confidence score:: + + <?php + require_once 'Text/LanguageDetect.php'; + + $text = 'Was wäre, wenn ich Ihnen das jetzt sagen würde?'; + + $ld = new Text_LanguageDetect(); + //3 most probable languages + $results = $ld->detect($text, 3); + + foreach ($results as $language => $confidence) { + echo $language . ': ' . number_format($confidence, 2) . "\n"; + } + + //output: + //german: 0.35 + //dutch: 0.25 + //swedish: 0.20 + ?> + + +Language code +------------- +Instead of returning the full language name, ISO 639-2 two and three +letter codes can be returned:: + + <?php + require_once 'Text/LanguageDetect.php'; + $ld = new Text_LanguageDetect(); + + //will output the ISO 639-1 two-letter language code + // "de" + $ld->setNameMode(2); + echo $ld->detectSimple('Das ist ein kleiner Text') . "\n"; + + //will output the ISO 639-2 three-letter language code + // "deu" + $ld->setNameMode(3); + echo $ld->detectSimple('Das ist ein kleiner Text') . "\n"; + ?> + + +Supported languages +=================== +- albanian +- arabic +- azeri +- bengali +- bulgarian +- cebuano +- croatian +- czech +- danish +- dutch +- english +- estonian +- farsi +- finnish +- french +- german +- hausa +- hawaiian +- hindi +- hungarian +- icelandic +- indonesian +- italian +- kazakh +- kyrgyz +- latin +- latvian +- lithuanian +- macedonian +- mongolian +- nepali +- norwegian +- pashto +- pidgin +- polish +- portuguese +- romanian +- russian +- serbian +- slovak +- slovene +- somali +- spanish +- swahili +- swedish +- tagalog +- turkish +- ukrainian +- urdu +- uzbek +- vietnamese +- welsh + + +Links +===== +Homepage + http://pear.php.net/package/Text_LanguageDetect +Bug tracker + http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Text_LanguageDetect +Documentation + http://pear.php.net/package/Text_LanguageDetect/docs +Unit test status + https://travis-ci.org/pear/Text_LanguageDetect + + .. image:: https://travis-ci.org/pear/Text_LanguageDetect.svg?branch=master + :target: https://travis-ci.org/pear/Text_LanguageDetect |