File Coverage

blib/lib/Lingua/EN/Conjugate.pm
Criterion Covered Total %
statement 184 225 81.7
branch 97 134 72.3
condition 23 36 63.8
subroutine 23 25 92.0
pod 6 15 40.0
total 333 435 76.5


line stmt bran cond sub pod time code
1            
2             package Lingua::EN::Conjugate;
3            
4 2     2   1490908 use Data::Dumper;
  2         26177  
  2         321  
5             require Exporter;
6            
7             @ISA = qw( Exporter );
8            
9             @EXPORT_OK = qw(
10             conjugate
11             conjugations
12             participle
13             past
14             gerund
15             s_form
16             @tenses
17             @pron
18             %irreg
19             %no_double
20             );
21            
22 2     2   21 use warnings;
  2         5  
  2         63  
23 2     2   11 use strict;
  2         8  
  2         79  
24             #use diagnostics;
25            
26 2     2   1847 use Lingua::EN::Contraction qw(contract_n_t contract_other);
  2         3313  
  2         252  
27            
28            
29 2     2   2435 if (eval "use Memoize") {
  2         11544  
  2         119  
30             memoize('stem');
31             memoize('participle');
32             memoize('past');
33             memoize('gerund');
34             memoize('s_form');
35             }
36            
37 2         8271 use vars qw(
38             $VERSION
39             %irreg
40             @pron
41             @tenses
42             %conj
43             %no_double
44             %tense_patterns
45            
46 2     2   13 );
  2         2  
47            
48             $VERSION = '0.311';
49             @pron = qw(I you we he she it they);
50            
51            
52             our @modal = qw(may might must be being been am are is was were do does did should could would have has had will can shall);
53            
54            
55            
56             our $modal_re = '\b(?:' . join("|", @modal) . ')';
57             $modal_re = qr/$modal_re/i;
58             our $pronoun_re = '\b(?:' . join("|", @pron) . ')\b';
59             $pronoun_re = qr/$pronoun_re/i;
60            
61            
62            
63             @tenses = qw (
64             present present_prog
65             past past_prog
66             past_prog used_to
67             perfect past_perfect
68             perfect_prog past_perfect_prog
69             modal modal_prog
70             modal_perf_prog conjunctive_present
71             imperative
72             );
73            
74             %tense_patterns = (
75            
76             ACTIVE => {
77             # TENSE STATEMENT QUESTION
78             present => [ '@ PRESENT *', 'PRESENT @ *' ],
79             present_do => [ '@ DO * INF', 'DO @ * INF' ],
80             present_prog => [ '@ BE * GERUND', 'BE @ * GERUND' ],
81             past => [ '@ PAST *', 'PAST @ *' ],
82             past_do => [ '@ did * INF', 'did @ * INF' ],
83             past_prog => [ '@ WAS * GERUND', 'WAS @ * GERUND' ],
84             used_to => [ '@ used to * INF', 'N/A' ],
85             perfect => [ '@ HAVE * PART', 'HAVE @ * PART' ],
86             past_perfect => [ '@ had * PART', 'had @ * PART' ],
87             perfect_prog => [ '@ HAVE * been GERUND', 'HAVE @ * been GERUND' ],
88             past_perfect_prog =>
89             [ '@ had * been GERUND', 'had @ * been GERUND' ],
90             modal => [ '@ MODAL * INF', 'MODAL @ * INF' ],
91             modal_prog => [ '@ MODAL * be GERUND', 'MODAL @ * be GERUND' ],
92             modal_perf => [ '@ MODAL * have PART', 'MODAL @ * have PART' ],
93             modal_perf_prog =>
94             [ '@ MODAL * have been GERUND', 'MODAL @ * have been GERUND' ],
95             conjunctive_present => [ '@ INF', 'N/A' ],
96             imperative => [ 'IMPERATIVE', 'N/A' ] },
97            
98             PASSIVE => {
99             present => [ '@ BE * PART', 'BE @ * PART' ],
100             present_prog => [ '@ BE * being PART', 'BE @ * being PART' ],
101             past => [ '@ WAS * PART', 'WAS @ * PART' ],
102             past_prog => [ '@ WAS * being PART', 'WAS @ * being PART' ],
103             perfect => [ '@ HAVE * been PART', 'HAVE @ * been PART' ],
104             past_perfect => [ '@ had * been PART', 'had @ * been PART' ],
105             modal => [ '@ MODAL * be PART', 'MODAL @ * be PART' ],
106             modal_perf => [ '@ MODAL * have been PART', 'MODAL @ * have been PART' ]
107             }
108             # @ = pronoun, * = not
109             );
110            
111             %irreg = _irreg();
112            
113            
114             $no_double{$_} = 1 for _no_double();
115            
116            
117            
118            
119             sub conjugate {
120            
121 26     26 1 2184 my %params = @_;
122            
123             #parameters:
124 26         47 our ($inf, $modal, $passive, $allow_contractions, $question, $negation, $no_pronoun);
125            
126             #forms of the verb determined by "init_verb":
127             #our ($part, $past, $gerund, $s_form,);
128            
129 26 50       79 $inf =
130             defined $params{verb} ? $params{verb} : warn "must define a verb!!\n",
131             return undef;
132 26         224 $inf =~ s/^ *| *$//g;
133 26         57 $inf =~ s/ *//g;
134            
135 26 100       77 $modal = defined $params{modal} ? $params{modal} : 'will';
136 26 100       58 $passive = defined $params{passive} ? $params{passive} : undef;
137 26 100       83 $allow_contractions = defined $params{allow_contractions}? $params{allow_contractions}: undef;
138 26 100       62 $no_pronoun = defined $params{no_pronoun}? $params{no_pronoun} : undef;
139            
140            
141 26 50       252 unless ( $modal =~ $modal_re ) {
142 0         0 warn "$modal is not a modal verb!!\n";
143 0         0 return 0;
144             }
145            
146 26 100       61 $question = defined $params{question} ? $params{question} : 0;
147 26 100       61 $negation = defined $params{negation} ? $params{negation} : undef;
148            
149             # ( $part, $past, $gerund, $s_form ) = init_verb($inf);
150            
151 26 50 100     248 if ( ref $params{pronoun}
      66        
      66        
152             or ref $params{tense}
153             or !defined $params{pronoun}
154             or !defined $params{tense} )
155             {
156 2         4 my $ret = {};
157 2         7 my @t =
158 2 0       8 ref $params{tense} ? @{ $params{tense} }
    50          
159             : defined $params{tense} ? $params{tense}
160             : @tenses;
161            
162 2         3 for my $t (@t) {
163            
164 4         9 my @p =
165 2         7 ref $params{pronoun} ? grep { defined _conj($inf, $t, $_ ) }
166 14         32 @{ $params{pronoun} }
167             : defined $params{pronoun} ? $params{pronoun}
168 4 50       20 : grep { defined _conj( $inf, $t, $_ ) } @pron;
    100          
169            
170 4         13 for my $p (@p) {
171 18 50       38 next unless defined _conj($inf, $t, $p );
172 18         42 $ret->{$t}{$p} = _conj($inf, $t, $p );
173             }
174             }
175            
176 2 100       9 if (wantarray) {
177 1         3 my @return = ();
178 1         2 for my $t ( keys %{$ret} ) {
  1         5  
179 2         3 for my $p ( keys %{ $ret->{$t} } ) {
  2         7  
180            
181 4         14 push @return, $ret->{$t}{$p};
182             }
183             }
184 1         12 return @return;
185             }
186 1         13 else { return $ret }
187             }
188            
189 24         75 return _conj($inf, $params{tense}, $params{pronoun} );
190            
191            
192             sub _conj {
193            
194 78     78   134 my ( $inf, $tense, $pronoun ) = @_;
195 78         156 my $part = participle($inf);
196 78         148 my $past = past($inf);
197 78         148 my $gerund = gerund($inf);
198 78         149 my $s_form = s_form($inf);
199            
200            
201             # special cases...
202 78 100       180 if ( match_any( $inf, qw(should could would can shall will may might must))) {
203 2 100       11 return undef unless $tense eq 'present';
204             }
205 77 100       404 if ( $inf !~ $modal_re ) {
206 58 100 66     139 if ( $tense eq 'present' and (defined $negation or $question) and not defined $passive) {
      66        
      100        
207 1         2 $tense = 'present_do';
208             }
209 58 100 66     156 if ( $tense eq 'past' and (defined $negation or $question) and not defined $passive) {
      66        
      66        
210 2         6 $tense = 'past_do';
211             }
212             }
213            
214 77 50 33     163 if ( $tense eq 'conjunctive_present' and defined $negation ) {
215 0         0 return undef;
216            
217             }
218            
219 77 100       160 my $active_passive = $passive ? 'PASSIVE' : 'ACTIVE';
220            
221 77 50       275 my $pattern = $tense_patterns{$active_passive}{$tense}[$question] or return undef;
222            
223 77 100       133 if ($no_pronoun) {
224 1         6 $pattern =~ s/^\@ //;
225             }
226            
227 77         250 $pattern =~ s/\@/$pronoun/;
228            
229            
230 77 50       194 if ( $pattern eq 'N/A' ) { return undef; }
  0         0  
231 77         108 $pattern =~ s/DO/DO($pronoun)/e;
  1         54  
232 77         152 $pattern =~ s/WAS/WAS($pronoun)/e;
  28         62  
233 77         127 $pattern =~ s/HAVE/HAVE($pronoun)/e;
  1         4  
234 77         121 $pattern =~ s/MODAL/$modal/;
235 77         105 $pattern =~ s/BE/BE($pronoun)/e;
  5         26  
236 77         144 $pattern =~ s/GERUND/$gerund/;
237 77         110 $pattern =~ s/PART/$part/;
238 77 100       363 if ( $pattern =~ /PRESENT/ ) {
    100          
    100          
    100          
239 10 50       25 my $p = PRESENT( $inf, $s_form, $pronoun ) or return undef;
240 10         34 $pattern =~ s/PRESENT/$p/;
241             }
242             elsif ( $pattern =~ /IMPERATIVE/ ) {
243 1 50       4 my $i = IMPERATIVE( $inf, $negation, $pronoun ) or return undef;
244 1         4 $pattern =~ s/IMPERATIVE/$i/;
245             }
246             elsif ( $pattern =~ /PAST/ ) {
247            
248 6 50       20 my $p = $inf =~ /^be$/ ? WAS($pronoun) : $past ;
249 6         20 $pattern =~ s/PAST/$p/;
250             }
251             elsif ( $pattern =~ /INF/ ) {
252 25 50       56 return undef unless defined $inf;
253 25         78 $pattern =~ s/INF/$inf/;
254             }
255            
256 77 100       144 if ($negation) {
257 8         35 $pattern =~ s/\*/not/;
258 8 100       26 if ($negation eq 'n_t') {
259 5         25 $pattern = contract_n_t($pattern);
260             }
261             }
262             else {
263 69         360 $pattern =~ s/ ?\*( ?)/$1/;
264             }
265            
266 77 100       1200 if ($allow_contractions) {
267 2         10 $pattern = contract_other($pattern);
268             }
269            
270 77         807 return $pattern;
271            
272             }
273            
274            
275             sub IMPERATIVE {
276 1     1 0 3 my $inf = shift;
277 1         2 my $negation = shift;
278 1         2 my $pronoun = shift;
279            
280 1 50       8 if ( $pronoun =~ /we/i ) {
    50          
281 0         0 my $retval = "let us";
282 0 0       0 if ( defined $negation ) {
283 0         0 $retval .= " not";
284             }
285 0         0 $retval .= " $inf";
286 0         0 return $retval;
287             }
288             elsif ( $pronoun =~ /you/i ) {
289 1 50       3 if ( $negation ) {
290 1         25 return "do not $inf";
291             }
292             else {
293 0         0 return "$inf";
294             }
295             }
296             else {
297 0         0 return undef;
298             }
299             }
300            
301             }
302             sub match_any {
303 120     120 0 149 my $a = shift;
304 120         327 my @b = @_;
305 120 100       198 for (@b) { return 1 if $a =~ /\b$_\b/i ; }
  802         7412  
306 93         300 return undef;
307             }
308            
309            
310             sub PRESENT {
311 10     10 0 15 my $inf = shift;
312 10         16 my $s_form = shift;
313 10         21 my $pronoun = shift;
314            
315 10 100       37 if ( $inf =~ /^be$/i ) { return BE($pronoun); }
  7         26  
316 3 100       11 if ( $inf =~ /^have$/i ) { return HAVE($pronoun); }
  1         6  
317 2 100 66     13 if (defined $s_form and match_any($pronoun, qw(he she it))) { return $s_form; }
  1         5  
318            
319 1         4 return $inf;
320             }
321            
322            
323             sub BE {
324 12     12 0 20 my $pronoun = shift;
325 12 100       26 if ( $pronoun eq 'I' ) { return 'am' }
  3         12  
326            
327 9 100       18 if (match_any($pronoun, qw(he she it))) { return 'is'; }
  6         24  
328            
329 3         11 return 'are';
330             }
331            
332             sub WAS {
333 28     28 0 41 my $pronoun = shift;
334 28 100       55 if (match_any($pronoun, qw(I he she it))) { return 'was'; }
  15         49  
335            
336 13         44 return 'were';
337             }
338            
339             sub HAVE {
340 2     2 0 4 my $pronoun = shift;
341 2 50       8 if (match_any($pronoun, qw(he she it))) { return 'has'; }
  2         9  
342 0         0 return 'have';
343             }
344            
345             sub DO {
346 1     1 0 3 my $pronoun = shift;
347 1 50       4 if (match_any($pronoun, qw(he she it))) { return 'does'; }
  1         3  
348 0         0 return 'do';
349             }
350            
351             sub conjugations {
352            
353 0     0 1 0 my ( $tense, $pronoun, $result, @_tenses );
354            
355 0         0 my %params = @_;
356            
357 0         0 my @pnouns = defined $params{pronoun} ?
358 0 0       0 (ref $params{pronoun}? @{ $params{pronoun} } : $params{pronoun})
    0          
359             : qw(I you he we they);
360            
361 0         0 my $conjugs = conjugate(@_);
362            
363 0         0 @_tenses = grep { defined $conjugs->{$_} } @tenses;
  0         0  
364            
365 0         0 $result = "";
366 0         0 foreach ( $tense = 0 ; $tense <= $#_tenses ; $tense += 2 ) {
367 0         0 my $t1 = $_tenses[$tense];
368 0 0       0 my $t2 = $tense < scalar @_tenses ? $_tenses[ $tense + 1 ] : undef;
369 0         0 $result .= centered( uc( $_tenses[$tense] ), 35, "-" );
370 0         0 $result .= " ";
371 0 0       0 $result .= centered( uc( $_tenses[ $tense + 1 ] ), 35, "-" )
372             if defined $t2;
373 0         0 $result .= "\n";
374 0         0 for $pronoun (@pnouns) {
375 0 0       0 my $s1 =
376             defined $conjugs->{$t1}{$pronoun}
377             ? $conjugs->{$t1}{$pronoun}
378             : '';
379 0 0 0     0 my $s2 =
380             defined $t2
381             && defined $conjugs->{$t2}{$pronoun}
382             ? $conjugs->{$t2}{$pronoun}
383             : '';
384 0         0 $result .= sprintf "%-35s %-35s\n", $s1, $s2;
385            
386             }
387             }
388 0         0 return $result;
389            
390             sub centered {
391 0     0 0 0 my ( $string, $len, $fill ) = @_;
392 0 0       0 $fill = " " unless defined $fill;
393 0         0 my $result = $fill x ( ( $len - length($string) ) / 2 - 1 );
394 0         0 $result .= " ";
395 0         0 $result .= $string;
396 0         0 $result .= " ";
397 0         0 $result .= $fill x ( $len - length($result) );
398 0         0 return $result;
399             }
400             }
401            
402            
403            
404            
405             sub stem {
406            
407 106     106 0 134 my $inf = shift;
408 106         121 my $stem = $inf;
409            
410 106 100       286 if ( $stem =~ /[bcdfghjklmnpqrstvwxyz][aeiou][bcdfghjklmnpqrstv]$/ ) {
411            
412             #if the word ends in CVC pattern (but final consonant is not w,x,y, or z)
413             # and if the stress is not on the penultimate syllable, then double
414             # the final consonant.
415             #
416             # The stop list (stored in %no_double) is a list of words ending in CVC, with the stress
417             # on the penultimate syllable such as visit, happen, enter, etc.
418            
419 20 100       96 $stem =~ s/(\w)$/$1$1/ unless $no_double{$stem};
420            
421             }
422 106         261 return $stem;
423             }
424            
425             sub participle {
426            
427 92     92 1 110 my $inf = shift;
428 92 100       449 return $irreg{$inf}{part} if defined $irreg{$inf};
429            
430 28         49 my $stem = stem($inf);
431            
432 28         59 my $part = $stem . 'ed';
433 28         47 $part =~ s/([bcdfghjklmnpqrstvwxyz])eed$/$1ed/;
434 28         54 $part =~ s/([bcdfghjklmnpqrstvwxyz])yed$/$1ied/;
435 28         35 $part =~ s/eed$/ed/;
436            
437            
438 28         61 return $part;
439            
440             }
441            
442             sub past {
443            
444 79     79 1 134 my $inf = shift;
445 79 100       461 return $irreg{$inf}{past} if defined $irreg{$inf};
446 14         37 return participle($inf);
447             }
448            
449             sub gerund {
450            
451 78     78 1 91 my $inf = shift;
452 78         126 my $stem = stem($inf);
453            
454            
455 78         122 my $gerund = $stem . 'ing';
456 78         126 $gerund =~ s/(.[bcdfghjklmnpqrstvwxyz])eing$/$1ing/;
457 78         103 $gerund =~ s/ieing$/ying/;
458 78         145 return $gerund;
459            
460             }
461            
462             sub s_form {
463            
464 82     82 1 99 my $inf = shift;
465 82         96 my $s_form;
466             #may might must be being been am are is was were do does did should could would have has had will can shall
467 82 100       696 if ( $inf eq 'be') { $s_form = 'is'; }
  13 100       18  
    100          
    100          
    100          
    100          
468 1         2 elsif ( $inf eq 'do') { $s_form = 'does'; }
469 3         7 elsif ( $inf eq 'have') { $s_form = 'has'; }
470 4         8 elsif ( $inf =~ $modal_re ) { $s_form = $inf; }
471            
472             elsif ( $inf =~ /[ho]$|ss$/ ) {
473 46         75 $s_form = $inf . "es";
474             }
475             elsif ( $inf =~ /[bcdfghjklmnpqrstvwxyz]y$/ ) {
476 1         2 $s_form = $inf;
477 1         5 $s_form =~ s/y$/ies/;
478             }
479            
480             else {
481 14         26 $s_form = $inf . "s";
482             }
483            
484 82         181 return $s_form;
485            
486             }
487            
488            
489             1;
490            
491             =head1 NAME
492            
493             Lingua::EN::Conjugate - Conjugation of English verbs
494            
495             =head1 SYNOPSIS
496            
497             use Lingua::EN::Conjugate qw( conjugate conjugations contraction);
498            
499            
500             print conjugate( 'verb'=>'look',
501             'tense'=>'perfect_prog',
502             'pronoun'=>'he',
503             'negation'=>'not' );
504            
505             # "he was not looking"
506            
507            
508             my $go = conjugate( 'verb'=>'go',
509             'tense'=>[qw(past modal_perf)],
510             'modal'=>'might') ;
511            
512             # returns a hashref
513            
514             print $go->{modal_perf}{I}; # "I might have gone"
515            
516            
517            
518             my @be = conjugate( 'verb'=>'be',
519             'pronoun'=>[qw(I we)],
520             'tense'=>'past_prog',
521             'negation'=>'n_t' );
522            
523             # returns an array
524             print $be[0]; # "I wasn't going"
525            
526            
527             #pretty printed table of conjugations
528            
529             print conjugations( 'verb'=>'walk',
530             'question'=>1,
531             'allow_contractions'=>1,
532             'modal'=>'should',
533             'negation'=>'n_t');
534             ------------- PRESENT ------------- ---------- PRESENT_PROG -----------
535             don't I walk am I not walking
536             don't you walk aren't you walking
537             doesn't he walk isn't he walking
538             don't we walk aren't we walking
539             don't they walk aren't they walking
540             -------------- PAST --------------- ------------ PAST_PROG ------------
541             didn't I walk wasn't I walking
542             didn't you walk weren't you walking
543             didn't he walk wasn't he walking
544             didn't we walk weren't we walking
545             didn't they walk weren't they walking
546             ----------- PRESENT_DO ------------ ------------- PAST_DO -------------
547             don't I walk didn't I walk
548             don't you walk didn't you walk
549             doesn't he walk didn't he walk
550             don't we walk didn't we walk
551             don't they walk didn't they walk
552             ------------ PAST_PROG ------------ ------------- PERFECT -------------
553             wasn't I walking haven't I walked
554             weren't you walking haven't you walked
555             wasn't he walking hasn't he walked
556             weren't we walking haven't we walked
557             weren't they walking haven't they walked
558             ---------- PAST_PERFECT ----------- ---------- PERFECT_PROG -----------
559             hadn't I walked haven't I been walking
560             hadn't you walked haven't you been walking
561             hadn't he walked hasn't he been walking
562             hadn't we walked haven't we been walking
563             hadn't they walked haven't they been walking
564             -------- PAST_PERFECT_PROG -------- -------------- MODAL --------------
565             hadn't I been walking shouldn't I walk
566             hadn't you been walking shouldn't you walk
567             hadn't he been walking shouldn't he walk
568             hadn't we been walking shouldn't we walk
569             hadn't they been walking shouldn't they walk
570             -------------- MODAL -------------- --------- MODAL_PERF_PROG ---------
571             shouldn't I walk shouldn't I have been walking
572             shouldn't you walk shouldn't you have been walking
573             shouldn't he walk shouldn't he have been walking
574             shouldn't we walk shouldn't we have been walking
575             shouldn't they walk shouldn't they have been walking
576            
577            
578            
579            
580            
581             =head1 DESCRIPTION
582            
583             This module constructs various verb tenses in English.
584            
585             Thanks to Susan Jones for the list of irregular verbs and an explanation of English verb tenses L.
586            
587             =over
588            
589             =item past($infinitive)
590            
591             past tense form of the verb: "go" -> "went"
592            
593             =item participle($infinitive)
594            
595             past participle form of the verb: "go" -> "gone"
596            
597             =item gerund($infinitive)
598            
599             "-ing" form of the verb: "go" -> "going"
600            
601             =item s_form($infinitive)
602            
603             third person singular form of the verb: "go" -> "goes"
604            
605             =item conjugate('verb'=> 'go' , OPTIONS)
606            
607             In scalar context with tense and pronoun defined as scalars, only one conjugation is returned.
608            
609             In scalar context with tense and pronoun undefined or defined as array refs, a hashref keyed by tense and pronoun is returned.
610            
611             In array context, it returns an array of conjugated forms ordered by tense, then pronoun.
612            
613            
614             =item verb
615            
616             'verb'=>'coagulate'
617            
618             The only required parameter. The verb should be in its infinitive form (no "is", "was" etc.) and without a "to" tacked on the front.
619            
620             =item tense
621            
622             'tense'=>'past'
623             'tense'=>['modal_perf', 'used_to']
624            
625             If no 'tense' argument is supplied, all applicable tenses are returned.
626            
627             =item passive
628            
629             'passive' => 1
630             'passive' => undef (default)
631            
632             If specified, the passive voice is used. Some tenses, such as Imperiative, are disabled when the passive option is used.
633            
634            
635             =item pronoun
636            
637             'pronoun'=>'he'
638             'pronoun'=>[qw(I we you)]
639            
640             If no 'pronoun' argument is supplied, all applicable pronouns are returned.
641            
642             =item question
643            
644             'question' => 1
645             'question' => 0 (default)
646            
647             In case you're playing Jeapordy
648            
649             =item negation
650            
651             'negation'=> 'not'
652             'negation'=> 'n_t'
653             'negation'=> undef (default)
654            
655             Changes "do" to "do not" or "don't" depending on which value you request.
656             For words where you can't use "n't" (like "am") or where it feels clumsy or antique (like "may"),
657             this will substitute "not" for "n_t" as appropriate.
658            
659             =item modal
660            
661             'modal' => one of: may, might, must, should, could, would, will (default), can, shall.
662            
663             Specifies what modal verb to use for the modal tenses.
664            
665            
666             L
667            
668             =item allow_contractions
669            
670             'allow_contractions'=>1 allows "I am"->"I'm", "they are"->"they're" and so on
671             'allow_contractions'=>0 (default)
672            
673             The negation rule above is applied before the allow_contractions rule is checked:
674            
675             allow_contractions =>1, negation=>n_t : "he isn't walking";
676             allow_contractions =>0, negation=>n_t : "he isn't walking";
677             allow_contractions =>1, negation=>not : "he's not walking";
678             allow_contractions =>0, negation=>not " "he is not walking";
679            
680            
681             =item conjugations()
682            
683             returns a pretty-printed table of conjugations. (code stolen from L)
684            
685             =back
686            
687             =head2 EXPORT
688            
689             None by default. You can export the following functions and variables:
690            
691             conjugate
692             conjugations
693             past
694             participle
695             gerund
696             s_form
697             @tenses
698             @pronouns
699            
700             =head1 BUGS
701            
702             =head1 TODO
703            
704             HAVE TO + Verb
705             HAVE GOT TO + Verb
706             BE ABLE TO + Verb
707             OUGHT TO + Verb
708             BE SUPPOSED TO + Verb
709            
710             =head1 AUTHOR
711            
712             Russ Graham, russgraham@gmail.com
713            
714             =head1 SEE ALSO
715            
716             =over
717            
718             =item
719            
720             L
721            
722             =item
723            
724             L
725            
726             =item
727            
728             L
729            
730             =back
731            
732             =cut
733            
734             sub _irreg {
735 2     2   5 my %irreg; for (split /\n/, _irreg_data()) {
  2         9  
736 354 50       968 next unless /\w/;
737 354         818 my ( $verb, $simp, $part ) = split /-/, $_;
738 354         455 $verb =~ s/\(.*//;
739 354         403 $simp =~ s/\/.*//;
740 354         428 $part =~ s/\/.*//;
741 1062         4559 ( $verb, $simp, $part ) =
742 354         396 map { s/^\s*|\s*$//g; $_ } ( $verb, $simp, $part );
  1062         2059  
743 354         1625 $irreg{$verb} = { past => $simp, part => $part };
744             }
745              
746              
747 2         212 return %irreg;
748             #print "$verb, $simp, $part\n";
749            
750             }
751              
752             sub _irreg_data {
753 2     2   90 return <
754             awake - awoke - awoken
755             be - was, were - been
756             bear - bore - born
757             beat - beat - beat
758             become - became - become
759             begin - began - begun
760             bend - bent - bent
761             beset - beset - beset
762             bet - bet - bet
763             bid - bid/bade - bid/bidden
764             bind - bound - bound
765             bite - bit - bitten
766             bleed - bled - bled
767             blow - blew - blown
768             break - broke - broken
769             breed - bred - bred
770             bring - brought - brought
771             broadcast - broadcast - broadcast
772             build - built - built
773             burn - burned/burnt - burned/burnt
774             burst - burst - burst
775             buy - bought - bought
776             cast - cast - cast
777             catch - caught - caught
778             choose - chose - chosen
779             cling - clung - clung
780             come - came - come
781             cost - cost - cost
782             creep - crept - crept
783             cut - cut - cut
784             deal - dealt - dealt
785             dig - dug - dug
786             dive - dove/dived - dived
787             do - did - done
788             draw - drew - drawn
789             dream - dreamed/dreamt - dreamed/dreamt
790             drive - drove - driven
791             drink - drank - drunk
792             dye - dyed - dyed
793             eat - ate - eaten
794             fall - fell - fallen
795             feed - fed - fed
796             feel - felt - felt
797             fight - fought - fought
798             find - found - found
799             fit - fit - fit
800             flee - fled - fled
801             fling - flung - flung
802             fly - flew - flown
803             forbid - forbade - forbidden
804             forget - forgot - forgotten
805             forego - forewent - foregone
806             forgo - forwent - forgone
807             forgive - forgave - forgiven
808             forsake - forsook - forsaken
809             freeze - froze - frozen
810             get - got - gotten
811             give - gave - given
812             go - went - gone
813             grind - ground - ground
814             grow - grew - grown
815             hang - hung - hung
816             have - had - had
817             hear - heard - heard
818             hide - hid - hidden
819             hit - hit - hit
820             hold - held - held
821             hurt - hurt - hurt
822             keep - kept - kept
823             kneel - knelt - knelt
824             knit - knit - knit
825             know - knew - know
826             lay - laid - laid
827             lead - led - led
828             leap - leaped/lept - leaped/lept
829             learn - learned/learnt - learned/learnt
830             leave - left - left
831             lend - lent - lent
832             let - let - let
833             lie - lay - lain
834             light - lit/lighted - lighted
835             lose - lost - lost
836             make - made - made
837             mean - meant - meant
838             meet - met - met
839             misspell - misspelled/misspelt - misspelled/misspelt
840             mistake - mistook - mistaken
841             mow - mowed - mowed/mown
842             overcome - overcame - overcome
843             overdo - overdid - overdone
844             overtake - overtook - overtaken
845             overthrow - overthrew - overthrown
846             pay - paid - paid
847             plead - pled - pled
848             prove - proved - proved/proven
849             put - put - put
850             quit - quit - quit
851             read - read - read
852             rid - rid - rid
853             ride - rode - ridden
854             ring - rang - rung
855             rise - rose - risen
856             run - ran - run
857             saw - sawed - sawed/sawn
858             say - said - said
859             see - saw - seen
860             seek - sought - sought
861             sell - sold - sold
862             send - sent - sent
863             set - set - set
864             sew - sewed - sewed/sewn
865             shake - shook - shaken
866             shave - shaved - shaved/shaven
867             shear - shore - shorn
868             shed - shed - shed
869             shine - shone - shone
870             shoe - shoed - shoed/shod
871             shoot - shot - shot
872             show - showed - showed/shown
873             shrink - shrank - shrunk
874             shut - shut - shut
875             sing - sang - sung
876             sink - sank - sunk
877             sit - sat - sat
878             sleep - slept - slept
879             slay - slew - slain
880             slide - slid - slid
881             sling - slung - slung
882             slit - slit - slit
883             smite - smote - smitten
884             sow - sowed - sowed/sown
885             speak - spoke - spoken
886             speed - sped - sped
887             spend - spent - spent
888             spill - spilled/spilt - spilled/spilt
889             spin - spun - spun
890             spit - spit/spat - spit
891             split - split - split
892             spread - spread - spread
893             spring - sprang/sprung - sprung
894             stand - stood - stood
895             steal - stole - stolen
896             stick - stuck - stuck
897             sting - stung - stung
898             stink - stank - stunk
899             stride - strod - stridden
900             strike - struck - struck
901             string - strung - strung
902             strive - strove - striven
903             swear - swore - sworn
904             sweep - swept - swept
905             swell - swelled - swelled/swollen
906             swim - swam - swum
907             swing - swung - swung
908             take - took - taken
909             teach - taught - taught
910             tear - tore - torn
911             tell - told - told
912             think - thought - thought
913             thrive - thrived/throve - thrived
914             throw - threw - thrown
915             thrust - thrust - thrust
916             tread - trod - trodden
917             understand - understood - understood
918             uphold - upheld - upheld
919             upset - upset - upset
920             wake - woke - woken
921             wear - wore - worn
922             weave - weaved/wove - weaved/woven
923             wed - wed - wed
924             weep - wept - wept
925             wind - wound - wound
926             win - won - won
927             withhold - withheld - withheld
928             withstand - withstood - withstood
929             wring - wrung - wrung
930             write - wrote - written
931             EOF
932              
933             }
934             sub _no_double{
935 2     2   530 return qw(
936             abandon accouter accredit adhibit administer alter anchor answer attrit audit
937             author ballot banner batten bedizen bespatter betoken bewilder billet blacken
938             blither blossom bother brighten broaden broider burden caparison catalog censor
939             center charter chatter cheapen chipper chirrup christen clobber cluster coarsen
940             cocker coedit cohabit concenter corner cover covet cower credit custom dampen
941             deafen decipher deflower delimit deposit develop differ disaccustom discover
942             discredit disencumber dishearten disinherit dismember dispirit dither dizen
943             dodder edit elicit embitter embolden embosom embower empoison empower enamor
944             encipher encounter endanger enfetter engender enlighten enter envelop envenom
945             environ exhibit exit fasten fatten feather fester filter flatten flatter
946             flounder fluster flutter foreshorten founder fritter gammon gather gladden
947             glimmer glisten glower greaten hamper hanker happen harden harken hasten
948             hearten hoarsen honor imprison inhabit inhibit inspirit interpret iron laten
949             launder lengthen liken limber limit linger litter liven loiter lollop louden
950             lower lumber madden malinger market matter misinterpret misremember monitor
951             moulder murder murmur muster number offer open order outmaneuver overmaster
952             pamper pilot pivot plaster plunder powder power prohibit reckon reconsider
953             recover redden redeliver register rejigger remember renumber reopen reposit
954             rewaken richen roister roughen sadden savor scatter scupper sharpen shatter
955             shelter shimmer shiver shorten shower sicken smolder smoothen soften solicit
956             squander stagger stiffen stopper stouten straiten strengthen stutter suffer
957             sugar summon surrender swelter sypher tamper tauten tender thicken threaten
958             thunder totter toughen tower transit tucker unburden uncover unfetter unloosen
959             upholster utter visit vomit wander water weaken whiten winter wonder worsen
960             );
961             }