* require_once 'Text/LanguageDetect.php'; * * $l = new Text_LanguageDetect; * * $stdin = fopen('php://stdin', 'r'); * * echo "Supported languages:\n"; * * try { * $langs = $l->getLanguages(); * } catch (Text_LanguageDetect_Exception $e) { * die($e->getMessage()); * } * * sort($langs); * echo join(', ', $langs); * * while ($line = fgets($stdin)) { * print_r($l->detect($line, 4)); * } *