diff --git a/src/data_helpers.py b/src/data_helpers.py index e240acbdf79df9cbfb3188cce9a3e0a2ae8efe04..ddd9c7ae7598dcf3ccadf71c2a26e5d39cfd4c01 100644 --- a/src/data_helpers.py +++ b/src/data_helpers.py @@ -168,20 +168,16 @@ class HasDescriptionNode(dict): class HasCategoryNode(dict): - def __init__(self,elm,cat,subcat=False,dummy=False,text=False): + def __init__(self,elm,cat,subcat=False,dummy=False): self.d = {} if dummy: self.d["category"] ="DUMMYCAT" if subcat: self.d["subcategory"] ="DUMMYSUBCAT" - if text: - self.d["text"] = "DUMMYTEXT" else: self.d["category"] = maybe_first_value(elm.findAll("interp",{"type":cat+"Category"})) if subcat: self.d["subcategory"] = maybe_first_value(elm.findAll("interp",{"type":subcat+"Subcategory"})) - if text: - self.d["text"] = get_text(elm) dict.__init__(self, self.d) def __eq__(self, other): diff --git a/src/graph_builder.py b/src/graph_builder.py index 91ca253b88c896cebd1b5a23f45f1d99e32caad3..62678aa9f480cb22cd0ba7728cfc55880b5c4d5e 100644 --- a/src/graph_builder.py +++ b/src/graph_builder.py @@ -10,7 +10,6 @@ import graph_helpers as gh import logging subcat=False -text=False def build_graph(years=[],include_utterances=False): @@ -52,7 +51,7 @@ def build_graph(years=[],include_utterances=False): descriptions = [dh.HasDescriptionNode(of) for of in offs] logging.info("descriptions found: {}".format(descriptions)) #[desc.simplify_to_direct_object() for desc in descriptions] - offs = [dh.OffenceNode(of,"offence",subcat=subcat,dummy=False,text=text) for of in offs] + offs = [dh.OffenceNode(of,"offence",subcat=subcat,dummy=False) for of in offs] #print(descriptions) #asd for i,off in enumerate(offs): @@ -70,7 +69,7 @@ def build_graph(years=[],include_utterances=False): #similar to offences vs = div.findAll("rs",{"type":"verdictDescription"}) - vs = [dh.VerdictNode(v,"verdict",subcat=subcat,dummy=False,text=text) for v in vs] + vs = [dh.VerdictNode(v,"verdict",subcat=subcat,dummy=False) for v in vs] if not vs: logging.warning("warning no verdict found inserting dummy") vn=dh.VerdictNode({},"",subcat=subcat,dummy=True,text=False) @@ -86,7 +85,7 @@ def build_graph(years=[],include_utterances=False): # similar to offences puns = div.findAll("rs",{"type":"punishmentDescription"}) - puns = [dh.PunishmentNode(pun,"punishment",subcat=subcat,dummy=False,text=text) for pun in puns] + puns = [dh.PunishmentNode(pun,"punishment",subcat=subcat,dummy=False) for pun in puns] for pun in puns: nodeindex,punindex = gh.maybe_new_index(pun,node_index_dict)