def calculate_oov(text, vocabulary): words = text.split(' ') oov_count = 0 for word in words: if word not in vocabulary: oov_count += 1 return oov_count / len(words)