Tim Maher > Lingua-EN-Namegame-0.05 > Lingua::EN::Namegame

Download:
Namegame/Lingua-EN-Namegame-0.05.tar.gz

Dependencies

Annotate this POD

Related Modules

Time::Format
CGI::Application
more...
By perlmonks.org
View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Lingua::EN::Namegame - Creates a "Name-Game" verse from a name (or word)

VERSION ^

This document describes version 0.04 of Lingua::EN::Namegame, released January 01, 2003.

SYNOPSIS ^

        use Lingua::EN::Namegame;

        $verse = name2verse ('Marsha');

        print $verse;

Or, more simply, at your OS command prompt:

        name2verse.pl  Marsha           # script provided with module

Output

        Marsha Marsha 
            bo Barsha, 
                Banana Fanna Fo Farsha, 
                    Fee Fi Mo-arsha
                        MARSHA!

Or, for extra policital correctness

        name2verse_nonprofane.pl  Bart  # script provided with module

Output

        Sorry, the verse for Bart contains a profane word.

DESCRIPTION ^

Purpose

name2verse is a subroutine that generates a rhyming verse based on a name (or word), in accordance with the "rhyming algorithm" documented in the lyrics of the famous 1960's song The Name Game, by Shirley Ellis.

Background

A presentation based on this program was featured as a Lightning Talk at the North American Yet Another Perl Conference (YAPC::NA) in St. Louis MO, USA, on 6/28/2002.

Thanks to the foresight of the moderator (MJD), the presentation was scheduled as the last one for the day, providing us ample time to delve into extra-curricular shenanigans after the technical part of the presentation.

And few present will ever forget the spine-tingling effect of 300+ deranged Perl fanatics giving song to the rhyming verses for various Perl built-in functions, including map, grep, split, and of course, the especially euphonious wantarray:

        Wantarray Wantarray
            bo Bantarray, 
                Banana Fanna Fo Fantarray, 
                    Fee Fi Mo Mantarray
                          WANTARRAY!

Notice the way this oddly chosen function name smoothly metamorphoses into a denizen of the deep in the penultimate line!

And some thought Larry had goofed up by not calling it wantlist instead. Poppycock!

Profanity Issues

Hey, that's not a bad word itself; let's try it!

        Poppycock Poppycock
            bo Boppycock, 
                Banana Fanna Fo Foppycock, 
                    Fee Fi Mo Moppycock
                      POPPYCOCK!

Which reminds me that some actual human names, such as Bart and especially Chuck, give rise to really rousingly ribald rhymes, which has often led to embarassing outbursts of blushing and snickering in our Perl training classes. One solution is to use the supplied name2verse_nonprofane.pl script to identify and filter-out verses that are judged to contain profane words. It does this through use of the "profanity matching regex" of Damian Conway's Regexp::Common module.

RHYMING ALGORITHM ^

This program was inspired by "One-Liner #40", in The Perl Journal #15, Fall 1999, p. 11., by Sean M. Burke, which used a simplified version of the algorithm for succinctness:

 s<^([bcdfghjklmnpqrstvwxyz]*)(\w+).*>
    <$1$2 $1$2 $1o $1$2/Bonana-Fanna-Fo-F$2/Fe Fi Mo M$2/$1$2!>i;

In contrast, this module aims to comply with the actual rhyming rules of the song, as documented in http://www.geocities.com/SunsetStrip/Palladium/1306/shirley.htm.

General Rules

1. Say the Name twice (following examples using "Dave")
        -> "Dave Dave"
2. Say "bo" and Name again, replacing Name's first letter by B
        -> "Bo Bave"
3. Say "Banana Fanna Fo" Name, replacing Name's first letter by F
        -> "banana Fanna Fo Fave"
4. Say "Fee Fi Mo" Name, replacing Name's first letter by M
        -> "Fee Fi Mo Mave"
5. Finally, exclaim Name
        -> "Dave!"

Alternate Rules

Modified versions of rules 2-4 apply to Names starting with B, F, or M.

2. B-names:

say "Bo" and then Name without the initial B:

        -> "Bo-ob" (for Bob)
        -> "Bo-rian" (for Brian)
        -> "Bo-lanche" (for Blanche)
3. F-names:

instead of "Banana Fanna Fo" Fred:

        -> "Banana Fanna" B<Fo-red>
4. M-names:

instead of "Fee Fi Mo" Marsha:

        -> "Fee Fi" B<Mo-arsha>

BUGS ^

Please let me know if you find any bugs.

EXPORTS ^

name2verse()

SCRIPTS ^

name2verse.pl, name2verse_nonprofane.pl

AUTHOR ^

        Tim Maher
        Consultix
        yumpy@cpan.org
        http://www.teachmeperl.com

SEE ALSO ^

http://www.geocities.com/SunsetStrip/Palladium/1306/shirley.htm

LICENSE ^

Copyright (c) 2002, Timothy F. Maher. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: