bitandblack/syllable-php

PHP Syllable splitting and hyphenation

1.6.0 2020-03-05 09:04 UTC

This package is auto-updated.

Last update: 2024-09-25 23:49:21 UTC


README

PHP from Packagist Codacy Badge Latest Stable Version Total Downloads License

音节

PHP Syllable splitting and hyphenation.

简介

以面向对象的方式在 PHP ^7.2 中运行。

这个库基于 Corey Ballou 的作品,而 Corey 的作品是基于 Martijn van der Lee 的作品,Martijn 的作品是基于 Frank M. Liang 的作品(http://www.tug.org/docs/liang/)以及 TeX 社区中的许多志愿者。

支持多种语言,例如英文(美/英)、西班牙语、德语、法语、荷兰语、意大利语、罗马尼亚语、俄语等,总共76种语言。

语言源代码:http://tug.org/tex-hyphen/#languages

请注意:尽管 v1.6 已经准备好与 PHP ^7.2 一起使用,但我们仍然没有完成对这个库的重构。

安装

这个库是为与 Composer 一起使用而设计的。通过运行 $ composer require bitandblack/syllable-php 将其添加到您的项目中。

使用方法

<?php

use BitAndBlack\Syllable\Syllable;
use BitAndBlack\Syllable\Hyphen\Text;

$syllable = new Syllable(
    'en-us',
    'path/to/language/files',
    'cache/directory',
    new Text('-')
);

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

帮助

如果您有任何问题,请通过 syllable@bitandblack.com 联系我们。