Syllable count in JavaScript
Clone or download
Latest commit 195c483 Aug 28, 2018

readme.md

syllable Build Status Coverage Status

Syllable count in JavaScript.

Installation

npm:

npm install syllable

Usage

var syllable = require('syllable')

syllable('syllable') // 3
syllable('unicorn') // 3
syllable('hi') // 1
syllable('hihi') // 2
syllable('mmmmmmmmmmmmmmmm') // 1
syllable('wine') // 1
syllable('bottle') // 2
syllable('wine-bottle') // 3
syllable('Åland') // 2

CLI

Install:

npm install --global syllable

Use:

Usage: syllable [options] <words...>

Syllable count in an English word

Options:

  -h, --help           output usage information
  -v, --version        output version number

Usage:

# output syllables
$ syllable syllable unicorn
# 6

# output syllables from stdin
$ echo "syllable unicorn banana" | syllable
# 9

Inspiration

Based on the syllable functionality found in Text-Statistics (PHP), in turn inspired by Lingua-EN-Syllable (Perl).

Support for word-breaks and non-ASCII characters added later.

License

MIT © Titus Wormer