cballou/php-syllable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cballou/php-syllable

Composer 安装命令:

composer require cballou/php-syllable

包简介

A refactoring of vanderlee/phpSyllable for Packagist.

README 文档

README

Version 1.4.1

Build Status

Copyright © 2011-2015 Martijn van der Lee. MIT Open Source license applies.

Introduction

PHP Syllable splitting and hyphenation. or rather... PHP Syl-la-ble split-ting and hy-phen-ation.

Based on the work by Frank M. Liang (http://www.tug.org/docs/liang/) and the many volunteers in the TeX community.

Many languages supported. i.e. english (us/uk), spanish, german, french, dutch, italian, romanian, russian, etc. 76 languages in total.

Language sources: http://tug.org/tex-hyphen/#languages

Supports PHP 5.2 and up, so you can use it on older servers.

Example Usage

// 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...');

Changes

1.4.1

  • More fixes for apostrophes in splitting.

1.4

  • Fix for French language handling
  • Refactor .text loading into source class.
  • Massive cache performance increase (excessive writes).

1.3.1

  • Fix slow initial cache writing; too many writes (only one was needed).
  • Removed min_hyphenation; mb_strlen takes more time than hashmap lookup.

1.3

  • Added array histogramText($text), integer countWordsText($text) and integer countPolysyllableText($text) methods.
  • Refactored cache interface.
  • Improved unittests.

1.2

  • Deprecated treshold feature. Was based on misinterpretation of the algorithm. Methods, constants and constructor signature unchanged, although you can now omit the treshold if you want (or leave it in, it's detected as a "fake" treshold).

统计信息

  • 总下载量: 84
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 33
  • 开发语言: TeX

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-09-10