Harvey::Verb - Harvey module for parsing verbs. use Harvey::Verb; The is still very much a development module. See the website: www.mytechs.com for more details on the project. Verb.pm builds on top of Word.pm, which provides the Word objects which are used by Verb.pm. See Word.pm for information on using Word.pm to obtain information about Word objects. Verb objects are created by passing an array of Word objects (A) which constitute a sentence, as an argument to the Verb object constructor. $V = Verb->new(\@A); The Verb object parses the verb in the sentence upon initialization to the best apparent parsing. The Verb object can then be queried for information about the verb object using the following methods. See the Harvey module for a simple dialog routine that uses the Verb module to parse sentences and pull the verb information from them. The following methods constitute the interface to this object: new Constructor. Send in an array reference to a block of word objects (Word.pm) to have the verb information parsed and made available. If no argument is passed in, then a blank verb is set up which can be manually stuffed with information. words Method to load or retrieve word arrays from the object. If a word array is loaded manually after the initialization of the object, then the parsing must be performed by a call to parse() or best(). used Returns an integer with bits set indicating which words in the array are used in the verb complex. This will be used to match verbs against nouns in a sentence when the noun module comes out. best Calculates the best parsing of the sentence based on how many word are involved in the parsing and whether they are started off by the most common verb starters. complete_tense Returns a string rendition of the tense of the verb in the word array. show_adverbs Returns the adverbs in the verb complex as strings for show. tenses Returns the Int which stores the tenses, and/or, sets the tenses if an Int is sent in. Used mainly to set up modal verb objects from scratch. present Get/Set present tense. Input of 1 or 0 sets or clears the present tense. All calls return the final status of the present tense flag. past Get/set past tense as above. perfect Get/set perfect tense as above. progressive Get/set progressive tense as above. infinitive Get/set infinitive flag as above. persons Get/set the persons information. The persons information is stored in an integer with a flag for the 1st pers sing, 2nd sing. 3rd sing, etc. Send in an integer to set it. The current values is alwasys returned. Verbs, Noun object (when they come out) both indicate what possible persons they would support. This allows for convient checking of subject verb agreement. verb Gets/set the infinitive of the main verb as a string adverbs Get/sets the array of adverbs found in the sentence. Arguments are passed in and out as a reference to an array. sentence_type Get/sets the sentence type. Arg in and out is an integer. 0 = statement, 1 = question, 2 = command. statement Get/set whether the sentence is a statement. question Get/set whether the sentence is a question. command Get/set whether the sentence is a command. best Finds the best parsing based on the number of words (more is better) in the verb structure and obviousness of the leadoff verb. parse Performs the parsing of the object. Takes three possible integer arguments (0|1|2). 0: always start parsing on exact matches to helping verbs or modals; 1: always start parsing on verbs the are most frequently used as verbs; 2: allow any potential verb to start the parsing. 0 is default

EXPORT
None by default. Chris Meyer<lt>chris@mytechs.com<gt> Copywrite (c) 2002, Chris Meyer. All rights reserved. This is free software and can be used under the same terms as Perl itself. 1.02 My heartfelt thanks to Adam Kilgarriff for his work on the BNC (British National Corpus) which forms the basis for the word.db. I have added and massaged it a bit, but I would never have gotten this far without it. The BNC can be visited at http://www.itri.brighton.ac.uc/~Adam.Kilgarriff/bnc-readme.html. Harvey uses algorithms AND data to work. The program looks for a file called 'system.dat' in the startup directory. In this file it looks for a line that reads 'path=your_path', where your_path is the directory where the data resides. The accompanying Harvey module comes with a simple dialog routine that uses Verb.pm to demonstrate the parsing of sentence. the perl manpage.