NAME

Lingua::EN::CMUDict - Perl extension for utilizing the CMU dictionary file

SYNOPSIS

use Lingua::EN::CMUDict;
my $obj = new Lingua::EN::CMUDict;
print $obj->number_of_syllables("test");

DESCRIPTION

This version of the CMU Pronouncing dictionary was generated from the original dictionary and designed to syllabify it. The paper On the Syllabification of Phonemes by Susan Bartlett, Grzegorz Kondrak and Colin Cherry (NAACL-HLT 2009) covers the methods used to generate the dictionary.

EXPORT

None by default.

METHODS

new(cmudict=>file)

Creates a new object, populating it with the cmusyldict db file. If the cmudict argument is passed with a filename as the argument, that file is used. If you do not use that argument, the default cmusyldict db file installed with the module is used.

rhymes(word)

In the case of an array being returned, returns all rhymes to the given word. In a scalar context, returns a single rhyme.

number_of_syllables(word)

Returns the number of syllables in the word. Many pluralities do not add syllable counts and are therefore not in the original database. This code tries to be intelligent by looking for those and returning the number of syllables. Also, if a sentence is passed in, returns the number of syllables in the sentence. Doesn't currently deal with punctuation very well.

get_word(word)

Returns the pronunciation for the word with syllable boundaries.

SEE ALSO

Lingua::EN::Phoneme -- another way of accessing the CMU Pronunciation dictionary.

AUTHOR

Leigh Metcalf, <leigh@fprime.net>

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Leigh Metcalf

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.