Problem 3 (100pts): accuracy
Implement accuracy
, which takes a typed
paragraph and a reference
paragraph. It returns the percentage of words in typed
that exactly match the corresponding words in reference
. Case and punctuation must match as well.
A word in this context is any sequence of characters separated from other words by whitespace, so treat "dog;" as all one word.
If a typed word has no corresponding word in the reference because typed
is longer than reference
, then the extra words in typed
are all incorrect.
If typed
is empty, then the accuracy is zero.
# Test your implementation
python ok -q 03