![# Declares a list to store sentences sentences = [] sen = print(Enter sentences. Blank statement to terminate.) # Loops til](http://img.homeworklib.com/questions/358c32a0-bf48-11eb-9ba7-999a2239fe16.png?x-oss-process=image/resize,w_560)

# Declares a list to store sentences
sentences = []
print("Enter sentences. Blank statement to terminate.")
# Loops till empty sentence entered by the user
while True:
# Accepts a sentence
sen = input("Enter a sentence: ")
# Checks if the sentence entered by the user is not empty
if sen:
# Adds the sentence at the end of the sentences list
sentences.append(sen)
# Otherwise empty sentence
else:
# stop the loop
break
# Declartes a list to store words
words = []
# Loops till number of sentences and extracts each sentence
for sen in sentences:
# Converts the current sentence to lower case
# then split it with space
wo = sen.lower().split()
# Loops till number of words in current sentences
for w in wo:
# Adds the current word at the end of the words list
words.append(w)
# Declares a dictornary to store each word frequency
wordFrequency = {}
# Loops till number of words, and extracts each word
for wo in words:
# Checks if current word in not available in the dictonary
if wo not in wordFrequency:
# Counts number of times current word wo available
# in the list words
# Stores the number in the dictionary key wo as word
wordFrequency[wo] = words.count(wo)
print("Frequency of words")
# Loops till end of the dictionay and extracts each key
for wo in wordFrequency:
# Displays the key as word and value as frequency
print(wo, ": ", wordFrequency[wo])
Sample Output:
Enter sentences. Blank statement to terminate.
Enter a sentence: The house of thunder.
Enter a sentence: The top of the list.
Enter a sentence:
Frequency of words
the : 3
house : 1
of : 2
thunder. : 1
top : 1
list. : 1
Please complete the following: Write a Python script to do the following: 1. Ask the use...
This program is in python and thanks fro whoever help me. In this program, you will build an English to Hmong translator program. Hmong is a language widely spoken by most Southeast Asian living in the twin cities. The program lets the user type in a sentence in English and then translate it to a Hmong sentence. The program does not care about grammar or punctuation marks. That means your program should remove punctuation marks from the English words before...
Exercise 1 - Create a List to Sum Values Write a python script that sums the values in a list called add_list that contains the following values: (10, 2, -4, 8). Make sure you include a for loop when iterating through the list to sum the values. Take screenshots of the code and output. Exercise 2 – Create a Dictionary Write a python script that prints a dictionary where the key numbers are 1, 2, 3, 4, and 5 and...
In python Count the frequency of each word in a text file. Let the user choose a filename to read. 1. The program will count the frequency with which each word appears in the text. 2. Words which are the spelled the same but differ by case will be combined. 3. Punctuation should be removed 4. If the file does not exist, use a ‘try-execption’ block to handle the error 5. Output will list the words alphabetically, with the word...
PLEASE DO IN JAVA
You can use any source for the dictionary or just a few
words are fine!
description The purpose of this assignment is to practice with ArrayLists (and hopefully, you'll have some fun). As far as the user knows, play is exactly as it would be for a normal game of hangman, but behind the scenes, the computer cheats by delaying settling on a mystery word for as long as possible, which forces the user to use...
Write a script that uses random number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition. Create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, concatenate it to the previous words in the sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and...
In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...
PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the...
Write the code in python, if you cannot answer all the question
please dont anser, thanx very much. Please gimme a screen shot for
code.
Write clear code with comments and follow coding convention. Comments should include your name, student number and subject code on top of your code Question 1 Create a list to store all the subject codes that you are currently doing at UOW Then use for loop to display it in a table as in the...
Write a Java Program that performs the following functionalities: and you can use if statements, cases, and string methods Enter a new main sentence Find a String Find all incidents of a String Find and Replace a String Replace all the incidents of a String Count the number of words Count a letter’s occurrences Count the total number of letters Delete all the occurrences of a word Exit The program will display a menu with each option above, and then...
python please
11 def add_item(items, word): 14 15 16 F # check if the word is in the dictionary (keys of dictionary) if word in items: items [word] = items (word] + 1 # update the count else: # word is not in dictionary items[word] = 1 # add the word with count 1 return items [word] # return the current count of word after updation Create a function named build_dictionary that takes a list of words (as a parameter)...