Lingua::EN::Inflect 1.89 |
Date Added: November 23, 2010 | Visits: 327 |
|
||||||||
|
Lingua::EN::Inflect is a Perl module that can convert singular to plural. Select "a" or "an". SYNOPSIS use Lingua::EN::Inflect qw ( PL PL_N PL_V PL_ADJ NO NUM PL_eq PL_N_eq PL_V_eq PL_ADJ_eq A AN PART_PRES ORD NUMWORDS inflect classical def_noun def_verb def_adj def_a def_an ); # UNCONDITIONALLY FORM THE PLURAL print "The plural of ", $word, " is ", PL($word), "n"; # CONDITIONALLY FORM THE PLURAL print "I saw $cat_count ", PL("cat",$cat_count), "n"; # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH print PL_N("I",$N1), PL_V("saw",$N1), PL_ADJ("my",$N2), PL_N("saw",$N2), "n"; # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION: print "There ", PL_V("was",$errors), NO(" error",$errors), "n"; # USE DEFAULT COUNTS: print NUM($N1,""), PL("I"), PL_V(" saw"), NUM($N2), PL_N(" saw"); print "There ", NUM($errors,), PL_V("was"), NO(" error"), "n"; # COMPARE TWO WORDS "NUMBER-INSENSITIVELY": print "samen" if PL_eq($word1, $word2); print "same nounn" if PL_eq_N($word1, $word2); print "same verbn" if PL_eq_V($word1, $word2); print "same adj.n" if PL_eq_ADJ($word1, $word2); # ADD CORRECT "a" OR "an" FOR A GIVEN WORD: print "Did you want ", A($thing), " or ", AN($idea), "n"; # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.) print "It was", ORD($position), " from the leftn"; # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.) # IN A SCALAR CONTEXT: GET BACK A SINGLE STRING... $words = NUMWORDS(1234); # "one thousand, two hundred and thirty-four" $words = NUMWORDS(ORD(1234)); # "one thousand, two hundred and thirty-fourth" # IN A LIST CONTEXT: GET BACK A LIST OF STRINGSi, ONE FOR EACH "CHUNK"... @words = NUMWORDS(1234); # ("one thousand","two hundred and thirty-four") # OPTIONAL PARAMETERS CHANGE TRANSLATION: $words = NUMWORDS(12345, group=>1); # "one, two, three, four, five" $words = NUMWORDS(12345, group=>2); # "twelve, thirty-four, five" $words = NUMWORDS(12345, group=>3); # "one twenty-three, forty-five" $words = NUMWORDS(1234, and=>); # "one thousand, two hundred thirty-four" $words = NUMWORDS(1234, and=>, plus); # "one thousand, two hundred, plus thirty-four" $words = NUMWORDS(555_1202, group=>1, zero=>oh); # "five, five, five, one, two, oh, two" $words = NUMWORDS(555_1202, group=>1, one=>unity); # "five, five, five, unity, two, oh, two" $words = NUMWORDS(123.456, group=>1, decimal=>mark); # "one two three mark four five six" # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim") classical; # USE ALL CLASSICAL PLURALS classical 1; # USE ALL CLASSICAL PLURALS classical 0; # USE ALL MODERN PLURALS (DEFAULT) classical zero; # "no error" INSTEAD OF "no errors" classical zero=>1; # "no error" INSTEAD OF "no errors" classical zero=>0; # "no errors" INSTEAD OF "no error" classical herd; # "2 buffalo" INSTEAD OF "2 buffalos" classical herd=>1; # "2 buffalo" INSTEAD OF "2 buffalos" classical herd=>0; # "2 buffalos" INSTEAD OF "2 buffalo" classical persons; # "2 chairpersons" INSTEAD OF "2 chairpeople" classical persons=>1; # "2 chairpersons" INSTEAD OF "2 chairpeople" classical persons=>0; # "2 chairpeople" INSTEAD OF "2 chairpersons" classical ancient; # "2 formulae" INSTEAD OF "2 formulas" classical ancient=>1; # "2 formulae" INSTEAD OF "2 formulas" classical ancient=>0; # "2 formulas" INSTEAD OF "2 formulae" # INTERPOLATE "PL()", "PL_N()", "PL_V()", "PL_ADJ()", A()", "AN()" # "NUM()" AND "ORD()" WITHIN STRINGS: print inflect("The plural of $word is PL($word)n"); print inflect("I saw $cat_count PL("cat",$cat_count)n"); print inflect("PL(I,$N1) PL_V(saw,$N1) PL(a,$N2) PL_N(saw,$N2)"); print inflect("NUM($N1,)PL(I) PL_V(saw) NUM($N2,)PL(a) PL_N(saw)"); print inflect("I saw NUM($cat_count) PL("cat")nNUM()"); print inflect("There PL_V(was,$errors) NO(error,$errors)n"); print inflect("There NUM($errors,) PL_V(was) NO(error)n"; print inflect("Did you want A($thing) or AN($idea)n"); print inflect("It was ORD($position) from the leftn"); # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES): def_noun "VAX" => "VAXen"; # SINGULAR => PLURAL def_verb "will" => "shall", # 1ST PERSON SINGULAR => PLURAL "will" => "will", # 2ND PERSON SINGULAR => PLURAL "will" => "will", # 3RD PERSON SINGULAR => PLURAL def_adj "hir" => "their", # SINGULAR => PLURAL def_a "h" # "AY HALWAYS SEZ HAITCH!" def_an "horrendous.*" # "AN HORRENDOUS AFFECTATION" The exportable subroutines of Lingua::EN::Inflect provide plural inflections, "a"/"an" selection for English words, and manipulation of numbers as words Plural forms of all nouns, most verbs, and some adjectives are provided. Where appropriate, "classical" variants (for example: "brother" -> "brethren", "dogma" -> "dogmata", etc.) are also provided. Pronunciation-based "a"/"an" selection is provided for all English words, and most initialisms. It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd) and to english words ("one", "two", "three). In generating these inflections, Lingua::EN::Inflect follows the Oxford English Dictionary and the guidelines in Fowlers Modern English Usage, preferring the former where the two disagree. The module is built around standard British spelling, but is designed to cope with common American variants as well. Slang, jargon, and other English dialects are not explicitly catered for. Where two or more inflected forms exist for a single word (typically a "classical" form and a "modern" form), Lingua::EN::Inflect prefers the more common form (typically the "modern" one), unless "classical" processing has been specified (see "MODERN VS CLASSICAL INFLECTIONS")..
|
| License: Freeware | Size: 40.96 KB |
|
Programming
-
SMDoubleSlider 2.0
The SMDoubleSlider distribution is an open source project that allows you to use sliders with two knobs instead of the standard one knob variety. |
225.28 KB | |
|
Network & Internet
-
PloneMinimalProduct 2.0Beta1
PloneMinimalProduct provides a skeleton one can use to create new types (instead of starting "from scratch"). There is a script called customize.sh (working with Bash) that will do this job for you. Example usage:: $ tar xzf... |
58.37 KB | |
|
Multimedia & Graphics
-
fftrans 0.0.1
fftrans is a modification of the "Quick and Dirty Transcoder" script to use ffmpeg instead of gstreamer. Very quick-and-dirty, only usable for transcoding files for transfer to media devices, but as far as I know the only way one can transcode... |
10.24 KB | |
|
Libraries
-
Mail::Message::Head::Complete 2.069
Mail::Message::Head::Complete is a Perl module with the header of one message. INHERITANCE Mail::Message::Head::Complete is a Mail::Message::Head is a Mail::Reporter Mail::Message::Head::Complete is extended by... |
583.68 KB | |
|
Libraries
-
Java::Build 0.05
Java::Build is a family of modules which you can use instead of Ant. SYNOPSIS use Java::Build::JVM; # access to the javac compiler in one jvm use Java::Build::Tasks; # some helpful methods similar to Ant tasks my $source_files =... |
30.72 KB | |
|
E-Mail Tools
-
QmailLDAP/Controls 20060403b
QmailLDAP/Controls stores control information for Qmail in an LDAP database instead of files. QmailLDAP/Controls program requires the Qmail-LDAP patch. The main reason for this patch was having a centralised configuration of qmail. My point was... |
38.91 KB | |
|
Libraries
-
XML::Generator::DOM 0.99
XML::Generator::DOM is an XML::Generator subclass for producing DOM trees instead of strings. SYNOPSIS use XML::Generator::DOM; my $dg = XML::Generator::DOM->new(); my $doc = $dg->xml($dg->xmlcmnt("Test document."), $dg->foo({baz => bam},... |
21.5 KB | |
|
Libraries
-
List::Part 0.03
List::Part is a Perl module that allows you to partition one array into several. SYNOPSIS use List::Part; ($good, $bad)=part { !/substring/ } @array; #store arrayrefs into $good and $bad (*good, *bad)=part { !/substring/ } @array; #store... |
4.1 KB | |
|
Libraries
-
Java::Build::Tasks 0.05
Java::Build::Tasks is a Perl module that collects common Java build tasks in one place: jar, jarsigner, etc. SYNOPSIS use Java::Build::Tasks; set_logger($log_object); copy_file(source, dest); copy_file(list, of, sources, dest);... |
30.72 KB | |
|
Libraries
-
Convert::Cyrillic 1.05
Convert::Cyrillic is a Perl module with routines for converting from one cyrillic charset to another. SYNOPSIS use Convert::Cyrillic; $src = koi8; $dst = win; $SrcBuf = text in koi8 here; $DstBuf = Convert::Cyrillic::cstocs ($Src, $Dst,... |
24.58 KB |
|
Programming
-
RailsTidy 0.1
RailsTidy project is a plugin for Ruby On Rails.. |
11.26 KB | |
|
Programming
-
Strings edit 1.9
Strings edit is a library that provides I/O facilities for integer, floating-point, Roman numbers, and strings. Both input and output subroutines support string pointers for consequent stream processing. The output can be aligned in a fixed size... |
54.27 KB | |
|
Programming
-
BScript 0.3
BScript is a (yet another) BASIC interpreter. It is free software and open-sourced, licensed under the terms of the GNU General Public License version 2 or later. You can use BScript to teach BASIC to your students, write understandable shell... |
112.64 KB | |
|
Programming
-
Kits JavaScript Brainf*ck Interpreter 0.01
Kits JavaScript Brainf*ck Interpreter is a rather fast interpreter for the Brainf*ck esoteric programming language.. Kit's JavaScript Brainfuck Interpreter v0.01 |
5.12 KB | |
|
Programming
-
dis6502 0.12
dis6502 is a flow-tracing disassembler for the 6502, originally written by Robert Bond and supporting Atari binary files. Robert posted dis6502 to the Usenet newsgroup net.sources on 9-Oct-1986, and to comp.sources.unix 7-Jun-1988. Udi... |
19.46 KB | |
|
Libraries
-
Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;... |
8.19 KB | |
|
Libraries
-
sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also... |
10.24 KB | |
|
Libraries
-
App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>... |
54.27 KB | |
|
Libraries
-
PDL::Graphics::TriD 2.4.3
PDL::Graphics::TriD is a PDL 3D interface. SYNOPSIS use PDL::Graphics::TriD; # After each graph, let the user rotate is and # wait for him to press q, then make new graph line3d($coords); # $coords = (3,n,...) line3d($coords,$colors); #... |
2.1 MB | |
|
Libraries
-
SmartColorWell 1.2
SmartColorWell is a cross-platform open-source ColorWell class for REALbasic 4 or greater. The SmartColorWell control stores a color value and displays that color in a simulated BevelButton that when pressed allows the user to change the color... |
21.5 KB |
