All problems
Vocabulary Size of Tokens
Problem
The vocabulary size is the number of distinct tokens.
Given the token list, return the size of the vocabulary.
Hint
Deduplicate with a set.
Test cases
case 1
in: [["a","b","a"]]
expected: 2
case 2
in: [["x"]]
expected: 1
case 3
in: [[]]
expected: 0
Starter codePython
def vocabulary_size_of_tokens(tokens):
# Your code here
pass3 test cases · run your code against them in the editor