Instantly share code, notes, and snippets.

Embed
What would you like to do?
def extract_age_range(test_pred_chunks):
outputs = []
for pred_chunks in test_pred_chunks:
if len(pred_chunks) > 0:
out = [get_min_max_age(' '.join(pred_chunk)) for pred_chunk in pred_chunks]
min_ages, max_ages = zip(*out)
min_age, max_age = max(min_ages), min(max_ages)
if max_age > min_age:
outputs.append((min_age, max_age))
else:
outputs.append((-1.0, -1.0))
else:
outputs.append((-1.0, -1.0))
return outputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment