News Feed
Jobs Feed
Sections




News Archive
Cameron McKay:
Counting Syllables and Detecting Rhyme in PHP
August 16, 2012 @ 10:18:57

In this new post to his site, Cameron McKay has posted a bit of interesting code - functionality that detects the number of syllables in words and checks for rhyming in phrases.

The simplicity of the rules got me thinking: how hard would it be to write a program to check if a poem stanza is ottava rima? In this article, we will write a simple ottava rima detector in PHP.

His code takes in the content and performs a few checks, one simple (length) and two custom - "is_iambic_pentameter" and "is_abababcc_rhyme". The code for these two checks are included in the post as well that, in turn, use some other functions to count syllables and vowels and use Arpabet phonetic transcription and monophthongs/diphthongs to detect iambic pentameter and rhyme.

0 comments voice your opinion now!
syllables rhyme detection iambicpentameter tutorial


blog comments powered by Disqus

Similar Posts

IBM developerWorks: Process and integrate Google Notebook data with PHP

Zend Developer Zone: Manipulating Images with PHP and GraphicsMagick

Content with Style: Zend Framework with nginx and php-fastcgi

Zend Developer Zone: Tutorial : Using Zend Framework Without PDO

Sudheer Satyanarayana's Blog: A Bit Of XML, RSS And CURL In 7 Lines Of PHP And A Useful Program


Community Events









Don't see your event here?
Let us know!


testing tool composer community podcast unittest release example object development introduction language opinion zendframework2 phpunit framework api interview database code

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework