From d1dea2e22ec3c501f534aeba34bf2e11efc40631 Mon Sep 17 00:00:00 2001 From: voje Date: Mon, 11 Mar 2019 09:26:49 +0100 Subject: [PATCH] fixed the weird bug (defined a list instead of dict... should have gone to sleep yesterday) --- .gitignore | 2 +- data/kres_srl_ikt | 1 + src/pkg/corpusparser/corpusparser/Parser.py | 17 ++++++++--------- .../__pycache__/Parser.cpython-35.pyc | Bin 5389 -> 0 bytes .../__pycache__/Sentence.cpython-35.pyc | Bin 448 -> 0 bytes .../__pycache__/__init__.cpython-35.pyc | Bin 249 -> 0 bytes 6 files changed, 10 insertions(+), 10 deletions(-) create mode 120000 data/kres_srl_ikt delete mode 100644 src/pkg/corpusparser/corpusparser/__pycache__/Parser.cpython-35.pyc delete mode 100644 src/pkg/corpusparser/corpusparser/__pycache__/Sentence.cpython-35.pyc delete mode 100644 src/pkg/corpusparser/corpusparser/__pycache__/__init__.cpython-35.pyc diff --git a/.gitignore b/.gitignore index c57e05a..43fb148 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ data/samples/ -*/__pycache__/ *egg-info/ +*.pyc diff --git a/data/kres_srl_ikt b/data/kres_srl_ikt new file mode 120000 index 0000000..465d987 --- /dev/null +++ b/data/kres_srl_ikt @@ -0,0 +1 @@ +/home/voje/work_data/final_json \ No newline at end of file diff --git a/src/pkg/corpusparser/corpusparser/Parser.py b/src/pkg/corpusparser/corpusparser/Parser.py index fb8b408..1c5dd6b 100644 --- a/src/pkg/corpusparser/corpusparser/Parser.py +++ b/src/pkg/corpusparser/corpusparser/Parser.py @@ -75,9 +75,9 @@ class Parser(): if len(sent_srl_links) == 0: print("HI") return [] - print(sent_srl_dict) + print(sent_srl_links) # find the correspointing json file with srl links - return [] + return sent_srl_links def parse(self): if self.corpus == "kres": @@ -112,7 +112,7 @@ class Parser(): else: divs = root.findall(".//div") - res_dict = [] # TODO: try making an iterator instead + res_dict = {} # parse divs for div in divs: @@ -150,7 +150,7 @@ class Parser(): sentence_text += el.text sentence_tokens += [{ "word": False, - "tid": el_id, + "tid": int(el_id), "text": el.text, }] elif el.tag in self.S_TAGS: @@ -166,16 +166,15 @@ class Parser(): raise KeyError("duplicated id: {}".format(sentence_id)) jos_links = self.parse_jos_links(s) srl_links = srl_dict.get(sentence_id) if self.corpus == "kres" else None - srl_links_fixed = self.parse_srl_links(s, srl_links) - print(srl_links) + srl_links_parsed = self.parse_srl_links(s, srl_links) res_dict[sentence_id] = { "sid": sentence_id, "text": sentence_text, "tokens": sentence_tokens, - "jos_links": "BBBB", - "srl_links": "AAAAA", + "jos_links": jos_links, + "srl_links": srl_links_parsed } - + print("------------------------------------------------- END") print(res_dict[sentence_id]) print("------------------------------------------------- END") return # TODO dev break diff --git a/src/pkg/corpusparser/corpusparser/__pycache__/Parser.cpython-35.pyc b/src/pkg/corpusparser/corpusparser/__pycache__/Parser.cpython-35.pyc deleted file mode 100644 index e438b679e512adfece77441901df5aaacf36d388..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5389 zcmb7IOOqSb6+XAS)q0F%&D%46VA&WCGO>mt5RBuvFg6epG9ie{Pz_E;R<{OeS}o1( z7RX|>!6C4tvPfl-tg=fLe;~Uovdk~&ZC3mRZ<6nvmNX;9EYdT5bsy*4d*0{V-Yk_0 zU;g#WkE8QM|E5!qiT>+&BNvT_e?7 zHg&V)WJ$g4Va}%C0o|s@201zMOsZG2-{BCdsw7wU!`Kg-KKj;sjrfy2bTWRdeZR>d z)5k#Pb-d9r8lRXb(Bv3QCMd%JAPZZ2mh?f@^kAkcOI}XqZSwNu6{L^JCGv{W2U#WZ z&PX2sW%8D#Um$OVyjAG~cnzelC-!>{9r?P+661$|`MrlX`V*RC(4^?lApHu(7=lWJ zwjV13@vfRqnX@T_!kQpig0w${I6*QgEK)37VVf_oQ@WWjd64$OTb3q$VHm6)7;+}q zBamL$ORPifM_Pf%@3?WyDC&%^-_-|$E)-E|_H=&`RiaONgTSji^ea19->LL;Wrq=W zYKi(RQO!iv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-$J!Y8QoU_=nv5>`PU~}xT zZUv7ujYxnH08>_T2@JemmoUOABpf~guWdvq zsbEixb08rO<$x5`P!uBDHi`gd#^e$iF%Gj_EeLPtxd1`kf$CV|**6zB=*3y;SPJ4C0=@Lay*So)H%b$4z3!q2@V_QBqU=8@G`3_SJg4*v6`o_Oz3x(`KH3~sP7@5 z0uBFV9Ot3%e;Q+iUyy=3OIaX_H2l`!8Q?7Q%>4&{HpU3CgKic1&AqIHAExO$PKY+hfH4L4Bwp|{GHG7lgd6mK#vc=XW00UP90D*y7c2dkVbGLzc=p!KxycWzt%6m5%?rdzJN>^K-g!#-IFao2l(naj zet}769;ZZ4^X9@?TXGgo2R9|*9i-rY-@8a1kY1!?7!-62`@)9!F9-(m$T{+!5tt3; z2mgG3gf`BzQZXFk=+hSWm5CA&`oShxO{=6aLgquJUl5XRxpr z`frVLpO0(uKU(nyxCk^GvF}yd-mS{#V_d7-o@2+oLqEiAV0N){tT*r^`B{W_GI#kI zy>jFKeJXG6-PaW+>M2e2ne<|5g^jK+Rfp!BBe!*D>9cnHi5m@Ct@bdndVO4OERkv^ z=rz13v9#at65I2eJ19sl=}^?>7=GYn{D481W@|8wH<)5hQBHZLN6+McS&m zV5}NzMp>O#8^)G_c~vyZhHaKq*#rc?fVRywhE>b>E1|%%aY@Vr_OiML{0)4$NM~() zy;wC$rlmH_qS^q&RW2>CZ~C`vo}5IYLjPGOJ0bki6xQb{A8Y>s-;9I>h^ zgLo31&+nHv%ZS;rR8?(0LAlL6{G7#7HBX{2u~tPapC99*QL@!CS6Zm;q?bOGuQu%E z-9_2~u+9F^(N`092V$MC1)`lGuA8!5xp<2B(&nqKqQ?C~f2*mH`(sX++>e+tpC?iG T{_FJzIf4x@x)GP2ML+NhUEyBP diff --git a/src/pkg/corpusparser/corpusparser/__pycache__/__init__.cpython-35.pyc b/src/pkg/corpusparser/corpusparser/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index a365c8e295dbed9a0472980368c09666df7d3ef2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 249 zcmWgR<>jikZ;c6LU|@I*#Bjg_WH|tFu?mn#0U}0*90rD5MusRx21XE{i6MuHA(xpU ziW$gfW(d|~c?nd>pvicPEg-R|IJF4K;s{R7D@n~uPW97di4soEFDfW4E&xmFLDUq1 ztcemuk%8$cVg|~sWGG?*QefhjnSMc0epYI7iGFcWvVK8!x<0Z-R8D++W?p7Ve7s&k X