diff options
author | friendica <info@friendica.com> | 2012-05-12 01:55:18 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-05-12 01:55:18 -0700 |
commit | 62727012d37ef3d3cacc413d5667dc2d7bbf9cbb (patch) | |
tree | 14c222386842938da02f3d43ecb8da12c63e0dc5 /library/langdet/docs/example_clui.php | |
parent | 99e4ea19e733f86259e39f5a22d64f1521abc5ae (diff) | |
download | volse-hubzilla-62727012d37ef3d3cacc413d5667dc2d7bbf9cbb.tar.gz volse-hubzilla-62727012d37ef3d3cacc413d5667dc2d7bbf9cbb.tar.bz2 volse-hubzilla-62727012d37ef3d3cacc413d5667dc2d7bbf9cbb.zip |
language detection library
Diffstat (limited to 'library/langdet/docs/example_clui.php')
-rw-r--r-- | library/langdet/docs/example_clui.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/library/langdet/docs/example_clui.php b/library/langdet/docs/example_clui.php new file mode 100644 index 000000000..8e7d8577d --- /dev/null +++ b/library/langdet/docs/example_clui.php @@ -0,0 +1,35 @@ +<?php + +/** + * example usage (CLI) + * + * @package Text_LanguageDetect + * @version CVS: $Id: example_clui.php 322305 2012-01-15 00:04:17Z clockwerx $ + */ + +require_once 'Text/LanguageDetect.php'; + +$l = new Text_LanguageDetect; + +$stdin = fopen('php://stdin', 'r'); + +echo "Supported languages:\n"; +$langs = $l->getLanguages(); +sort($langs); +echo join(', ', $langs); + +echo "\ntotal ", count($langs), "\n\n"; + +while ($line = fgets($stdin)) { + $result = $l->detect($line, 4); + print_r($result); + $blocks = $l->detectUnicodeBlocks($line, true); + print_r($blocks); +} + +fclose($stdin); +unset($l); + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +?> |