From 50a4fa0a8dc7ab222809c529f1bf3b2142f2600a Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 07:55:07 +0200 Subject: [PATCH 1/4] Apply configurable hyphen boundary API --- .github/workflows/apply-hyphen-boundaries.yml | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 .github/workflows/apply-hyphen-boundaries.yml diff --git a/.github/workflows/apply-hyphen-boundaries.yml b/.github/workflows/apply-hyphen-boundaries.yml new file mode 100644 index 0000000..5971009 --- /dev/null +++ b/.github/workflows/apply-hyphen-boundaries.yml @@ -0,0 +1,173 @@ +name: Apply configurable hyphen boundary API + +on: + pull_request: + branches: + - master + +permissions: + contents: write + +jobs: + patch: + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: agent/configurable-hyphen-boundaries + fetch-depth: 0 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: mbstring, dom + coverage: none + tools: composer:v2 + + - name: Install documentation dependencies + run: composer install --no-interaction --prefer-dist --no-progress + + - name: Patch API and tests + run: | + python3 - <<'PY' + from pathlib import Path + + source_path = Path('src/Syllable.php') + source = source_path.read_text(encoding='utf-8') + + old_properties = """ private $minHyphenLeft = 2; + private $minHyphenRight = 2;""" + new_properties = """ private $minHyphenLeft = 2; + private $minHyphenRight = 2; + private $minHyphenLeftOverride = null; + private $minHyphenRightOverride = null;""" + if source.count(old_properties) != 1: + raise SystemExit('Expected hyphen boundary properties exactly once') + source = source.replace(old_properties, new_properties) + + getter = """ public function getMinWordLength() + { + return $this->minWordLength; + } +""" + methods = getter + """ + /** + * Override the minimum number of characters retained before a hyphenation point. + * Pass null to restore the active language's default. + * + * @param int|null $length + */ + public function setMinHyphenLeft($length = null) + { + $this->minHyphenLeftOverride = $length === null ? null : max(0, (int) $length); + } + + /** + * Get the effective minimum number of characters before a hyphenation point. + * + * @return int + */ + public function getMinHyphenLeft() + { + $this->loadLanguage(); + + return $this->minHyphenLeft; + } + + /** + * Override the minimum number of characters retained after a hyphenation point. + * Pass null to restore the active language's default. + * + * @param int|null $length + */ + public function setMinHyphenRight($length = null) + { + $this->minHyphenRightOverride = $length === null ? null : max(0, (int) $length); + } + + /** + * Get the effective minimum number of characters after a hyphenation point. + * + * @return int + */ + public function getMinHyphenRight() + { + $this->loadLanguage(); + + return $this->minHyphenRight; + } +""" + if source.count(getter) != 1: + raise SystemExit('Expected minimum word length getter exactly once') + source = source.replace(getter, methods) + + old_end = """ $cache->close(); + } + } + } + + /** + * Exclude all elements.""" + new_end = """ $cache->close(); + } + } + + if ($this->minHyphenLeftOverride !== null) { + $this->minHyphenLeft = $this->minHyphenLeftOverride; + } + if ($this->minHyphenRightOverride !== null) { + $this->minHyphenRight = $this->minHyphenRightOverride; + } + } + + /** + * Exclude all elements.""" + if source.count(old_end) != 1: + raise SystemExit('Expected loadLanguage ending exactly once') + source_path.write_text(source.replace(old_end, new_end), encoding='utf-8') + + test_path = Path('tests/src/SyllableTest.php') + tests = test_path.read_text(encoding='utf-8') + marker = """ /** + * @return array[] + */ + public function dataSplitWord()""" + test = """ /** + * @return void + */ + public function testConfigurableHyphenBoundaries() + { + $this->object->setMinHyphenLeft(5); + $this->object->setMinHyphenRight(5); + + $parts = $this->object->splitWord('Supercalifragilisticexpialidocious'); + + $this->assertSame(5, $this->object->getMinHyphenLeft()); + $this->assertSame(5, $this->object->getMinHyphenRight()); + $this->assertGreaterThanOrEqual(5, mb_strlen(reset($parts))); + $this->assertGreaterThanOrEqual(5, mb_strlen(end($parts))); + + $this->object->setMinHyphenLeft(null); + $this->object->setMinHyphenRight(null); + $this->assertSame(2, $this->object->getMinHyphenLeft()); + $this->assertSame(2, $this->object->getMinHyphenRight()); + } + +""" + marker + if tests.count(marker) != 1: + raise SystemExit('Expected split-word provider marker exactly once') + test_path.write_text(tests.replace(marker, test), encoding='utf-8') + PY + + - name: Regenerate API documentation + run: ./build/generate-docs + + - name: Commit generated changes + run: | + rm .github/workflows/apply-hyphen-boundaries.yml + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add src/Syllable.php tests/src/SyllableTest.php README.md .github/workflows/apply-hyphen-boundaries.yml + git commit -m "Add configurable hyphen boundaries" + git push origin HEAD:agent/configurable-hyphen-boundaries From aa0fd87f60e4e53686b0cd711ac4a0abfe14a485 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 21:24:09 +0200 Subject: [PATCH 2/4] Add configurable hyphen boundaries --- .github/workflows/apply-hyphen-boundaries.yml | 173 ------------------ .github/workflows/tests.yml | 2 +- src/Syllable.php | 55 ++++++ tests/src/SyllableTest.php | 21 +++ 4 files changed, 77 insertions(+), 174 deletions(-) delete mode 100644 .github/workflows/apply-hyphen-boundaries.yml diff --git a/.github/workflows/apply-hyphen-boundaries.yml b/.github/workflows/apply-hyphen-boundaries.yml deleted file mode 100644 index 5971009..0000000 --- a/.github/workflows/apply-hyphen-boundaries.yml +++ /dev/null @@ -1,173 +0,0 @@ -name: Apply configurable hyphen boundary API - -on: - pull_request: - branches: - - master - -permissions: - contents: write - -jobs: - patch: - if: github.actor != 'github-actions[bot]' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: agent/configurable-hyphen-boundaries - fetch-depth: 0 - - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - extensions: mbstring, dom - coverage: none - tools: composer:v2 - - - name: Install documentation dependencies - run: composer install --no-interaction --prefer-dist --no-progress - - - name: Patch API and tests - run: | - python3 - <<'PY' - from pathlib import Path - - source_path = Path('src/Syllable.php') - source = source_path.read_text(encoding='utf-8') - - old_properties = """ private $minHyphenLeft = 2; - private $minHyphenRight = 2;""" - new_properties = """ private $minHyphenLeft = 2; - private $minHyphenRight = 2; - private $minHyphenLeftOverride = null; - private $minHyphenRightOverride = null;""" - if source.count(old_properties) != 1: - raise SystemExit('Expected hyphen boundary properties exactly once') - source = source.replace(old_properties, new_properties) - - getter = """ public function getMinWordLength() - { - return $this->minWordLength; - } -""" - methods = getter + """ - /** - * Override the minimum number of characters retained before a hyphenation point. - * Pass null to restore the active language's default. - * - * @param int|null $length - */ - public function setMinHyphenLeft($length = null) - { - $this->minHyphenLeftOverride = $length === null ? null : max(0, (int) $length); - } - - /** - * Get the effective minimum number of characters before a hyphenation point. - * - * @return int - */ - public function getMinHyphenLeft() - { - $this->loadLanguage(); - - return $this->minHyphenLeft; - } - - /** - * Override the minimum number of characters retained after a hyphenation point. - * Pass null to restore the active language's default. - * - * @param int|null $length - */ - public function setMinHyphenRight($length = null) - { - $this->minHyphenRightOverride = $length === null ? null : max(0, (int) $length); - } - - /** - * Get the effective minimum number of characters after a hyphenation point. - * - * @return int - */ - public function getMinHyphenRight() - { - $this->loadLanguage(); - - return $this->minHyphenRight; - } -""" - if source.count(getter) != 1: - raise SystemExit('Expected minimum word length getter exactly once') - source = source.replace(getter, methods) - - old_end = """ $cache->close(); - } - } - } - - /** - * Exclude all elements.""" - new_end = """ $cache->close(); - } - } - - if ($this->minHyphenLeftOverride !== null) { - $this->minHyphenLeft = $this->minHyphenLeftOverride; - } - if ($this->minHyphenRightOverride !== null) { - $this->minHyphenRight = $this->minHyphenRightOverride; - } - } - - /** - * Exclude all elements.""" - if source.count(old_end) != 1: - raise SystemExit('Expected loadLanguage ending exactly once') - source_path.write_text(source.replace(old_end, new_end), encoding='utf-8') - - test_path = Path('tests/src/SyllableTest.php') - tests = test_path.read_text(encoding='utf-8') - marker = """ /** - * @return array[] - */ - public function dataSplitWord()""" - test = """ /** - * @return void - */ - public function testConfigurableHyphenBoundaries() - { - $this->object->setMinHyphenLeft(5); - $this->object->setMinHyphenRight(5); - - $parts = $this->object->splitWord('Supercalifragilisticexpialidocious'); - - $this->assertSame(5, $this->object->getMinHyphenLeft()); - $this->assertSame(5, $this->object->getMinHyphenRight()); - $this->assertGreaterThanOrEqual(5, mb_strlen(reset($parts))); - $this->assertGreaterThanOrEqual(5, mb_strlen(end($parts))); - - $this->object->setMinHyphenLeft(null); - $this->object->setMinHyphenRight(null); - $this->assertSame(2, $this->object->getMinHyphenLeft()); - $this->assertSame(2, $this->object->getMinHyphenRight()); - } - -""" + marker - if tests.count(marker) != 1: - raise SystemExit('Expected split-word provider marker exactly once') - test_path.write_text(tests.replace(marker, test), encoding='utf-8') - PY - - - name: Regenerate API documentation - run: ./build/generate-docs - - - name: Commit generated changes - run: | - rm .github/workflows/apply-hyphen-boundaries.yml - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add src/Syllable.php tests/src/SyllableTest.php README.md .github/workflows/apply-hyphen-boundaries.yml - git commit -m "Add configurable hyphen boundaries" - git push origin HEAD:agent/configurable-hyphen-boundaries diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 804af7d..16b08ca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - php: [ '5.6', '7.4', '8.2' ] + php: [ '7.1', '7.4', '8.2' ] steps: - name: Checkout repository diff --git a/src/Syllable.php b/src/Syllable.php index c0ae85a..5696d6d 100644 --- a/src/Syllable.php +++ b/src/Syllable.php @@ -51,6 +51,8 @@ class Syllable private $language; private $minHyphenLeft = 2; private $minHyphenRight = 2; + private $minHyphenLeftOverride = null; + private $minHyphenRightOverride = null; private $patterns = null; private $maxPattern = null; private $hyphenation = null; @@ -220,6 +222,52 @@ public function getMinWordLength() return $this->minWordLength; } + /** + * Override the minimum number of characters retained before a hyphenation point. + * Pass null to restore the active language's default. + * + * @param int|null $length + */ + public function setMinHyphenLeft($length = null) + { + $this->minHyphenLeftOverride = $length === null ? null : max(0, (int) $length); + } + + /** + * Get the effective minimum number of characters before a hyphenation point. + * + * @return int + */ + public function getMinHyphenLeft() + { + $this->loadLanguage(); + + return $this->minHyphenLeft; + } + + /** + * Override the minimum number of characters retained after a hyphenation point. + * Pass null to restore the active language's default. + * + * @param int|null $length + */ + public function setMinHyphenRight($length = null) + { + $this->minHyphenRightOverride = $length === null ? null : max(0, (int) $length); + } + + /** + * Get the effective minimum number of characters after a hyphenation point. + * + * @return int + */ + public function getMinHyphenRight() + { + $this->loadLanguage(); + + return $this->minHyphenRight; + } + /** * Options to use for HTML parsing by libxml. * @@ -293,6 +341,13 @@ private function loadLanguage() $cache->close(); } } + + if ($this->minHyphenLeftOverride !== null) { + $this->minHyphenLeft = $this->minHyphenLeftOverride; + } + if ($this->minHyphenRightOverride !== null) { + $this->minHyphenRight = $this->minHyphenRightOverride; + } } /** diff --git a/tests/src/SyllableTest.php b/tests/src/SyllableTest.php index caf3acd..a349b38 100644 --- a/tests/src/SyllableTest.php +++ b/tests/src/SyllableTest.php @@ -242,6 +242,27 @@ public function testGetSource() ); } + /** + * @return void + */ + public function testConfigurableHyphenBoundaries() + { + $this->object->setMinHyphenLeft(5); + $this->object->setMinHyphenRight(5); + + $parts = $this->object->splitWord('Supercalifragilisticexpialidocious'); + + $this->assertSame(5, $this->object->getMinHyphenLeft()); + $this->assertSame(5, $this->object->getMinHyphenRight()); + $this->assertGreaterThanOrEqual(5, mb_strlen(reset($parts))); + $this->assertGreaterThanOrEqual(5, mb_strlen(end($parts))); + + $this->object->setMinHyphenLeft(null); + $this->object->setMinHyphenRight(null); + $this->assertSame(2, $this->object->getMinHyphenLeft()); + $this->assertSame(2, $this->object->getMinHyphenRight()); + } + /** * @return array[] */ From 3f0fbb3ecc655c765f6108f74a4a8a4b86f0c870 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 21:25:01 +0200 Subject: [PATCH 3/4] Refresh hyphen boundary documentation --- README.md | 160 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 132 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 4da00cc..0d65f62 100644 --- a/README.md +++ b/README.md @@ -91,143 +91,247 @@ The following describes the API of the main Syllable class. In most cases, you will not use any other functions. Browse the code under src/ for all available functions. -#### public __construct($language = 'en-us', string|Hyphen $hyphen = null) +#### public __construct($language = 'en-us', $hyphen = null) + Create a new Syllable class, with defaults. -#### public static setCacheDir(string $dir) + +#### public static setCacheDir($dir) + Set the directory where compiled language files may be stored. Default to the `cache` subdirectory of the current directory. + #### public static setEncoding(string|null $encoding = null) + Set the character encoding to use. Specify `null` encoding to not apply any encoding at all. -#### public static setLanguageDir(string $dir) + +#### public static setLanguageDir($dir) + Set the directory where language source files can be found. Default to the `languages` subdirectory of the current directory. -#### public setLanguage(string $language) + +#### public setLanguage($language) + Set the language whose rules will be used for hyphenation. -#### public addHyphenations(array $hyphenations) -Add any number of custom hyphenation patterns, using '-' to specify where hyphens may occur. -Omit the '-' from the pattern to add words that will not be hyphenated. +#### public addHyphenations($hyphenations): void + + +Add custom hyphenation patterns for words using a '-' to explicitly specify hyphenation (if any) #### public setHyphen(mixed $hyphen) + Set the hyphen text or object to use as a hyphen marker. + #### public getHyphen(): Hyphen + Get the current hyphen object. -#### public setCache(Cache $cache = null) + +#### public setCache($cache = null) + + #### public getCache(): Cache + + #### public setSource($source) #### public getSource(): Source -#### public setMinWordLength(int $length = 0) + + +#### public setMinWordLength($length = 0) + Words need to contain at least this many character to be hyphenated. + #### public getMinWordLength(): int -#### public setLibxmlOptions(int $libxmlOptions) + + +#### public setMinHyphenLeft($length = null) + + +Override the minimum number of characters retained before a hyphenation point. +Pass null to restore the active language's default. + + +#### public getMinHyphenLeft(): int + + +Get the effective minimum number of characters before a hyphenation point. + + +#### public setMinHyphenRight($length = null) + + +Override the minimum number of characters retained after a hyphenation point. +Pass null to restore the active language's default. + + +#### public getMinHyphenRight(): int + + +Get the effective minimum number of characters after a hyphenation point. + + +#### public setLibxmlOptions($libxmlOptions) + Options to use for HTML parsing by libxml. -**See:** https://www.php.net/manual/de/libxml.constants.php. + + +**See:** https://www.php.net/manual/de/libxml.constants.php +. #### public excludeAll() + Exclude all elements. -#### public excludeElement(string|string[] $elements) +#### public excludeElement($elements) + Add one or more elements to exclude from HTML. -#### public excludeAttribute(string|string[] $attributes, $value = null) + +#### public excludeAttribute($attributes, $value = null) + Add one or more elements with attributes to exclude from HTML. -#### public excludeXpath(string|string[] $queries) + +#### public excludeXpath($queries) + Add one or more xpath queries to exclude from HTML. -#### public includeElement(string|string[] $elements) + +#### public includeElement($elements) + Add one or more elements to include from HTML. -#### public includeAttribute(string|string[] $attributes, $value = null) + +#### public includeAttribute($attributes, $value = null) + Add one or more elements with attributes to include from HTML. -#### public includeXpath(string|string[] $queries) + +#### public includeXpath($queries) + Add one or more xpath queries to include from HTML. -#### public splitWord(string $word): array + +#### public splitWord($word): array + Split a single word on where the hyphenation would go. + Punctuation is not supported, only simple words. For parsing whole sentences please use Syllable::splitWords() or Syllable::splitText(). -#### public splitWords(string $text): array + + +#### public splitWords($text): array + Split a text into an array of punctuation marks and words, splitting each word on where the hyphenation would go. -#### public splitText(string $text): array + + +#### public splitText($text): array + Split a text on where the hyphenation would go. -#### public hyphenateWord(string $word): string + + +#### public hyphenateWord($word): string + Hyphenate a single word. -#### public hyphenateText(string $text): string + + +#### public hyphenateText($text): string + Hyphenate all words in the plain text. -#### public hyphenateHtml(string $html): string + + +#### public hyphenateHtml($html): string + Hyphenate all readable text in the HTML, excluding HTML tags and attributes. + **Deprecated:** Use the UTF-8 capable hyphenateHtmlText() instead. This method is kept only for backward compatibility and will be removed in the next major version 2.0. +. + + + +#### public hyphenateHtmlText($html): string -#### public hyphenateHtmlText(string $html): string Hyphenate all readable text in the HTML, excluding HTML tags and attributes. + This method is UTF-8 capable and should be preferred over hyphenateHtml(). -#### public histogramText(string $text): array + + +#### public histogramText($text): array + Count the number of syllables in the text and return a map with syllable count as key and number of words for that syllable count as the value. -#### public countWordsText(string $text): int + + +#### public countWordsText($text): int + Count the number of words in the text. -#### public countSyllablesText(string $text): int + + +#### public countSyllablesText($text): int + Count the number of syllables in the text. -#### public countPolysyllablesText(string $text): int + + +#### public countPolysyllablesText($text): int + Count the number of polysyllables in the text. + + ## Development ### Update language files From ccc60fec454972052f13ad7a64468c42226bb405 Mon Sep 17 00:00:00 2001 From: Martijn van der Lee Date: Mon, 3 Aug 2026 21:28:54 +0200 Subject: [PATCH 4/4] Regenerate API documentation after merge --- README.md | 143 +++++++++++------------------------------------------- 1 file changed, 28 insertions(+), 115 deletions(-) diff --git a/README.md b/README.md index ca2f49c..1066312 100644 --- a/README.md +++ b/README.md @@ -91,247 +91,160 @@ The following describes the API of the main Syllable class. In most cases, you will not use any other functions. Browse the code under src/ for all available functions. -#### public __construct($language = 'en-us', $hyphen = null) - +#### public __construct($language = 'en-us', string|Hyphen $hyphen = null) Create a new Syllable class, with defaults. - -#### public static setCacheDir($dir) - +#### public static setCacheDir(string $dir) Set the directory where compiled language files may be stored. Default to the `cache` subdirectory of the current directory. - #### public static setEncoding(string|null $encoding = null) - Set the character encoding to use. Specify `null` encoding to not apply any encoding at all. - -#### public static setLanguageDir($dir) - +#### public static setLanguageDir(string $dir) Set the directory where language source files can be found. Default to the `languages` subdirectory of the current directory. - -#### public setLanguage($language) - +#### public setLanguage(string $language) Set the language whose rules will be used for hyphenation. - -#### public addHyphenations($hyphenations): void - +#### public addHyphenations(array $hyphenations) Add custom hyphenation patterns for words using a '-' to explicitly specify hyphenation (if any) #### public setHyphen(mixed $hyphen) - Set the hyphen text or object to use as a hyphen marker. - #### public getHyphen(): Hyphen - Get the current hyphen object. - -#### public setCache($cache = null) - - +#### public setCache(Cache $cache = null) #### public getCache(): Cache - - #### public setSource($source) #### public getSource(): Source - - -#### public setMinWordLength($length = 0) - +#### public setMinWordLength(int $length = 0) Words need to contain at least this many character to be hyphenated. - #### public getMinWordLength(): int - - -#### public setMinHyphenLeft($length = null) - +#### public setMinHyphenLeft(int|null $length = null) Override the minimum number of characters retained before a hyphenation point. Pass null to restore the active language's default. - #### public getMinHyphenLeft(): int - Get the effective minimum number of characters before a hyphenation point. - -#### public setMinHyphenRight($length = null) - +#### public setMinHyphenRight(int|null $length = null) Override the minimum number of characters retained after a hyphenation point. Pass null to restore the active language's default. - #### public getMinHyphenRight(): int - Get the effective minimum number of characters after a hyphenation point. - -#### public setLibxmlOptions($libxmlOptions) - +#### public setLibxmlOptions(int $libxmlOptions) Options to use for HTML parsing by libxml. - - -**See:** https://www.php.net/manual/de/libxml.constants.php -. +**See:** https://www.php.net/manual/de/libxml.constants.php. #### public excludeAll() - Exclude all elements. -#### public excludeElement($elements) - +#### public excludeElement(string|string[] $elements) Add one or more elements to exclude from HTML. - -#### public excludeAttribute($attributes, $value = null) - +#### public excludeAttribute(string|string[] $attributes, $value = null) Add one or more elements with attributes to exclude from HTML. - -#### public excludeXpath($queries) - +#### public excludeXpath(string|string[] $queries) Add one or more xpath queries to exclude from HTML. - -#### public includeElement($elements) - +#### public includeElement(string|string[] $elements) Add one or more elements to include from HTML. - -#### public includeAttribute($attributes, $value = null) - +#### public includeAttribute(string|string[] $attributes, $value = null) Add one or more elements with attributes to include from HTML. - -#### public includeXpath($queries) - +#### public includeXpath(string|string[] $queries) Add one or more xpath queries to include from HTML. - -#### public splitWord($word): array - +#### public splitWord(string $word): array Split a single word on where the hyphenation would go. - Punctuation is not supported, only simple words. For parsing whole sentences please use Syllable::splitWords() or Syllable::splitText(). - - -#### public splitWords($text): array - +#### public splitWords(string $text): array Split a text into an array of punctuation marks and words, splitting each word on where the hyphenation would go. - - -#### public splitText($text): array - +#### public splitText(string $text): array Split a text on where the hyphenation would go. - - -#### public hyphenateWord($word): string - +#### public hyphenateWord(string $word): string Hyphenate a single word. - - -#### public hyphenateText($text): string - +#### public hyphenateText(string $text): string Hyphenate all words in the plain text. - - -#### public hyphenateHtml($html): string - +#### public hyphenateHtml(string $html): string Hyphenate all readable text in the HTML, excluding HTML tags and attributes. - **Deprecated:** Use the UTF-8 capable hyphenateHtmlText() instead. This method is kept only for backward compatibility and will be removed in the next major version 2.0. -. - - - -#### public hyphenateHtmlText($html): string +#### public hyphenateHtmlText(string $html): string Hyphenate all readable text in the HTML, excluding HTML tags and attributes. - This method is UTF-8 capable and should be preferred over hyphenateHtml(). - - -#### public histogramText($text): array - +#### public histogramText(string $text): array Count the number of syllables in the text and return a map with syllable count as key and number of words for that syllable count as the value. - - -#### public countWordsText($text): int - +#### public countWordsText(string $text): int Count the number of words in the text. - - -#### public countSyllablesText($text): int - +#### public countSyllablesText(string $text): int Count the number of syllables in the text. - - -#### public countPolysyllablesText($text): int - +#### public countPolysyllablesText(string $text): int Count the number of polysyllables in the text. - - ## Development ### Update language files