NAME

Lingua::Rhyme - MySQL-based rhyme-lookups.

SYNOPSIS

First time:

use Lingua::Rhyme;
$Lingua::Rhyme::chat=1;
build;

Thereafter:

use Lingua::Rhyme;
my @rhymes_for_house = @{ Lingua::Rhyme::simplefind('house') };

my @rhymes_for_tomAto = @{ Lingua::Rhyme::simplefind('tomato') };

warn "Test if 'house' rhymes with 'mouse'....\n";
if (simplematch("house","mouse")){
	warn "They rhyme.\n";
} else {
	warn "They don't rhyme!";
}

warn syllable("contrary");


__END__

DESCRIPTION

This module uses an SQL database of rhyming words to find words that rhyme. See the &build function for further information.

This is actually Text::Rhyme version 0.04, but rhyming is now considered a linguist, rather than a textual, operation.

INSTALLATION

See the enclosed file, INSTALL.

PREREQUISITES

MySQL
DBI.pm

CLASS VARIABLES

$chat

You can set this for real-time chat on what's up, leave as undef for silent operation.

$database

The name of the rhyming dictionary database that will be created. Defaults to rhymedict.

$driver

The DBI::* driver, defaults to mysql.

The following variables must be set by the user to access the database.

$hostname
$port
$user
$password

FUNCTIONS

&build

Running this function will create a MySQL database of two tables from the two supplied textfiles, words.txt and rhymes.txt, which should be in the same sub-directory Rhyme/dict/EN/. If these tables exist, they will be dropped.

Calling with a parameter will provide some minimal chat on what's going on.

The process can be as slow as your system: YMMV.

SIMPLE LOOK UPS

Functions begining with the word simple will not take into account multiple pronunciations, for which use functions ending with the word all.

&simplefind ($word_to_match)

Accepts a scalar of one word to lookup, and returns a reference to an array of rhyming words, or undef if the word isn't in the dictionary.

&finall ($word_to_lookup)

Accepts a scalar as a word to look up, and returns a reference to an array containing all the matches for all pronunciations of the word.

&simplematch ($word1,$word2)

Returns 1 if $word1 rhymes with $word2, otherwise returns undef.

&syllable ($word_to_lookup)

Accepts a word to look up, and returns the number of syllables in the word supplied, or undef if the word isn't in the dictionary.

CAVEATS

There appear to be duplicate entires in the DB:

DBD::mysql::db do failed: Duplicate entry '#?2,M+?*.+' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 13570.
DBD::mysql::db do failed: Duplicate entry '7*?7\.?/.N' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 16070.
DBD::mysql::db do failed: Duplicate entry 'E,[' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 20111.
DBD::mysql::db do failed: Duplicate entry 'E1=' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 20397.
DBD::mysql::db do failed: Duplicate entry '02)?#D/.?2' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 20623.
DBD::mysql::db do failed: Duplicate entry 'e,:' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 25587.
DBD::mysql::db do failed: Duplicate entry 'E)@' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 25605.
DBD::mysql::db do failed: Duplicate entry 'e):' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 30844.
DBD::mysql::db do failed: Duplicate entry 'e2:' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 30983.
DBD::mysql::db do failed: Duplicate entry 'e"[' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 34284.
DBD::mysql::db do failed: Duplicate entry 'E#,U' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 34545.
DBD::mysql::db do failed: Duplicate entry 'e4:' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 34637.
DBD::mysql::db do failed: Duplicate entry '-T2,M+?*.+' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 36221.
DBD::mysql::db do failed: Duplicate entry '/B+,=' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 41578.
DBD::mysql::db do failed: Duplicate entry '4T2)A#?/.N' for key 1 at E:\Src\Pl\Text\Rhyme\build.pl line 53, <WORDS> line 41821.

TODO

Languages

If I can find dictionaries for German and Yiddish (or others), I'll add those too.

SEE ALSO

DBI; MySQL; The Rhyming Dictionary; Carnegie Mellon University Pronouncing Dictionary; perl(1).

ACKNOWLEDGMENTS

A thousand thanks to Brian "tuffy" Langenberger for the database files used in his Rhyming Dictionary. Brain writes that his 'work is based wholly on the work of the Carnegie Mellon University Pronouncing Dictionary'.

AUTHOR

Lee Goddard <lgoddard@cpan.org>

CHANGES

Revision history for Perl extension Text::Rhyme.

0.05 Thu May 31 13:13:00 2001 - added multiple.txt db - added new functions and renamed old functions

0.04 Wed May 30 19:01:25 2001 - completely rewritten - now uses a MySQL DB. - moved namespace, as rhyming is now a linguist, not textual, operation (if it ever was).

0.03 Tue May 29 13:35:12 2001 - ACTUALLY text-rhyme-0.03 - added parsing of final consenants. Still I can't spell.

0.02 Tue May 29 12:32:00 2001 - ACTUALLY text-rhyme-0.02 - damn, got the module name wrong!

0.01 Tue May 29 12:18:12 2001 - ACTUALLY text-rhyme-0.01 - original version; created by h2xs 1.20 with options -Xcfn Text::Rhyme

COPYRIGHT

Copyright (C) Lee Goddard, 30/05/2001 ff.

This is free software, and can be used/modified under the same terms as Perl itself.

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 58:

'=item' outside of any '=over'

Around line 94:

You forgot a '=back' before '=head1'

Around line 398:

'=item' outside of any '=over'

Around line 402:

You forgot a '=back' before '=head1'