fixed the sentence duplication bug. todo: functors

This commit is contained in:
voje 2019-04-11 07:49:31 +02:00
parent 4a9a9cca12
commit d135cc7f2b
3 changed files with 10 additions and 5 deletions

View File

@ -302,6 +302,9 @@ def api_get_functor_frames():
for ent in cur:
frames += frames_from_db_entry(ent) # pre-process this step for prod TODO
for f in frames:
print(f.to_json())
# raw_frames = vallex.functors_index[functor] # TODO
ret_frames = RF(frames, valdb[SENSEMAP_COLL])
return prepare_frames(ret_frames)

View File

@ -30,7 +30,7 @@ def frames_from_db_entry(dbent):
],
# sentences=[(dbent["sid"], dbent["tokens"])],
sentences=[
[(_full_tid(t["tid"]), t)for t in dbent["tokens"]],
[(_full_tid(t["tid"]), t) for t in dbent["tokens"]],
]
)]
return frames

View File

@ -24,12 +24,14 @@ def sorted_by_len_tids(frames):
def reduce_0(frames, valdb_sensemap=None):
# new request... frames should be sorded by
# functors list (basically reduce_1, just each
# sentence gets its own frame)
r1_frames = reduce_1(frames)
# functors list
# return frames # simplify code...
# frames = reduce_1(frames)
sorting_strings = []
separated_frames = []
for frame in r1_frames:
for frame in frames:
for tid in frame.tids:
tmp_frame = DC(frame)
tmp_frame.tids = [tid]