refactored TypedSentence code to use inheritance, integrated related js code into angularjs