K
Klaus Neuner
Hello,
I want to write a class Recognizer, like so:
class Recognizer(object):
def is_of_category_1(self, token):
if token == 1:
return "1"
else:
return False
def is_of_category_2(self, token):
if token == 2:
return "2"
else:
return False
def recognize(self, token):
for fun in <?>:
result = apply(fun, token)
if result:
return result
return False
What do I have to write instead of <?>?
Or: How should I design the recognizer, if the above design is not good?
Klaus
I want to write a class Recognizer, like so:
class Recognizer(object):
def is_of_category_1(self, token):
if token == 1:
return "1"
else:
return False
def is_of_category_2(self, token):
if token == 2:
return "2"
else:
return False
def recognize(self, token):
for fun in <?>:
result = apply(fun, token)
if result:
return result
return False
What do I have to write instead of <?>?
Or: How should I design the recognizer, if the above design is not good?
Klaus