forked from kristjan/cjvt-valency
frontend: pick corpus
This commit is contained in:
@@ -386,7 +386,8 @@ def prepare_db():
|
||||
# update entries (add headwords and fuctors for indexing)
|
||||
for corpus in ["ssj", "kres"]:
|
||||
for e in valdb[corpus].find({}):
|
||||
#! hw_tids are not array ids
|
||||
if e["srl_links"] is None:
|
||||
continue
|
||||
hw_tids = list(set([x["from"] for x in e["srl_links"]]))
|
||||
hw_tokens = [helper_tid_to_token(tid, e["tokens"]) for tid in hw_tids]
|
||||
headwords = [(t["lemma"] if t["msd"][0] == "G" else t["lemma"] + "_") for t in hw_tokens]
|
||||
@@ -403,11 +404,15 @@ def prepare_db():
|
||||
res_hws = {}
|
||||
res_fns = {}
|
||||
for e in valdb[corpus].find({}):
|
||||
if "headwords" not in e:
|
||||
continue
|
||||
for hw in e["headwords"]:
|
||||
if hw in res_hws:
|
||||
res_hws[hw] += 1
|
||||
else:
|
||||
res_hws[hw] = 1
|
||||
if "functors" not in e:
|
||||
continue
|
||||
for fn in e["functors"]:
|
||||
if fn in res_fns:
|
||||
res_fns[fn] += 1
|
||||
|
||||
Reference in New Issue
Block a user