All problems
Document Frequency Count
Problem
Document frequency counts how many documents contain a term at least once.
Given the list of documents (each a token list) and the term, return the document frequency.
Hint
Count documents, not occurrences.
Test cases
case 1
in: [[["a","b"],["b","c"]],"b"]
expected: 2
case 2
in: [[["x"],["y"]],"z"]
expected: 0
case 3
in: [[["a","a"],["a"]],"a"]
expected: 2
Starter codePython
def document_frequency_count(documents, term):
# Your code here
pass3 test cases · run your code against them in the editor