Skip to content

Instantly share code, notes, and snippets.

@eirenik0
Created February 17, 2016 13:52
Show Gist options
  • Save eirenik0/a700d935beb3b5533d3e to your computer and use it in GitHub Desktop.
Save eirenik0/a700d935beb3b5533d3e to your computer and use it in GitHub Desktop.
Example of using Template Class
class BaseEngine(object):
def __init__(self, word):
self.word = word
def parse(self):
'''
parse word with specefic engine
'''
raise NotImplemented
def parse_normal(self):
'''
parse word in normal form
'''
raise NotImplemented
def normal_form(self):
'''
generate normal word form
'''
raise NotImplemented
def lexeme(self):
'''
return lexemes of word
'''
raise NotImplemented
def process(self):
self.parse()
self.normal_form()
self.parse_normal()
self.lexeme()
if self.lexemes:
return self.lexemes
else:
raise Exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment