Skip to content

Instantly share code, notes, and snippets.

@funktor
Created October 14, 2018 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funktor/1d4df23fbe9b64d8c337108b4f6da11d to your computer and use it in GitHub Desktop.
Save funktor/1d4df23fbe9b64d8c337108b4f6da11d to your computer and use it in GitHub Desktop.
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