hamidgh83/language-detection
Composer 安装命令:
composer require hamidgh83/language-detection
包简介
A language detection library for PHP. Detects the language from a given text string.
关键字:
README 文档
README
The package
language-detection
ُThis is an extension of language-detection where you can find its documentation.
This library can detect the language of a given text string. It can parse given training text in many different idioms into a sequence of N-grams and builds a database file in JSON format to be used in the detection phase. Then it can take a given text and detect its language using the database previously generated in the training phase. The library comes with text samples used for training and detecting text in 110 languages.
Installation with Composer
Note: This library requires the Multibyte String extension in order to work.
$ composer require hamidgh83/language-detection
Basic Usage
Basic usage of this library is the same as original library but the following methods has beed added:
bestResult()
Returns the best result as a string.
$ld->detect('Mag het een onsje meer zijn?')->bestResult();
Result:
string(2) "nl"
getSupportLanguages()
This method returns a list if supportted languages as an array.
$ld->getSupportLanguages();
Result:
Array
(
0 => ab
1 => af
2 => am
3 => ar
4 => ay
5 => az-Cyrl
6 => az-Latn
7 => be
8 => bg
9 => bi
10 => bn
11 => bo
12 => br
[...]
)
getLanguageProps($lang)
Every language has their own properties and you can get the it as follow:
$lng = new Language(); $result = $lng->detect('This is an example text.'); $props = $lng->getLanguageProps($result->bestResult());
Result:
Array
(
'props' => Array(
'language' => 'English',
'language' => Array (
'United Kingdom',
'United States of America'
),
'direction' => 'ltr'
)
)
Supported languages
The library currently supports 110 languages. To get an overview of all supported languages please have a look at here.
hamidgh83/language-detection 适用场景与选型建议
hamidgh83/language-detection 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 49 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 09 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「language」 「detect」 「detection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hamidgh83/language-detection 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hamidgh83/language-detection 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hamidgh83/language-detection 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use i18n translation PHP class for multi-language websites
Package for convenient work with Laravel's localization features
Shim repository for phpmd/phpmd
Store your language lines in the database, yaml or other sources
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-29