> I have written a parser with the help Lex/Bison style tools. Thing is, my
> parser is a bit limited and I'm writing to you all to see if you have
> suggestions on the best approach to solve this problem. (My compiler
> skills
> are a bit rust so the solution may be plain obvious :))
I wrote something like AIML (google it) that would take:
'look-verb %1 <- look %1 (90%)
'left-dir <- left (90%)
'right-dir <- right (90%)
'left-verb <- left (80%)
I associate probabilities with these rules.
When it parses, there are several possible good partses
"look left" = 'look-verb 'left-dir (90% x 90% = 81%)
"look left" = 'look-verb 'left-verb (90% x 80% = 72%)
I then send this to another layer which verifies whether the sentnece makes
sense, and returns a probability score.
'look-verb 'left-dir makes sense and returns 100%
'look-verb 'left-verb doesn't make sense, so returns 10%
I multiply the probability scores together to determine which meaning of the
sentence is used.
You can play with it in my game, or using my game engine,.