Skip to content

Commit 0314cbf

Browse files
committed
Expect case normalized words
Ruby, Elixir, Clojure, and others expect words to be normalized in some way so that "Go", "go", "GO" are not considered different words.
1 parent 0606bba commit 0314cbf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

word-count/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ def word_count(text):
55
"""Return a Counter object that maps from the words contained in
66
the phrase to their respective counts
77
"""
8-
return Counter(text.split())
8+
return Counter(text.lower().split())

word-count/word_count_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def test_include_numbers(self):
3636

3737
def test_mixed_case(self):
3838
self.assertEqual(
39-
{'go': 1, 'Go': 1, 'GO': 1},
40-
word_count('go Go GO')
39+
[3],
40+
list(word_count('go Go GO').values())
4141
)
4242

4343
def test_multiple_spaces(self):

0 commit comments

Comments
 (0)