strings.word_occurrence ======================= .. py:module:: strings.word_occurrence Functions --------- .. autoapisummary:: strings.word_occurrence.word_occurrence Module Contents --------------- .. py:function:: word_occurrence(sentence: str) -> dict >>> from collections import Counter >>> SENTENCE = "a b A b c b d b d e f e g e h e i e j e 0" >>> occurence_dict = word_occurrence(SENTENCE) >>> all(occurence_dict[word] == count for word, count ... in Counter(SENTENCE.split()).items()) True >>> dict(word_occurrence("Two spaces")) {'Two': 1, 'spaces': 1}