Using integers/dates as terminals in NLTK parser
问题 I'm trying to use the Earley parser in NLTK to parse sentences such as: If date is before 12/21/2010 then serial = 10 To do this, I'm trying to write a CFG but the problem is I would need to have a general format of dates and integers as terminals, instead of the specific values. Is there any ways to specify the right hand side of a production rule as a regular expression, which would allow this kind of processing? Something like: S -> '[0-9]+' which would handle all integers. 回答1: For this