continue WIP
This commit is contained in:
parent
94b33542ef
commit
1387d6e4e5
|
@ -1,11 +1,15 @@
|
||||||
def count_words(input_sentence):
|
def count_words(input_sentence):
|
||||||
sentence = input_sentence.lower()
|
sentence = input_sentence.lower()
|
||||||
sentence = ' '.join(filter(str.isalnum, sentence))
|
# blocked_characters = [',', '.', ';', ':']
|
||||||
# for character in blocked_characters:
|
# sentence = ''.join(item for item in sentence if item.isalnum())
|
||||||
# sentence = sentence.replace(character, " ")
|
|
||||||
words = sentence.split()
|
words = sentence.split()
|
||||||
result = {}
|
result = {}
|
||||||
for word in words:
|
for word in words:
|
||||||
result[word] = words.count(word)
|
mod_string = ""
|
||||||
|
for elem in word:
|
||||||
|
if elem.isalnum() or elem == "'":
|
||||||
|
mod_string += elem
|
||||||
|
result[mod_string] = words.count(word)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue