Project

rhopalic

0.0
No commit activity in last 3 years
No release in over 3 years
Detects rhopalic phrases
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.0.2

Runtime

~> 0.6.2
 Project Readme

rhopalic

A Ruby library to detect rhopalic phrases in English, i.e., a phrase in which each word contains one letter or one syllable more than the previous word.

Available as a gem.

Usage

For simple yes or no answers about whether a phrase is rhopalic:

> require 'rhopalic'
=> true
> Rhopalic.letter_rhopalic?("I do not know where family doctors acquired illegibly perplexing handwriting.")
=> true
> Rhopalic.syllable_rhopalic?("Lines thicken approaching termination.")
=> true

There is no exact algorithm for counting syllables in English. For more accurate syllable counting use the CMU pronunciation dictionary:

> require 'rhopalic'
> require 'rhopalic/dictionary'
> dict = Rhopalic::Dictionary.from_file('cmudict.0.7a')
=> ...
> analysis = Rhopalic::Analysis.new(dict)
=> ...
> analysis.analyze_phrase("Add extra syllables gradually").syllable_rhopalic?
=> true

(This is assuming that you have the dictionary file cmudict.0.7a in your working directory.)

License

Distributed under an MIT license.