GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Syllable(3) User Contributed Perl Documentation Syllable(3)

Lingua::EN::Syllable - Routine for estimating syllable count in words.

  use Lingua::EN::Syllable;

  $count = syllable('supercalifragilisticexpialidocious'); # 14

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.

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.

Distributed under the same terms as Perl. Contact the author with any questions.

Greg Fast (gdf@imsa.edu)
1998-09-11 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.