gojippo has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; while (<>){ chomp; s/\r//g; my($verb,$group) = split /\t/; # I take the $verb name and inflect +ion group number if ($group == 1){ #if its first group,... my ($present_1,$present_2,$present_3,$present_4,$present_5) = +$verb; my ($imparfait_1,$imparfait_2,$imparfait_3,$imparfait_4,$imparfait +_5) = $verb; my ($past_1,$past_2,$past_3,$past_4,$past_5,$past_6) = $verb; my ($futur_1,$futur_2,$futur_3,$futur_4,$futur_5,$futur_6) = $verb +; my ($conditional_1,$conditional_2,$conditional_3,$conditional_4,$c +onditional_5) = $verb; my ($subj_imp_1,$subj_imp_2,$subj_imp_3,$subj_imp_4,$subj_imp_5,$s +ubj_imp_6) = $verb; my $pp_ger = $verb; # give them all the $verb value, then... $present_1 =~ s/er$/e/g; $present_2 =~ s/er$/es/g; $present_3 =~ s/er$/ons/g; $present_4 =~ s/er$/ez/g; $present_5 =~ s/er$/ent/g; $imparfait_1 =~ s/er$/ais/g; $imparfait_2 =~ s/er$/ait/g; $imparfait_3 =~ s/er$/ions/g; $imparfait_4 =~ s/er$/iez/g; $imparfait_5 =~ s/er$/aient/g; $past_1 =~ s/er$/ai/g; $past_2 =~ s/er$/as/g; $past_3 =~ s/er$/a/g; $past_4 =~ s/er$/但mes/g; $past_5 =~ s/er$/但tes/g; $past_6 =~ s/er$/竪rent/g; $futur_1 =~ s/er$/erai/g; $futur_2 =~ s/er$/eras/g; $futur_3 =~ s/er$/era/g; $futur_4 =~ s/er$/erons/g; $futur_5 =~ s/er$/erez/g; $futur_6 =~ s/er$/eront/g; $conditional_1 =~ s/er$/erais/g; $conditional_2 =~ s/er$/erait/g; $conditional_3 =~ s/er$/erions/g; $conditional_4 =~ s/er$/eriez/g; $conditional_5 =~ s/er$/eraient/g; $subj_imp_1 =~ s/er$/asse/g; $subj_imp_2 =~ s/er$/asses/g; $subj_imp_3 =~ s/er$/但t/g; $subj_imp_4 =~ s/er$/assions/g; $subj_imp_5 =~ s/er$/assiez/g; $subj_imp_6 =~ s/er$/assent/g; $pp_ger =~ s/er$/ant/g; #change them all to their respective forms print "$verb\t$present_1\t$present_2\t$present_1\t$present_3\t$pre +sent_4\t$present_5\t$imparfait_1\t$imparfait_1\t$imparfait_2\t$imparf +ait_3\t$imparfait_4\t$imparfait_5\t$past_1\t$past_2\t$past_3\t$past_4 +\t$past_5\t$past_6\t$futur_1\t$futur_2\t$futur_3\t$futur_4\t$futur_5\ +t$futur_6\t$conditional_1\t$conditional_1\t$conditional_2\t$condition +al_3\t$conditional_4\t$conditional_5\t$present_1\t$present_2\t$presen +t_3\t$imparfait_3\t$imparfait_4\t$present_5\t$subj_imp_1\t$subj_imp_2 +\t$subj_imp_3\t$subj_imp_4\t$subj_imp_5\t$subj_imp_6\t$present_1\t$pr +esent_3\t$present_4\t$verb\t$pp_ger\t$pp_ger\t$group\n"; } #and print out }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Automatic verb inflection script
by samtregar (Abbot) on May 20, 2008 at 03:33 UTC | |
|
Re: Automatic verb inflection script
by pc88mxer (Vicar) on May 20, 2008 at 03:34 UTC | |
by gojippo (Novice) on May 20, 2008 at 03:53 UTC |