Commit a7170bca by Steven Bird

fixed stale pretty print method, resolves #886

parent 11f7dfd9
...@@ -212,7 +212,7 @@ class BottomUpProbabilisticChartParser(ParserI): ...@@ -212,7 +212,7 @@ class BottomUpProbabilisticChartParser(ParserI):
# Initialize the chart. # Initialize the chart.
for edge in bu_init.apply(chart, grammar): for edge in bu_init.apply(chart, grammar):
if self._trace > 1: if self._trace > 1:
print(' %-50s [%s]' % (chart.pp_edge(edge,width=2), print(' %-50s [%s]' % (chart.pretty_format_edge(edge,width=2),
edge.prob())) edge.prob()))
queue.append(edge) queue.append(edge)
...@@ -227,7 +227,7 @@ class BottomUpProbabilisticChartParser(ParserI): ...@@ -227,7 +227,7 @@ class BottomUpProbabilisticChartParser(ParserI):
# Get the best edge. # Get the best edge.
edge = queue.pop() edge = queue.pop()
if self._trace > 0: if self._trace > 0:
print(' %-50s [%s]' % (chart.pp_edge(edge,width=2), print(' %-50s [%s]' % (chart.pretty_format_edge(edge,width=2),
edge.prob())) edge.prob()))
# Apply BU & FR to it. # Apply BU & FR to it.
...@@ -294,7 +294,7 @@ class BottomUpProbabilisticChartParser(ParserI): ...@@ -294,7 +294,7 @@ class BottomUpProbabilisticChartParser(ParserI):
split = len(queue)-self.beam_size split = len(queue)-self.beam_size
if self._trace > 2: if self._trace > 2:
for edge in queue[:split]: for edge in queue[:split]:
print(' %-50s [DISCARDED]' % chart.pp_edge(edge,2)) print(' %-50s [DISCARDED]' % chart.pretty_format_edge(edge,2))
del queue[:split] del queue[:split]
class InsideChartParser(BottomUpProbabilisticChartParser): class InsideChartParser(BottomUpProbabilisticChartParser):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment