Hi Cody,

The kind of sentences you're trying to match are highly ambiguous. 
Suppose you want to schedule dinner with Monday Doe, named after the day 
she was born? You will have to exclude all week-days from all names in 
order to even match names - and then clashes like this one are 
programmed to happen.

If you look at the history of parsing, other formalisms than PEG have 
been developed for this kind of sentences. They use probabilistic and 
heuristic 'interpretation'-type approaches. [1] gives a good overview 
and many of these algorithms have been implemented in Ruby.

Parslet implements PEG very slavishly, it doesn't even do whitespace 
ignore or left recursion. This is going to stay that way. PEG is very 
good (IMHO) for computer languages. It avoids many ambiguities by posing 
a formalism that doesn't allow them, which appeals to me because it is 
elegant.

So that means: Parsing natural language with parslet will make you 
unhappy, folks! Cody, the common strategy for parsing things like this 
is to use a bottom up parser, LR(k) or the like. There are very elegant 
natural language frameworks out there as well. And last (but .. not 
least) there is chronic[2], which does part of what you want...

regards,
kaspar

[1] http://en.wikipedia.org/wiki/Parser
[2] http://rubygems.org/gems/chronic
[3] http://duckduckgo.com/?q=natural+language+ruby


Reply via email to