def getDictionary(self): for item in self.dict["violations"]: if "sentiment" in item: item["stars"] /= float(item["count"]) item["sentiment"] /= item["count"] item.pop("count") if "count*" in item: item["*"] /= item["count*"] if item["count*"] > 0 else 1 item["**"] /= item["count**"] if item["count**"] > 0 else 1 item["***"] /= item["count***"] if item["count***"] > 0 else 1 item.pop("count*") item.pop("count**") item.pop("count***") self.dict["checklist"] = [] if len(self.negativeCorpus) > 0: self.dict["checklist"] = tm.getTopics(self.negativeCorpus) return self.dict