Skip to content

Commit dceb30a

Browse files
author
Ikko Ashimine
authored
Fix typo in word_occurrence.py (TheAlgorithms#6154)
word_occurence -> word_occurrence
1 parent ec54da3 commit dceb30a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

strings/word_occurrence.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from typing import DefaultDict
55

66

7-
def word_occurence(sentence: str) -> dict:
7+
def word_occurrence(sentence: str) -> dict:
88
"""
99
>>> from collections import Counter
1010
>>> SENTENCE = "a b A b c b d b d e f e g e h e i e j e 0"
11-
>>> occurence_dict = word_occurence(SENTENCE)
11+
>>> occurence_dict = word_occurrence(SENTENCE)
1212
>>> all(occurence_dict[word] == count for word, count
1313
... in Counter(SENTENCE.split()).items())
1414
True
15-
>>> dict(word_occurence("Two spaces"))
15+
>>> dict(word_occurrence("Two spaces"))
1616
{'Two': 1, 'spaces': 1}
1717
"""
1818
occurrence: DefaultDict[str, int] = defaultdict(int)
@@ -23,5 +23,5 @@ def word_occurence(sentence: str) -> dict:
2323

2424

2525
if __name__ == "__main__":
26-
for word, count in word_occurence("INPUT STRING").items():
26+
for word, count in word_occurrence("INPUT STRING").items():
2727
print(f"{word}: {count}")

0 commit comments

Comments
 (0)