I am doing some hands-Ons online in python for nltk.
The task is to filter words from complete set of Text6 having first letter in upper case and all other letters in lower case. Print the number of words present.
Can someone please assist to tell the exact answer (as it is standard text from book of nltk) and what's wrong in the code.
I tried below code:
from nltk.book import text6
import re
pattern = '[A-Z]+[a-z]+$'
capsword= [word for word in set(text6) if re.search(pattern, word)]
print(len(capsword))
My actual output is 461. But, I am not sure about expected output as same is hidden.