def to_ot_judgment_diffed(self, old, todat): olds = Otraw new = test_old() if old.url: if "openlaw" in old.url: self.point.set_tablename(Open) self.point.set_filter(filter="id = %s" % old.parent_id, limit=1) else: self.point.set_tablename(olds) self.point.set_filter(filter="id = %s" % old.parent_id, limit=1) else: self.point.set_tablename(olds) self.point.set_filter(filter="id = %s" % old.parent_id, limit=1) old_data = self.point.query() if not old_data: return old_data = old_data[0] new.url = old_data.url analy = JudgmentProcesser() analy.fuzzy_analyse(new, old_data.content_all) insert_base(new, old.id) print __output__.getvalue() return
def to_test_old(self, old, todat): olds = Otraw new = test_old() new.title = old.title new.case_number = old.sn new.department = old.court new.case_type = old.title analy = JudgmentProcesser() analy.fuzzy_analyse(new, old.content) point = insert_base(new) return
def web_port(case_number="", title="", depart="", datasource=None): """WEB API POST POST: http://192.168.1.118/api/v1.0/judgment/ case_number => case_number, title => title, depart => department, datasource => content Returns: JSON( { "result": { "People": { "Plain": "", "defen": "" }, "danger": "", "error": "Success", "sign": "", "status": 1 } }) """ if datasource: new = test_old() analy = JudgmentProcesser() analy.fuzzy_analyse(new, datasource) try: new.clients_attr[u"原告"] = list(set(new.clients_attr[u"原告"])) new.clients_attr[u"被告"] = list(set(new.clients_attr[u"被告"])) new.lawyers_attr[u"原告"] = list(set(new.lawyers_attr[u"原告"])) new.lawyers_attr[u"被告"] = list(set(new.lawyers_attr[u"被告"])) plaintiff = ";".join(u"%s:%s:%s" % client for client in new.clients_attr[u"原告"]) defendant = ";".join(u"%s:%s:%s" % client for client in new.clients_attr[u"被告"]) plaintiff_lawyers = ";".join(u"%s:%s" % lawyer for lawyer in new.lawyers_attr[u"原告"]) defendant_lawyers = ";".join(u"%s:%s" % lawyer for lawyer in new.lawyers_attr[u"被告"]) except: return {"error": datasource} point = insert_database("Sqlextend", tablename=test_old, editor=new) # 设置添加数据 try: point.insert() # 添加数据 except Exception, e: return {"error": e} print plaintiff print defendant print plaintiff_lawyers print defendant_lawyers return { "People": {u"原告": plaintiff, u"被告": defendant}, "lawyers": {u"原告": plaintiff_lawyers, u"被告": defendant_lawyers}, "case_number": new.case_number, "title": new.title, "sign": new.case_sign, "type": new.case_type, "error": 0, }