Lingua...llable(3pm)

πŸ“¦
version 0.310 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Lingua::EN::Syllable πŸ’–

okay bestie, so this one lives in the User Contributed Perl Documentation section of the manual, and it's called Lingua...llable (that's the short version of Lingua::EN::Syllable(3pm) β€” the man page name got squished, it's fine, we move).


✨ NAME ✨

Lingua::EN::Syllable β€” count the number of syllables in English words πŸ’…


🌸 SYNOPSIS 🌸

use Lingua::EN::Syllable;

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

like. fourteen. iconic behavior from a word, honestly. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

Lingua::EN::Syllable::syllable() estimates the number of syllables in the word you pass to it. that's the whole vibe. 🫢

and listen β€” it is not entirely accurate, no cap. it fails (by one syllable) for about 10-15% of the author's /usr/dict/words. the only way to get a 100% accurate count is to do a dictionary lookup, so this is the small-and-fast alternative for when "more-or-less accurate" is enough β€” like estimating the reading level of a document. πŸ“š

the author welcomes pointers to more accurate algorithms, because this one is pretty quick-and-dirty (their words, not mine, and honestly? relatable). it was designed for English words β€” well, American at least β€” but sometimes it guesses well for other languages too. 🌈


πŸ’€ KNOWN LIMITATIONS πŸ’€

bestie, read this part. this is the fine print and the fine print is real.

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. so like, clean your input first. 🧼

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. not me leaving homework in the man page 😭

contractions are not well supported. πŸ™ˆ

compound words (like "lifeboat"), where the first word ends in a silent 'e', are counted with an extra syllable. so that's a whole thing.


πŸ‘‘ SEE ALSO πŸ‘‘

  • Lingua::Phonology β€” a framework of classes that provide "an object model for lingistic phonology and sound change". (yes, "lingistic", that's the quote, we're keeping it fr fr.) that includes syllables, and it looks like you can use it to get syllables for words, but from a quick skim of the doc the author can't see exactly how. πŸ˜…
  • Text::Info β€” 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>

go look, it's giving open source. πŸ’–


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. slay, legally speaking. πŸ’…


🌟 AUTHOR 🌟

Greg Fast (gdf@imsa.edu)


and that's the whole page bestie, written by perl v5.36.0 and dated 2022-10-13 β€” so if you ever need to cite it, there you go. now go count some syllables. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from