1Lingua::EN::Inflect::PhUrsaesre(C3o)ntributed Perl DocumLeinntgautai:o:nEN::Inflect::Phrase(3)
2
3
4
6 Lingua::EN::Inflect::Phrase - Inflect short English Phrases
7
9 use Lingua::EN::Inflect::Phrase;
10 use Test::More tests => 2;
11
12 my $plural = Lingua::EN::Inflect::Phrase::to_PL('green egg and ham');
13
14 is $plural, 'green eggs and ham';
15
16 my $singular = Lingua::EN::Inflect::Phrase::to_S('green eggs and ham');
17
18 is $singular, 'green egg and ham';
19
21 Attempts to pluralize or singularize short English phrases.
22
23 Does not throw exceptions at present, if you attempt to pluralize an
24 already pluralized phrase, it will leave it unchanged (and vice versa.)
25
26 The behavior of this module is subject to change as I tweak the
27 heuristics, as some things get fixed others might regress. The
28 processing of natural language is a messy business.
29
30 If it doesn't work, please email or submit to RT the example you tried,
31 and I'll try to fix it.
32
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
54 "to_PL", "to_S"
55
57 to_PL
58 Attempts to pluralizes a phrase unless already plural.
59
60 to_S
61 Attempts to singularize a phrase unless already singular.
62
64 Please report any bugs or feature requests to
65 "bug-lingua-en-inflect-phrase at rt.cpan.org", or through the web
66 interface at
67 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lingua-EN-Inflect-Phrase>.
68 I will be notified, and then you'll automatically be notified of
69 progress on your bug as I make changes.
70
72 git clone git://github.com/rkitover/lingua-en-inflect-phrase.git lingua-en-inflect-phrase
73
75 Lingua::EN::Inflect, Lingua::EN::Inflect::Number, Lingua::EN::Tagger
76
78 rkitover: Rafael Kitover <rkitover@cpan.org>
79
81 zakame: Zak B. Elep <zakame@zakame.net>
82
84 Copyright (c) 2018 Rafael Kitover (rkitover@cpan.org).
85
86 This program is free software; you can redistribute it and/or modify it
87 under the terms of either: the GNU General Public License as published
88 by the Free Software Foundation; or the Artistic License.
89
90 See http://dev.perl.org/licenses/ for more information.
91
92
93
94perl v5.38.0 2023-07-20 Lingua::EN::Inflect::Phrase(3)