in misc/precision_filtering/wordlist_gen.py [0:0]
def filter_by_ratio(counter1, counter2, threshold=0.85):
# Create a new Counter to store the results
filtered_counter = Counter()
# Iterate over the keys of the first counter
for key, value1 in counter1.items():
# Check if the key exists in the second counter
if key in counter2:
value2 = counter2[key]
# Compute the ratio and check if it's above the threshold
ratio = value1 / value2
if ratio >= threshold:
filtered_counter[key] = ratio
return filtered_counter