Skip to content
Snippets Groups Projects
Commit ae0b6cd7 authored by opitz's avatar opitz
Browse files

removed redundant text description field in hascategorynode (text descriptions...

removed redundant text description field in hascategorynode (text descriptions can be inserted as nodes now)
parent 144b92e4
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment