Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 Changes
Octocat-spinner-32 README.mkdn
Octocat-spinner-32 dist.ini
README.mkdn

NAME

Linga::EN::VerbTense - Parses verb structures into modal, tense, & infinitive.

SYNOPSIS

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'

DESCRIPTION

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.

EXPORTS

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

FUNCTIONS

  • verb_tense($string);

Parses a string and returns a three element list containg info about the first verb in the string. Example:

($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';
  • verb($infinitive,$third,$past,$part,$gerund);

This allows addition of your own custom verbs to the verb hash internally.

  • sFormPartInf($verb,$type);

Tanslates the verb $verb which is of type $type into the infitive for that verb. $type must be one of the following: Gerund Infinitive Third Past

Example: $string = sFormPart("going","Gerund")

Returns "go".

  • sInfPartForm($verb,$type);

Translates infinitive $verb to type $type. $type must be one of the following: Gerund Infinitive Third Past

Example: $string = sInfPartForm("go","Gerund");

Returns "going".

  • sIsModal($verb);
  • sIsInfinitive($verb);
  • sIsThird($verb);
  • sIsPast($verb);
  • sIsGerund($verb);
  • sIsPart($verb);

Each of these functions tests for its namesake. E.g. 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.

EXAMPLE

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.

AUTHOR

Copyright (C) 2000 Chris Meyer chris@mytechs.com 1143 5th Street East Altoona, WI 54720

Edited and enhanced by Josiah Bryan jbryan@cpan.org>

Repackaged by John Napiorkowski jjnapiork@cpan.org

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.

Something went wrong with that request. Please try again.