[DGD] Working with parse_string()
Dread Quixadhal
quixadhal at chartermi.net
Fri Jul 24 00:09:52 CEST 2009
Parsing without a way to clearly delimit parts is always going to be a bit
dicey.
Consider:
"give orange candy man"
That could yield "give" "orange" "candy man", which might be perfectly
valid. You may want to give an orange to the candy man.
It could also yield "give" "orange candy" "man", which might also be
perfectly valid. You may have a piece of orange candy to give to the man.
How can the parser know which is the correct one, at the level the parser is
working at? Placed into context, you might notice that you have an orange
in your inventory but no candy, but the parser itself doesn't know this.
If I remember correctly, parse_string() can return all matches as an
array(?) If so, you could then walk each result to see if it's an actual
functional match for the context in which it's being applied.
More information about the DGD
mailing list