[DGD] grammar voodoo questions

Par Winzell zell at skotos.net
Wed Sep 20 21:30:57 CEST 2006


Shentino wrote:
> Was having an internal debate about whether or not to hard-code
> vocabulary into the parser.  As in nouns vs adjectives vs adverbs vs
> articles.
> 
> Phantasmal "recompiles" the parser everytime a new word is added or
> removed, and I'm not sure I want to do that.

My advice would be to not include either nouns nor verbs in your grammar. It's 
really annoying to get a 'nil' return value because the user misspelled the 
19th letter in a noun. Where do you go from there? "I don't understand that." 
is a bit 1990...

If I could do it all over again I would -require- the use of prepositions for 
indirect verbs. "smile at the dog" -- it's obvious what's the verb and what's 
the noun and you don't need to look up either until parse_string() is done. In 
the direct case, if the user types "hug the dog", you can pretty much assume 
it's verb + noun phrase.

The Skotos parser uses prepositions as the general delimiter of English 
phrases (although it tries to be backwards compatible with the traditition -- 
obsolete, in my opinion -- that you should be able to type 'wave girl' to mean 
'wave at the girl' rather than grabbing the girl and waving her around).

So:

  Sentence: Verb
  Sentence: Verb NounPhrase
  Sentence: Verb Preposition NounPhrase

Done!



More information about the DGD mailing list