Hello everyone, I am currently working on a code and I got stuck in a part. My algorithm is a text generator that operates on project Gutenberg and its flow is like this:
Enter a sentence as input
1-Pick longest word of input sentence
2-Search the longest word of the input sentence in all sentences of Project Gutenberg books -these sentences are accessed by using the gutenberg.sents() function as specified in NLTK book at http://www.nltk.org/book
3-Find the longest sentence that has the longest word of input sentence
4-Append that sentence to the first sentence
5-Go back to 1-
I want to find the longest word without worrying about case sensitivities -e.g. whenever the word is uppercase / lowercase, it should be found- but I can't access the sentences as it is a list of list -the gutenberg.sents() function prints the sentences as list of list, a strange way in my opinion- so the re.search can't return me any results. Any ideas on how I can find do this ? Thanks.