cballou / php-syllable
该软件包的最新版本(dev-master)没有提供许可信息。
为 Packagist 对 vanderlee/phpSyllable 进行重构。
dev-master
2015-09-10 11:12 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~1.5
This package is not auto-updated.
Last update: 2024-09-14 17:48:18 UTC
README
版本 1.4.1
版权所有 © 2011-2015 Martijn van der Lee。适用 MIT 开源许可。
简介
PHP 音节拆分和连字符。或者更准确地说... PHP Syl-la-ble split-ting 和 hy-phen-ation。
基于 Frank M. Liang(http://www.tug.org/docs/liang/)和 TeX 社区众多志愿者的工作。
支持多种语言。例如,英语(美/英),西班牙语,德语,法语,荷兰语,意大利语,罗马尼亚语,俄语等。总共有 76 种语言。
语言源:http://tug.org/tex-hyphen/#languages
支持 PHP 5.2 及以上版本,因此您可以在旧服务器上使用它。
示例用法
// must set the proper paths for a cache dir and the TeX language file dir Syllable::setCacheDir(realpath('cache')); Syllable::setLanguageDir(realpath('languages')); $syllable = new Syllable(); $syllable->setHyphen('-'); $syllable->setLanguage('en-us'); // Su-per-cal-ifrag-ilis-tic-ex-pi-ali-do-cious $syllable->hyphenateText('Supercalifragilisticexpialidocious') // array(';Re', 'dun', 'dan', 't, punc', 'tu', 'a', 'tion...') $syllable->splitWord(';Redundant, punctuation...'); // array(';Re', 'dun', 'dant, punc', 'tu', 'a', 'tion...') $syllable->splitText(';Redundant, punctuation...');
变更
1.4.1
- 修复拆分中的撇号问题。
1.4
- 修复处理法语的问题。
- 将 .text 加载重构到源类中。
- 大幅提升缓存性能(过多的写入)。
1.3.1
- 修复初始缓存写入缓慢的问题;写入过多(只需要一次)。
- 移除 min_hyphenation;mb_strlen 查找时间比 hashmap 查找时间长。
1.3
- 添加了
array histogramText($text)
,integer countWordsText($text)
和integer countPolysyllableText($text)
方法。 - 重构缓存接口。
- 改进 unittests。
1.2
- 弃用阈值功能。该功能基于对算法的错误理解。方法、常量和构造函数签名保持不变,尽管现在您可以省略阈值(或者保留它,它会被检测为“假”阈值)。