N-gram Contamination Rate
~14 mincode completion
Implement contamination_rate(test_text, corpus, n) returning c as a float.
Where this shows up
~14 min
••••••••••••••••
8 employers weight this skill
3 AI product companies, 2 frontier labs, 1 health and bio company, 1 big tech firm, 1 autonomy company. Top match scores 93.
Python
def contamination_rate(test_text, corpus, n):
"""
Share of a test example's n-gram positions that appear in the training corpus.
Args:
test_text: the test example, a string
corpus: list of training document strings
n: n-gram length
Returns:
float in [0, 1]
"""
# YOUR CODE HERE
pass