1 # This Python file uses the following encoding: utf-8
3 Created on May 30, 2011
7 from abc
import abstractmethod
, ABCMeta
9 class Strategy(tuple, metaclass
=ABCMeta
):
10 """represents a ChartParser strategy"""
12 def __new__(cls
, edge_class
, *rules
):
13 return tuple.__new
__(cls
, rules
)
15 def __init__(self
, edge_class
, *rules
):
16 super(Strategy
, self
).__init
__(rules
)
17 self
.__edge
_class
= edge_class
20 return self
.__edge
_class
23 def goal_edges(self
, chart
, symbol
): pass
25 def goal_found(self
, chart
, symbol
):
27 next(self
.goal_edges(chart
, symbol
))