npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

syllable

v5.0.1

Published

Count syllables in English words

Downloads

186,353

Readme

syllable

Build Coverage Downloads Size

Count syllables in an English word.

Contents

What is this?

This package estimates how many syllables are in an English word.

When should I use this?

Use this when you want to do fun things with natural language, like rhyming, detecting reading ease, etc.

Install

This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:

npm install syllable

In Deno with esm.sh:

import {syllable} from 'https://esm.sh/syllable@5'

In browsers with esm.sh:

<script type="module">
  import {syllable} from 'https://esm.sh/syllable@5?bundle'
</script>

Use

import {syllable} from '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

API

This package exports the identifier syllable. There is no default export.

syllable(value)

Get the number of syllables in value.

value

Value to check (string, required).

Returns

Syllables in value (number).

CLI

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

Count syllables in English words

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

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.

Related

  • automated-readability — formula to detect ease of reading according to the Automated Readability Index (1967)
  • buzzwords — list of buzzwords
  • coleman-liau — formula to detect the ease of reading a text according to the Coleman-Liau index (1975)
  • cuss — map of profane words to a rating of sureness
  • dale-chall — list of easy American-English words: The New Dale-Chall (1995)
  • dale-chall-formula — formula to find the grade level according to the (revised) Dale–Chall Readability Formula (1995)
  • fillers — list of filler words
  • flesch — formula to detect the ease of reading a text according to Flesch Reading Ease (1975)
  • flesch-kincaid — formula to detect the grade level of text according to Flesch–Kincaid Grade Level (1975)
  • gunning-fog — formula to detect the ease of reading a text according to the Gunning fog index (1952)
  • hedges — list of hedge words
  • profanities — list of profane words
  • smog-formula — formula to detect the ease of reading a text according to the SMOG (Simple Measure of Gobbledygook) formula (1969)
  • spache — list of familiar American-English words (1974)
  • spache-formula — uses a dictionary, suited for lower reading levels
  • weasels — formula to detect the grade level of text according to the (revised) Spache Readability Formula (1974)

Contribute

Yes please! See How to Contribute to Open Source.

Security

This package is safe.

Notice

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

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

License

MIT © Titus Wormer