# Path: pycryptics/grammar/memo_chart.py
# class MemoChart(IncrementalChart):
#     def parses(self, root, tree_class=Tree):
#     def trees(self, edge, tree_class=ClueTree, complete=False):
#     def _trees(self, edge, complete, tree_class):


import nltk.parse as parse
import nltk.grammar as grammar
from pycryptics.grammar.memo_chart import MemoChart, ClueTree

top = grammar.Nonterminal('top')
bar = grammar.Nonterminal('bar')
baz = grammar.Nonterminal('baz')
foo = grammar.Nonterminal('foo')

prods = [grammar.Production(top, [bar]), grammar.Production(top, [baz]), grammar.Production(bar, [foo]), grammar.Production(baz, [foo]), grammar.Production(foo, ['foo'])]

g = grammar.ContextFreeGrammar(top, prods)

parser = parse.EarleyChartParser(g, trace=True, chart_class=MemoChart)

p = parser.nbest_parse(['foo'])
print p
print p[0][0][0]

# Path: pycryptics/grammar/memo_chart.py
# class MemoChart(IncrementalChart):
#     def parses(self, root, tree_class=Tree):
#     def trees(self, edge, tree_class=ClueTree, complete=False):
#     def _trees(self, edge, complete, tree_class):


# Path: test_tree.py
import nltk.parse as parse
import nltk.grammar as grammar
from pycryptics.grammar.memo_chart import MemoChart, ClueTree


top = grammar.Nonterminal('top')
bar = grammar.Nonterminal('bar')
baz = grammar.Nonterminal('baz')
foo = grammar.Nonterminal('foo')

prods = [grammar.Production(top, [bar]), grammar.Production(top, [baz]), grammar.Production(bar, [foo]), grammar.Production(baz, [foo]), grammar.Production(foo, ['foo'])]

g = grammar.ContextFreeGrammar(top, prods)

parser = parse.EarleyChartParser(g, trace=True, chart_class=MemoChart)

p = parser.nbest_parse(['foo'])
print p
print p[0][0][0]

print p[1][0][0]