Created
February 17, 2016 13:52
-
-
Save eirenik0/a700d935beb3b5533d3e to your computer and use it in GitHub Desktop.
Example of using Template Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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