require 'pronounce' Pronounce.how_do_i_pronounce('monkeys') => [["M", "AH1", "NG"], ["K", "IY0", "Z"]]
Data and Procedure
Pronunciations are based on the CMUdict database: http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/
The phone list is the ARPAbet subset used by CMUdict.
AA, AE, AH, AO, EH, IH, IY, UH, UW
AW, AY, EY, OW, OY
B, D, G, K, P, T
DH, F, SH, S, TH, V, Z, ZH
M, N, NG
Syllables are split by scanning the pronunciation from the start to finish and applying rules of English phonology to determine if the current phone is the start of a new syllable. Because the pronunciations are corpus based rules only need to split valid words, not determine if a word is valid.
Rules are defined by the rule DSL. A rule can return
:not_applicable indicating that the rule doesn't apply in the context and other rules should be evaluated.
module Pronounce::SyllableRules rule :optional_language, 'name of rule' do ... end end
- MRI 1.9.3+
- JRuby 1.7.5+ (1.9 mode only)
- Rubinius 2.2.6