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