Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-057

Word Count Excluding Stopwords

Problem

Return the number of tokens that are not in the stopwords list.

Duplicates among the remaining tokens are counted each time.

Hint

Put the stopwords in a set and count the tokens outside it.

Test cases

case 1
in: [["the","cat","is","on","the","mat"],["the","is","on"]]
expected: 2
case 2
in: [["a","b"],[]]
expected: 2
case 3
in: [[],["x"]]
expected: 0
case 4
in: [["do","not","stop"],["do","not","stop"]]
expected: 0
Starter codePython
def word_count_excluding_stopwords(tokens, stopwords):
    # Your code here
    pass

4 test cases · run your code against them in the editor