I have the following string:
S = "to be or not to be, that is the question?"
I want to be able to create a dictionary that has the output of
{'question': 4, 'is': 1, 'be,': 1, 'or': 1, 'the': 1, 'that': 1, 'be': 1, 'to': 1, 'not': 1}
where I get the number of vowels in each word next to the word, not the count of each word itself. So far I have:
{x:y for x in S.split() for y in [sum(1 for char in word if char.lower() in set('aeiou')) for word in S.split()]}
with an output of:
{'or': 4, 'the': 4, 'question?': 4, 'be,': 4, 'that': 4, 'to': 4, 'be': 4, 'is': 4, 'not': 4}
How do I get a dictionary from a string where the values are the vowel counts from each word?