diff --git a/src/backend_flask/app.py b/src/backend_flask/app.py index 2f6a0c1..fb7dbea 100644 --- a/src/backend_flask/app.py +++ b/src/backend_flask/app.py @@ -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 diff --git a/src/frontend_vue/src/components/Home.vue b/src/frontend_vue/src/components/Home.vue index 6d5c9cd..d69e446 100644 --- a/src/frontend_vue/src/components/Home.vue +++ b/src/frontend_vue/src/components/Home.vue @@ -9,8 +9,9 @@