Vincent Claes
jobfixers create HTML table
a1372cb
import json
def get_intersection(a: list, b: list) -> list:
a = [i.lower() for i in a]
b = [i.lower() for i in b]
return sorted(set(a).intersection(set(b)))
def not_in_intersection(a: list, b: list) -> list:
return sorted(set(a).union(set(b)).difference(set(a).intersection(b)))
def get_score(true_values: list, predicted_values: list) -> float:
intersection_list = get_intersection(true_values, predicted_values)
return len(intersection_list) / len(true_values) if len(true_values) else 0
def match(present_features, not_present_features):
relevant_skills = len(present_features)
total_skills = len(present_features + not_present_features)
match = round(100.0 * (relevant_skills / total_skills), 2)
return match
def get_json_list_from_result(result: dict, key: str) -> list:
try:
return json.loads(result[key].strip())
except json.decoder.JSONDecodeError:
print(key, result[key])
return []