def app():
    grammar = CFG.fromstring("""
    # Grammatical productions.
        S -> NP VP
        VP -> VP PP | V NP | V
        NP -> Det N | NP PP
        PP -> P NP
    # Lexical productions.
        NP -> 'John' | 'I'
        Det -> 'the' | 'my' | 'a'
        N -> 'dog' | 'cookie' | 'table' | 'cake' | 'fork'
        V -> 'ate' | 'saw'
        P -> 'on' | 'under' | 'with'
    """)

    sent = 'John ate the cake on the table with a fork'
    sent = 'John ate the cake on the table'
    tokens = list(sent.split())

    print('grammar= (')
    for rule in grammar.productions():
        print(('    ', repr(rule)+','))
    print(')')
    print(('tokens = %r' % tokens))
    print('Calling "ChartParserApp(grammar, tokens)"...')
    ChartParserApp(grammar, tokens).mainloop()
dataset/ETHPy150Open nltk/nltk/nltk/app/chartparser_app.py/app/original