File size: 202 Bytes
a55d080
 
 
 
 
 
 
1
2
3
4
5
6
7
8
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)