class SentimentHandler: def __init__(self): self.log = {} self.S = SentiHandle() def ping(self): print ("Ping Success !! :D") return def getSentimentScore(self,obj): ''' Arguments List: general -> mainText,textType = "general" microblogs -> mainText, textType = "microblogs" comments -> mainText, textType = "comments" reviews -> mainText, textType = "reviews", title = "" <optional>,topDomain,subDomain = "" <depends, not always optional, refer the list in config.py> blogs_news -> mainText< or first paragraph>, title, textType="blogs_news",lastPara = "" <optional last paragraph>,middleParas = [] <optional middle paragraphs(separate each para with newline into string)> ''' try: S = self.S.getSentimentScore(obj.mainText,obj.textType,obj.title,obj.middleParas,obj.lastPara,obj.topDomain,obj.subDomain) print ("The Text : " + obj.mainText + " ||| SentimentScore[-5 to 5]: " + str(S)) return S except Exception as err: print(traceback.format_exc()) print(sys.exc_info()[0])
def __init__(self): self.log = {} self.S = SentiHandle()