Lingua::Bork - Perl extension for Bork Bork Bork


Lingua-Bork documentation Contained in the Lingua-Bork distribution.

Index


Code Index:

NAME

Top

Lingua::Bork - Perl extension for Bork Bork Bork

SYNOPSIS

Top

  use Lingua::Bork 'bork';
  print bork("This is the conjunction junction.")

DESCRIPTION

Top

Bork Bork Bork.

EXPORT

Top

None by default.

Can export bork function for convenience.

AUTHOR

Top

Michael Ching, <michaelc@wush.net>

SEE ALSO

Top

http://www.cs.yorku.ca/course_archive/2000-01/W/3311/assignments/a1.pdf

KNOWN PROBLEMS

Top

Automagically title cases words to distinguish start and end 'e'.

This man page is not in Bork Bork Bork.


Lingua-Bork documentation Contained in the Lingua-Bork distribution.

package Lingua::Bork;

use strict;
use warnings;

require Exporter;

use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $VERSION);

@ISA = qw(Exporter);

%EXPORT_TAGS = ( 'all' => [ 'bork' ] );
@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

$VERSION = '0.03';

my %map = ( tion => 'shun', # tail only
            the  => 'zee',  # full match
            an   => 'un',
            au   => 'oo',
            en   => 'ee', # tail only
            ir   => 'ur',
            ow   => 'oo',
#           E    => 'I',  # head only
            e    => 'ea', # tail only
            f    => 'ff',
#           i    => 'ee', # first in word
            o    => 'u',  # within word
            u    => 'oo',
            v    => 'f',
            w    => 'v',
           );

sub new {
  my $class = shift;
  bless {}, ref($class)||$class;
}

sub bork {
   local $_ = shift;
   local $_ = shift if ref($_);
   
   s/(tion\b|\bthe\b|an|au|en\b|ir|ow|e\b|f|\Bo\B|u|v|w)/my $trans = $map{lc $1}; $1 eq lc($1) ? $map{lc $1} : ucfirst($map{lc $1})/eig;

   # first i in a word
   s/(i)(\S+)/ $1 eq 'i' ? "ee$2" : "Ee$2" /eig;

   # leading e
   s/\b(e)(?!e)/ $1 eq 'e' ? 'i' : 'I' /eig;

   s/([.!?])+/$1  Bork Bork Bork!/g;
   return $_;
}

1;
__END__