Given I have a CFG like this:
cfg = nltk.CFG.fromstring("""
root -> who_player has the most runs
who_player -> who
who_player -> which player
who_player -> which team player
who -> 'who'
which -> 'which'
player -> 'player'
team -> 'indian' | 'australian' | 'england'
has -> 'has'
this -> 'this'
most -> 'most'
runs -> 'runs'
""")
Now, cfg.productions() provides a data structure with lhs, rhs etc.,
How do I get the list of possible generations for "who_player" node. Following is the expected result:
(list) ['who', 'which player', 'which indian player', 'which australian player', 'which england player']