|
Linga::EN::VerbTense - Parses verb structures into modal, tense, & infinitive. |
Linga::EN::VerbTense - Parses verb structures into modal, tense, & infinitive.
use Lingua::EN::VerbTense;
my $string = 'I am going home now.'
my ($modality, $tense, $inf) = verb_tense($string);
# Gives:
# $modality='None', $tense='Present Progressive', $inf='go'
$string = 'He really did eat the cookie.';
($modality, $tense, $inf) = verb_tense($string);
# Gives:
# $modality='Affirmative', $tense='Present', $inf='eat'
$string = 'How could she have done that???';
($modality, $tense, $inf) = verb_tense($string);
# Gives:
# $modality='Subjective Ability', $tense='Perfect', $inf='do'
This is a simple Perl module designed to parse english verb structures using a finite state machine into the verb tense and infinitive, as well as the type of infinitive in the structure. This was originally written by Chris Meyer <chris@mytechs.com>. Josiah Byran <jdb@wcoil.com> added multiple tweaks and twists, POD docs, and CPAN packaging.
| Exported by default: | |
| verb_tense |
| Tags: | |
| all => | |
| verb | |
| verb_tense | |
| sFormPartInf | |
| sInfPartForm | |
| sIsModal | |
| sIsInfinitive | |
| sIsThird | |
| sIsPast | |
| sIsGerund | |
| sIsPart | |
| basic => | |
| verb | |
| verb_tense | |
| tests => | |
| sFormPartInf | |
| sInfPartForm | |
| sIsModal | |
| sIsInfinitive | |
| sIsThird | |
| sIsPast | |
| sIsGerund | |
| sIsPart |
| OK for export: | |
| verb | |
| verb_tense | |
| sFormPartInf | |
| sInfPartForm | |
| sIsModal | |
| sIsInfinitive | |
| sIsThird | |
| sIsPast | |
| sIsGerund | |
| sIsPart |
($modal, $tense, $inf) = verb_tense('How could she do that???');
After that call, the variables will be set to:
$modality='Subjective Ability';
$tense='Perfect';
$inf='do';
| Example: | |
$string = sFormPart(``going'',``Gerund'') |
Returns ``go''.
| Example: | |
| $string = sInfPartForm(``go'',``Gerund''); |
Returns ``going''.
sIsModal($verb) tests if $verb
is a modal. If $verb is a modal, it returns ``Modal'', else it returns ``'' (not undef.)
The same logic follows for the other five functions.
use Lingua::EN::VerbTense;
print ': ';
while (<>) {
chomp;
exit if /^[qQdDeE]$/;
my ($Modality, $Tense, $Inf) = verb_tense($_);
print "modality = $Modality, tense = $Tense, inf = $Inf\n: ";
}
This example allows you to enter a string to parse and it displays the results of the parse. Type 'q' to quit the loop.
Copyright (C) 2000 Chris Meyer chris@mytechs.com 1143 5th Street East Altoona, WI 54720
Edited and enhanced by Josiah Bryan jdb@wcoil.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You may download the latest version of this package at the following URL: http://www.josiah.countystart.com/modules/get.pl?verb_tense:POD
|
Linga::EN::VerbTense - Parses verb structures into modal, tense, & infinitive. |