.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Template::Plugin::Lingua::EN::Inflect 3pm" .TH Template::Plugin::Lingua::EN::Inflect 3pm "2021-01-08" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Template::Plugin::Lingua::EN::Inflect \- Interface to Lingua::EN::Inflect module .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& [% USE infl = Lingua.EN.Inflect; \-%] \& [% FILTER inflect(number => 42); \-%] \& There PL_V(was) NO(error). \& PL_ADJ(This) PL_N(error) PL_V(was) fatal. \& [% END; \-%] \& \& [% "... and "; infl.ORD(9); "ly..." %] \& \& # Output: \& # There were 42 errors. \& # These errors were fatal. \& # ... and 9thly... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Lingua::EN::Inflect is an interface to Damian Conway's Linua::EN::Inflect Perl module, which provides plural inflections, \&\*(L"a\*(R"/\*(L"an\*(R" selection for English words, and manipulation of numbers as words. .PP The plugin provides an 'inflect' filter, which can be used to interpolate inflections in a string. The \s-1\fBNUM\s0()\fR function sets a persistent default value to be used whenever an optional number argument is omitted. The number to be used for a particular invocation of 'inflect' can also be specified with a 'number' option. .PP For the full gory details of the inflection functionality refer to the Lingua::EN::Inflect manual. .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .ie n .IP """infl.A($string, $opt_number)""" 4 .el .IP "\f(CWinfl.A($string, $opt_number)\fR" 4 .IX Item "infl.A($string, $opt_number)" prepends the appropriate indefinite article to a word, depending on its pronunciation. If the second argument is provided and its value is numeric and not 1 then the value of the second argument is used instead. .Sp e.g. \f(CW\*(C`infl.A("idea")\*(C'\fR returns \f(CW"an idea"\fR .ie n .IP """AN($string, $opt_number)""" 4 .el .IP "\f(CWAN($string, $opt_number)\fR" 4 .IX Item "AN($string, $opt_number)" synonym for \f(CW\*(C`A()\*(C'\fR .ie n .IP """NO($string, $opt_arg)""" 4 .el .IP "\f(CWNO($string, $opt_arg)\fR" 4 .IX Item "NO($string, $opt_arg)" given a word and an optional count, returns the count followed by the correctly inflected word .ie n .IP """NUM($string, $opt_arg)""" 4 .el .IP "\f(CWNUM($string, $opt_arg)\fR" 4 .IX Item "NUM($string, $opt_arg)" sets a persistent \fIdefault number\fR value, which is subsequently used whenever an optional second \fInumber\fR argument is omitted. The default value thus set can subsequently be removed by calling \f(CW\*(C`NUM()\*(C'\fR with no arguments. \f(CW\*(C`NUM()\*(C'\fR normally returns its first argument, however if \f(CW\*(C`NUM()\*(C'\fR is called with a second argument that is defined and evaluates to false then \f(CW\*(C`NUM()\*(C'\fR returns an empty string. .ie n .IP """NUMWORDS($string, $opt_arg)""" 4 .el .IP "\f(CWNUMWORDS($string, $opt_arg)\fR" 4 .IX Item "NUMWORDS($string, $opt_arg)" takes a number (cardinal or ordinal) and returns an English represen\- tation of that number. In a scalar context a string is returned. In a list context each comma-separated chunk is returned as a separate element. .ie n .IP """ORD($number)""" 4 .el .IP "\f(CWORD($number)\fR" 4 .IX Item "ORD($number)" takes a single argument and forms its ordinal equivalent. If the argument isn't a numerical integer, it just adds \*(L"\-th\*(R". .ie n .IP """PART_PRES($string, $opt_arg)""" 4 .el .IP "\f(CWPART_PRES($string, $opt_arg)\fR" 4 .IX Item "PART_PRES($string, $opt_arg)" returns the present participle for a third person singluar verb .Sp .Vb 1 \& PART_PRES("runs"); # returns "running" .Ve .ie n .IP """PL($string, $opt_arg)""" 4 .el .IP "\f(CWPL($string, $opt_arg)\fR" 4 .IX Item "PL($string, $opt_arg)" returns the plural of a \fIsingular\fR English noun, pronoun, verb or adjective. .ie n .IP """PL_N($string, $opt_arg)""" 4 .el .IP "\f(CWPL_N($string, $opt_arg)\fR" 4 .IX Item "PL_N($string, $opt_arg)" returns the plural of a \fIsingular\fR English noun or pronoun. .ie n .IP """PL_V($string, $opt_arg)""" 4 .el .IP "\f(CWPL_V($string, $opt_arg)\fR" 4 .IX Item "PL_V($string, $opt_arg)" returns the plural conjugation of the \fIsingular\fR form of a conjugated verb. .ie n .IP """PL_ADJ($string, $opt_arg)""" 4 .el .IP "\f(CWPL_ADJ($string, $opt_arg)\fR" 4 .IX Item "PL_ADJ($string, $opt_arg)" returns the plural form of a \fIsingular\fR form of certain types of adjectives. .ie n .IP """PL_eq($string, $opt_arg)""" 4 .el .IP "\f(CWPL_eq($string, $opt_arg)\fR" 4 .IX Item "PL_eq($string, $opt_arg)" .PD 0 .ie n .IP """PL_N_eq($string, $opt_arg)""" 4 .el .IP "\f(CWPL_N_eq($string, $opt_arg)\fR" 4 .IX Item "PL_N_eq($string, $opt_arg)" .ie n .IP """PL_V_eq($string, $opt_arg)""" 4 .el .IP "\f(CWPL_V_eq($string, $opt_arg)\fR" 4 .IX Item "PL_V_eq($string, $opt_arg)" .ie n .IP """PL_ADJ_eq($string, $opt_arg)""" 4 .el .IP "\f(CWPL_ADJ_eq($string, $opt_arg)\fR" 4 .IX Item "PL_ADJ_eq($string, $opt_arg)" .ie n .IP """classical($string, $opt_arg)""" 4 .el .IP "\f(CWclassical($string, $opt_arg)\fR" 4 .IX Item "classical($string, $opt_arg)" .ie n .IP """def_noun($string, $opt_arg)""" 4 .el .IP "\f(CWdef_noun($string, $opt_arg)\fR" 4 .IX Item "def_noun($string, $opt_arg)" .ie n .IP """def_verb($string, $opt_arg)""" 4 .el .IP "\f(CWdef_verb($string, $opt_arg)\fR" 4 .IX Item "def_verb($string, $opt_arg)" .ie n .IP """def_adj($string, $opt_arg)""" 4 .el .IP "\f(CWdef_adj($string, $opt_arg)\fR" 4 .IX Item "def_adj($string, $opt_arg)" .ie n .IP """def_a($string, $opt_arg)""" 4 .el .IP "\f(CWdef_a($string, $opt_arg)\fR" 4 .IX Item "def_a($string, $opt_arg)" .ie n .IP """def_an($string, $opt_arg)""" 4 .el .IP "\f(CWdef_an($string, $opt_arg)\fR" 4 .IX Item "def_an($string, $opt_arg)" .PD .SH "INTERNAL METHODS" .IX Header "INTERNAL METHODS" .ie n .IP """tt_inflect($string, $opt_arg)""" 4 .el .IP "\f(CWtt_inflect($string, $opt_arg)\fR" 4 .IX Item "tt_inflect($string, $opt_arg)" The underlying inflect filter. .SH "TODO" .IX Header "TODO" Finish off documenting the object methods. .PP Provide tests for all methods in the test suite. .PP It would also be nice to have methods that spelled out numbers that were less than a certain threshold and that formatted large numbers with commas, for example: .PP .Vb 2 \& inflect("There PL_V(was) NO(error).", number => 0); \& # outputs: "There were no errors." \& \& inflect("There PL_V(was) NO(error).", number => 1); \& # outputs: "There was one errors." \& \& inflect("There PL_V(was) NO(error).", number => 3); \& # outputs: "There were three errors." \& \& inflect("There PL_V(was) NO(error).", number => 1042); \& # outputs: "There were 1,042 errors." .Ve .PP This would require changes to the Lingua::EN::Inflect module. .SH "SEE ALSO" .IX Header "SEE ALSO" Lingua::EN::Inflect, Template, \f(CW\*(C`Template::Plugin\*(C'\fR .SH "DEDICATION" .IX Header "DEDICATION" This distribution was originally created by Andrew Ford. Sadly in early 2014, Andrew was diagnosed with Pancreatic Cancer and passed away peacfully at home on 25th April 2014. .PP One of his wishes was for his OpenSource work to continue. At his funeral, many of his colleagues and friends, spoke of how he felt like a person of the world, and how he embrace the idea of OpenSource being for the benefit of the world. .PP Anyone wishing to donate in memory of Andrew, please consider the following charities: .IP "Dignity in Dying \- " 4 .IX Item "Dignity in Dying - " .PD 0 .IP "Marie Curie Cancer Care \- " 4 .IX Item "Marie Curie Cancer Care - " .PD .SH "AUTHOR" .IX Header "AUTHOR" .Vb 2 \& Original Author: Andrew Ford 2005\-2014 \& Current Maintainer: Barbie 2014 .Ve .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Andrew Ford wrote the original plugin code (basing it heavily on the Template::Plugin::Autoformat code). .PP Damian Conway wrote the Lingua::EN::Inflect module, which does all the clever stuff. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright (C) 2005\-2014 Andrew Ford Copyright (C) 2014\-2015 Barbie for Miss Barbell Productions. .PP This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.