JSPM

syllable-count-english

1.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 67
  • Score
    100M100P100Q78367F
  • License MIT

Accurate syllable counter for English words

Package Exports

  • syllable-count-english
  • syllable-count-english/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (syllable-count-english) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

syllable-count-english

Accurate syllable counter for English text.

Motivation

There are many syllable counting packages around that count syllables by reading words in an algorithmic way. While these libraries can give an estimation of the syllables in a text, they fail to give the accurate count for a lot of words.

This package uses the CMU Pronouncing Dictionary that contains the pronunciation of over 134,000 US English words.

For words not found in the dictionary the syllable package is used, which uses an above-mentioned algorithmic approach to estimate syllables.

Installation (esm only)

npm install syllable-count-english

Usage

import {syllableCount} from "syllable-count-english";

syllableCount("It's not easy to pronounce 'worcestershire'!");
// returns 10

syllableCount("Indonesia");
// returns 4

You can also get the arpabet representation

import {cmuDictionaryLookup} from "syllable-count-english";

cmuDictionaryLookup("Water");
// returns "W AO1 T ER0"

cmuDictionaryLookup("asdf");
// returns undefined