NAME

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

SYNOPSIS

First time, to install the dictionary:

use Lingua::Rhyme;
$Lingua::Rhyme::chat=1;
$Lingua::Rhyme::DATABASE = "rhymedict";
$Lingua::Rhyme::USER	 = "MyUserName";
$Lingua::Rhyme::PASSWORD = "password";

Lingua::Rhyme::build('C:/lang/win2k/perl/site/lib/lingua');

Thereafter:

use Lingua::Rhyme;
$Lingua::Rhyme::DATABASE = "rhymedict";
$Lingua::Rhyme::USER	 = "MyUserName";
$Lingua::Rhyme::PASSWORD = "password";

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

DBI.pm, DBD::mysql.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.

$HOSTNAME, $PORT, $USER. $PASSWORD

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

FUNCTIONS

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

&build

Running this function will fill the database with three tables from the supplied textfiles, words.txt, rhymes.txt, and multiple.txt, which should be in the Rhyme/dict/EN/ sub-directory of this module's location.. If these tables exist, they will be dropped.

If one paramter is supplied, it should be the directory in which this module is installed in.

If no paramter is supplied, the script will use the first value it finds in @INC that contains the string site, because we assume this module is installed in a standard location. To avoid this, call with the paramter undef.

NB> the process will be as slow as your system: YMMV.

&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.

&findall ($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)

Accepts two words as scalars and returns 1 if $word1 rhymes with $word2, otherwise returns undef.

&matchall ($word_to_compare, $word2_to_compare);

See if two words rhyme. Accepts two scalars to compare, and returns 1 on success, otherwise 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

Tidy

Tidy the db accessing, error messaging and catching, maybe?

Languages

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

SEE ALSO

Lingua::Rhyme::FindScheme; 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.081 Mon Apr 08 19:32 2002
	- fixed buy in syllable

0.08  Mon Apr 08 19:22 2002
	- tidied up POD and modified param of C<build()>.

0.07  Fri Jun 01 12:12:00 2001
	- added matchall routine

0.06  Thu May 31 14:35:00 2001
	- corrected connection bug

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.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 485:

'=item' outside of any '=over'

Around line 493:

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