grammar = {
'S': [['NP', 'VP'], ['NP', 'VP', 'PP']],
'NP': [['d', 'NP3']],
'NP3': [['a', 'NP3'], ['n'], ['n', 'PP']],
'PP': [['p', 'NP2']],
'NP2': [['d', 'NP3']],
'VP': [['v']],
'd': ["the", "a", "an", "this", "that", "these", "those", "my", "your", "his",
"her", "its", "our", "their", "a few", "a little", "much", "many", "a lot of",
"most", "some", "any", "enough",
"all", "both", "half", "either", "neither", "each", "every",
"other", "another", "such", "what", "rather", "quite"],
'n': nouns,
'v': verbs,
'aux': ['do', 'does', 'did', 'had', 'have', 'has'],
'p': preps,
'a': adjs
}