All problems
Summary Key Term Coverage
Problem
Return the fraction of key terms that appear in the summary tokens, comparing sets.
Return 0.0 when there are no key terms.
Hint
Convert the summary tokens to a set and count covered key terms.
Test cases
case 1
in: [["the","cat"],["cat","dog"]]
expected: 0.5
case 2
in: [["a","b"],["a","b"]]
expected: 1
case 3
in: [["a"],[]]
expected: 0
case 4
in: [[],["x"]]
expected: 0
case 5
in: [["x","y","z"],["x","z","w"]]
expected: 0.6666666666666666
Starter codePython
def summary_coverage(summary_tokens, key_terms):
# Your code here
pass5 test cases · run your code against them in the editor