Module: Rhopalic
- Defined in:
- lib/rhopalic/phrase.rb,
lib/rhopalic/version.rb,
lib/rhopalic/analysis.rb,
lib/rhopalic/rhopalic.rb,
lib/rhopalic/dictionary.rb,
lib/rhopalic/contractions.rb
Defined Under Namespace
Classes: Analysis, Dictionary, Phrase
Constant Summary collapse
- VERSION =
'0.0.2'
- CONTRACTIONS =
Known contractions in English mapped to syllable counts.
{ "aren't" => 1, "can't" => 1, "couldn't" => 2, "didn't" => 2, "doesn't" => 2, "don't" => 1, "hadn't" => 2, "hasn't" => 2, "haven't" => 2, "he'd" => 1, "he'll" => 1, "he's" => 1, "i'd" => 1, "i'll" => 1, "i'm" => 1, "i've" => 1, "isn't" => 2, "it'll" => 2, "it's" => 1, "let's" => 1, "mightn't" => 2, "mustn't" => 2, "shan't" => 1, "she'd" => 1, "she'll" => 1, "she's" => 1, "shouldn't" => 2, "that's" => 1, "there'd" => 1, "there'll" => 1, "there's" => 1, "they'd" => 1, "they'll" => 1, "they're" => 1, "they've" => 1, "we'd" => 1, "we're" => 1, "we've" => 1, "weren't" => 2, "what'll" => 2, "what're" => 2, "what's" => 1, "what've" => 2, "where's" => 1, "who'd" => 1, "who'll" => 1, "who're" => 1, "who's" => 1, "who've" => 1, "won't" => 1, "wouldn't" => 2, "y'all" => 1, "you'd" => 1, "you'll" => 1, "you're" => 1, "you've" => 1, }
Class Method Summary collapse
-
.analyze_phrase(phrase) ⇒ Object
Returns the analyzed phrase if it’s rhopalic, nil otherwise.
-
.letter_rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is letter-rhopalic in English (each word has one letter more than the preceding one).
-
.rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is letter-rhopalic or syllable-rhopalic.
-
.syllable_rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is syllable-rhopalic in English (each word has one syllable more than the preceding one).
Class Method Details
.analyze_phrase(phrase) ⇒ Object
Returns the analyzed phrase if it’s rhopalic, nil otherwise.
6 7 8 |
# File 'lib/rhopalic/rhopalic.rb', line 6 def self.analyze_phrase(phrase) Analysis.new.analyze_phrase(phrase) end |
.letter_rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is letter-rhopalic in English (each word has one letter more than the preceding one).
12 13 14 15 |
# File 'lib/rhopalic/rhopalic.rb', line 12 def self.letter_rhopalic?(phrase) analyzed = analyze_phrase(phrase) !analyzed.nil? && analyzed.letter_rhopalic? end |
.rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is letter-rhopalic or syllable-rhopalic.
25 26 27 |
# File 'lib/rhopalic/rhopalic.rb', line 25 def self.rhopalic?(phrase) !analyze_phrase(phrase).nil? end |
.syllable_rhopalic?(phrase) ⇒ Boolean
Returns whether the given phrase is syllable-rhopalic in English (each word has one syllable more than the preceding one).
19 20 21 22 |
# File 'lib/rhopalic/rhopalic.rb', line 19 def self.syllable_rhopalic?(phrase) analyzed = analyze_phrase(phrase) !analyzed.nil? && analyzed.syllable_rhopalic? end |