Table of Contents

Class: Parser pubcore.py

Parser: breaks a string into a command or set of commands

Parser
breaks a string into a command or set of commands

Methods   
BreakString
FindPrep
MunchNouns
NounWords
Parse
ParseCore
WordEnd
__init__
  BreakString 
BreakString ( self,  pStr )

break the string into a list of words - filter garbage and reduce non-quoted stuff to lower case - convert commas to conjunctions

  FindPrep 
FindPrep ( self,  words )

print "Looking for prep in", words return the position of the first preposition in words, not looking past the first verb. Return -1 if no preposition is found

  MunchNouns 
MunchNouns ( self,  w )

starting at w, munch a set of nouns joined by conjunctions return the set, and remove them from self.words

  NounWords 
NounWords ( self,  words )

given a set of words, see how many words you can lump together as a single noun from the beginning of the string. Thus, given: "give bucket of fish to bob" we return: 0 "bucket of fish to bob" ==> 3 "bucket to bob" ==> 1

  Parse 
Parse ( self,  pStr='' )

Ok so let's start parsing first we send a pStr through the ParseCore which does most of the real work.

Eventually returns a list of quantal commands.

  ParseCore 
ParseCore ( self,  pStr )

Does all the namecalling, cleaning up and findind our verbs, prepositions and so on.

  WordEnd 
WordEnd (
        self,
        pStr,
        pStart,
        )

return the position of the end of the word, given that it starts at pStart in string pStr

  __init__ 
__init__ ( self )


Table of Contents

This document was automatically generated on Mon Aug 8 17:04:06 2005 by HappyDoc version 2.1