Codevalley
Codevalley

Reputation: 4641

Specify repeating tokens in Recursive Descent Parser with NLTK

I am trying to parse a grammar similar to this.

PER -> 'noun' | 'noun1' | 'noun2'

PERS -> PER+

This is not a valid grammar for NLTK's recursive descent parser. How do specifiy one of more repeating tokens in this grammar

Upvotes: 2

Views: 336

Answers (1)

tobigue
tobigue

Reputation: 3617

try a rule like:

PERS -> PER PERS | PER

Upvotes: 1

Related Questions