Skip to content

Commit 99b391d

Browse files
fix: correct word_occurrence type hint and typo (#15194)
1 parent d2f0490 commit 99b391d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

strings/word_occurrence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
from collections import defaultdict
44

55

6-
def word_occurrence(sentence: str) -> dict:
6+
def word_occurrence(sentence: str) -> defaultdict[str, int]:
77
"""
88
>>> from collections import Counter
99
>>> SENTENCE = "a b A b c b d b d e f e g e h e i e j e 0"
10-
>>> occurence_dict = word_occurrence(SENTENCE)
11-
>>> all(occurence_dict[word] == count for word, count
10+
>>> occurrence_dict = word_occurrence(SENTENCE)
11+
>>> all(occurrence_dict[word] == count for word, count
1212
... in Counter(SENTENCE.split()).items())
1313
True
1414
>>> dict(word_occurrence("Two spaces"))

0 commit comments

Comments
 (0)