senses working

This commit is contained in:
2019-04-07 21:43:42 +02:00
parent e4730c40e1
commit 40f6aea2e7
4 changed files with 30 additions and 17 deletions

View File

@@ -244,7 +244,7 @@ def prepare_frames(ret_frames):
# sid, tid==hw
for sid, tid in unique_sids.items():
# hwl = vallex.get_token(tid)["lemma"]
hwl = "derp"
hwl = frame.hw
tmp_idx = len(frame.sentences)
if hwl not in frame.aggr_sent:
frame.aggr_sent[hwl] = []
@@ -273,15 +273,14 @@ def api_get_frames():
# entry = vallex.entries[hw] # TODO hw -> [Frame,]
cur = valdb[corpus].find({"headwords": hw})
print("N_results: " + str(cur.count()))
frames = []
for ent in cur:
# TODO: maybe filter by hw?
frames += frames_from_db_entry(ent)
frames += frames_from_db_entry(ent) # pre-process this step for prod TODO
# return json.dumps([x.to_json() for x in frames])
frames = [x for x in frames if x.hw == hw]
ret_frames = RF(frames, None)
ret_frames = RF(frames, valdb[SENSEMAP_COLL])
return prepare_frames(ret_frames)