| 1 |
NAME |
| 2 |
|
| 3 |
Lingua::EN::Inflect::Phrase - Inflect short English Phrases |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
use Lingua::EN::Inflect::Phrase; |
| 8 |
use Test::More tests => 2; |
| 9 |
|
| 10 |
my $plural = Lingua::EN::Inflect::Phrase::to_PL('green egg and ham'); |
| 11 |
|
| 12 |
is $plural, 'green eggs and ham'; |
| 13 |
|
| 14 |
my $singular = Lingua::EN::Inflect::Phrase::to_S('green eggs and ham'); |
| 15 |
|
| 16 |
is $singular, 'green egg and ham'; |
| 17 |
|
| 18 |
DESCRIPTION |
| 19 |
|
| 20 |
Attempts to pluralize or singularize short English phrases. |
| 21 |
|
| 22 |
Does not throw exceptions at present, if you attempt to pluralize an |
| 23 |
already pluralized phrase, it will leave it unchanged (and vice versa.) |
| 24 |
|
| 25 |
The behavior of this module is subject to change as I tweak the |
| 26 |
heuristics, as some things get fixed others might regress. The |
| 27 |
processing of natural language is a messy business. |
| 28 |
|
| 29 |
If it doesn't work, please email or submit to RT the example you tried, |
| 30 |
and I'll try to fix it. |
| 31 |
|
| 32 |
OPTIONS |
| 33 |
|
| 34 |
By default, this module prefers to treat words as nouns (sometimes |
| 35 |
words can be interpreted as a verb or a noun without context.) This is |
| 36 |
better for things such as database table/column names, which is what |
| 37 |
this module is primarily for. |
| 38 |
|
| 39 |
This behavior can be switched with the variable $prefer_nouns. The |
| 40 |
default is 1. |
| 41 |
|
| 42 |
For example: |
| 43 |
|
| 44 |
{ |
| 45 |
local $Lingua::EN::Inflect::Phrase::prefer_nouns = 0; |
| 46 |
is Lingua::EN::Inflect::Phrase::to_S('sources split'), 'source splits'; |
| 47 |
} |
| 48 |
{ |
| 49 |
local $Lingua::EN::Inflect::Phrase::prefer_nouns = 1; |
| 50 |
is Lingua::EN::Inflect::Phrase::to_S('source splits'), 'source split'; |
| 51 |
} |
| 52 |
|
| 53 |
OPTIONAL EXPORTS |
| 54 |
|
| 55 |
"to_PL", "to_S" |
| 56 |
|
| 57 |
SUBROUTINES |
| 58 |
|
| 59 |
to_PL |
| 60 |
|
| 61 |
Attempts to pluralizes a phrase unless already plural. |
| 62 |
|
| 63 |
to_S |
| 64 |
|
| 65 |
Attempts to singularize a phrase unless already singular. |
| 66 |
|
| 67 |
BUGS |
| 68 |
|
| 69 |
Please report any bugs or feature requests to |
| 70 |
bug-lingua-en-inflect-phrase at rt.cpan.org, or through the web |
| 71 |
interface at |
| 72 |
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lingua-EN-Inflect-Phrase. |
| 73 |
I will be notified, and then you'll automatically be notified of |
| 74 |
progress on your bug as I make changes. |
| 75 |
|
| 76 |
REPOSITORY |
| 77 |
|
| 78 |
git clone git://github.com/rkitover/lingua-en-inflect-phrase.git lingua-en-inflect-phrase |
| 79 |
|
| 80 |
SEE ALSO |
| 81 |
|
| 82 |
Lingua::EN::Inflect, Lingua::EN::Inflect::Number, Lingua::EN::Tagger |
| 83 |
|
| 84 |
AUTHOR |
| 85 |
|
| 86 |
rkitover: Rafael Kitover <[email protected]> |
| 87 |
|
| 88 |
CONTRIBUTORS |
| 89 |
|
| 90 |
zakame: Zak B. Elep <[email protected]> |
| 91 |
|
| 92 |
LICENSE AND COPYRIGHT |
| 93 |
|
| 94 |
Copyright (c) 2018 Rafael Kitover ([email protected]). |
| 95 |
|
| 96 |
This program is free software; you can redistribute it and/or modify it |
| 97 |
under the terms of either: the GNU General Public License as published |
| 98 |
by the Free Software Foundation; or the Artistic License. |
| 99 |
|
| 100 |
See http://dev.perl.org/licenses/ for more information. |
| 101 |
|