earley-parser

Using integers/dates as terminals in NLTK parser

依然范特西╮ 提交于 2019-12-21 12:59:18
问题 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

Earley cannot handle epsilon-states already contained in chart

天涯浪子 提交于 2019-12-12 05:33:38
问题 I have implemented the Earley parser using a queue to process states. The queue is seeded with the top-level rule. For each state in the queue, one of the operations (prediction, scanning, completion) is performed by adding new states to the queue. Duplicate states are not added. The problem I am having is best described with the following grammar: When parsing A , the following happens: As you can tell, A will not be fully resolved . This is because the completion with the epsilon state will

Using integers/dates as terminals in NLTK parser

我只是一个虾纸丫 提交于 2019-12-04 05:52:32
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. For this to work, you'll need to tokenize the date so that each digit and slash is a separate token. from nltk.parse