Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Lingua::EN::Syllable

Name Lingua::EN::Syllable
Version 0.30
Located at /usr/share/perl5
File /usr/share/perl5/Lingua/EN/Syllable.pm
Is Core No
Search CPAN for this module Lingua::EN::Syllable
Documentation Lingua::EN::Syllable
Module Details Lingua::EN::Syllable

NAME

Lingua::EN::Syllable - count the number of syllables in English words


SYNOPSIS

  use Lingua::EN::Syllable;
  $count = syllable('supercalifragilisticexpialidocious'); # 14


DESCRIPTION

Lingua::EN::Syllable::syllable() estimates the number of syllables in the word passed to it.

Note that it isn't entirely accurate... it fails (by one syllable) for about 10-15% of my /usr/dict/words. The only way to get a 100% accurate count is to do a dictionary lookup, so this is a small and fast alternative where more-or-less accurate results will suffice, such as estimating the reading level of a document.

I welcome pointers to more accurate algorithms, since this one is pretty quick-and-dirty. This was designed for English (well, American at least) words, but sometimes guesses well for other languages.


KNOWN LIMITATIONS

Accuracy for words with non-alpha characters is somewhat undefined. In general, punctuation characters, et al, should be trimmed off before handing the word to syllable(), and hyphenated compounds should be broken into their separate parts.

Syllables for all-digit words (eg, ``1998''; some call them ``numbers'') are often counted as the number of digits. A cooler solution would be converting ``1998'' to ``nineteen eighty eight'' (or ``one thousand nine hundred eighty eight'', or...), but that is left as an exercise for the reader.

Contractions are not well supported.

Compound words (like ``lifeboat''), where the first word ends in a silent 'e' are counted with an extra syllable.


SEE ALSO

the Lingua::Phonology manpage - a framework of classes that provide ``an object model for lingistic phonology and sound change''. That includes syllables, and it looks like you can use it to get syllables for words, but from a quick skim of the doc I can't see exactly how.

the Text::Info manpage - a new module (as of late 2015) that provides information about text in Germanic languages, including syllable count.


REPOSITORY

https://github.com/neilb/Lingua-EN-Syllable


COPYRIGHT AND LICENSE

This software is copyright (c) 1999 by Greg Fast <gdf@imsa.edu>

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


AUTHOR

Greg Fast (gdf@imsa.edu)

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026