Commit cc93cb3e authored by Anthony Larcher's avatar Anthony Larcher
Browse files

cross show HAL

parents f75cbf96 6ebd0f9f
......@@ -255,7 +255,7 @@ def cross_show(previous_vec,
for ii, seg in enumerate(within_diar.segments):
within_diar.segments[ii]['cluster'] = cluster_dict[seg['cluster']]
return new_previous_vec, new_previous_diar, within_diar, None
return new_previous_vec, new_previous_diar, within_diar
def cross_show_HAL(previous_vec,
......@@ -265,7 +265,8 @@ def cross_show_HAL(previous_vec,
th_x,
lim,
user,
file_info):
file_info,
archive_file_info):
"""
:param previous_vec:
......@@ -335,20 +336,20 @@ def cross_show_HAL(previous_vec,
tmp_diar = copy.deepcopy(within_diar)
tmp_diar.filter("cluster", "==", current_speaker_name).add_duration().sort(["duration"], reverse=True)
show1 = tmp_diar[0]["show"]
t1 = (tmp_diar[0]["stop"] - tmp_diar[0]["start"]) // 2
t1 = (tmp_diar[0]["stop"] - tmp_diar[0]["start"]) / 200.
# Get the time of the middle of the longest segment for previous_diar_id in previous_diar
tmp_diar = copy.deepcopy(previous_diar)
tmp_diar.filter("cluster", "==", previous_spk_name).add_duration().sort(["duration"], reverse=True)
show2 = tmp_diar[0]["show"]
t2 = (tmp_diar[0]["stop"] - tmp_diar[0]["start"]) // 2
t2 = (tmp_diar[0]["stop"] - tmp_diar[0]["start"]) / 200.
# Ask the question to the user
complete_hyp = copy.deepcopy(previous_diar)
complete_hyp.append_diar(within_diar)
message_to_user = MessageToUser(file_info,
s4d_to_allies(complete_hyp),
Request('same', t1, t2, show2))
Request('same', t1, t2, archive_file_info[show2]))
keep_questioning, answer = user.validate(message_to_user)
......@@ -357,15 +358,15 @@ def cross_show_HAL(previous_vec,
# If the current speaker has to be linked with a previously seen one
if answer.answer :
print("ANSWER IS TRUE")
linkage_speaker_dict[current_speaker_name] = previous_spk_name
else:
already_questioned_speakers.append(previous_spk_name)
previous_spk_idx
previous_spk_idx += 1
else:
previous_spk_idx += 1
# concatenate previous_vec et within_vec
new_previous_vec = concat_statservers(previous_vec_backup, within_vec_backup)
new_previous_diar = copy.deepcopy(previous_diar)
......@@ -384,8 +385,10 @@ def cross_show_HAL(previous_vec,
return new_previous_vec, new_previous_diar, within_diar
def allies_cross_show_clustering(show_idx,
def allies_cross_show_clustering(show,
show_idx,
archive_vectors,
archive_file_info,
current_diar,
current_vec,
th_x,
......@@ -397,6 +400,7 @@ def allies_cross_show_clustering(show_idx,
:param show_idx:
:param archive_vectors:
:param archive_file_info:
:param current_diar:
:param current_vec:
:param th_x:
......@@ -414,7 +418,11 @@ def allies_cross_show_clustering(show_idx,
archive_vectors["previous_vec"] = copy.deepcopy(current_vec)
archive_vectors["previous_diar"] = current_diar
archive_file_info[show] = copy.deepcopy(file_info)
else:
archive_file_info[show] = copy.deepcopy(file_info)
if human_in_the_loop:
previous_vec, previous_diar, current_diar = cross_show_HAL(previous_vec=archive_vectors["previous_vec"],
previous_diar=archive_vectors["previous_diar"],
......@@ -423,7 +431,8 @@ def allies_cross_show_clustering(show_idx,
th_x=th_x,
lim=lim,
user=user,
file_info=file_info)
file_info=file_info,
archive_file_info=archive_file_info)
else:
previous_vec, previous_diar, current_diar = cross_show(previous_vec=archive_vectors["previous_vec"],
previous_diar=archive_vectors["previous_diar"],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment