mirror of
https://github.com/friendica/friendica
synced 2024-12-24 12:40:16 +00:00
7d876aab98
- Updated mobiledetectlib to 2.8.26 - Updated PEAR to 1.10.5 - Updated Archive_Tar to 1.4.3 - Updated XML_Util to 1.4.3
18 lines
No EOL
380 B
PHP
18 lines
No EOL
380 B
PHP
<?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
|
|
?>
|