subject

In this problem, you will write a translation program. First your program will prompt the user for three filenames. The first file is a dictionary. Each line contains a regular English word followed immediately by a vertical bar ($\verb#|#$) followed immediately by the word or phrase that the word should be translated to. For example, if I wanted to translate $\verb#'hello'#$ as $\verb#'hola'#$, one entry in the file would be $\verb#hello|hola#$. The second file should contain a text to translate. You may assume that words in this file are separated by spaces and that there is no other punctuation (including periods at the ends of sentences). The last filename should be for an output file. The program will then take each word in the input file and translate it based on the dictionary. In other words, if the word appears on the left side of a bar in the dictionary file, the program will replace it with whatever is on the right side of the bar. If the word does not appear on the left side of a bar, it is kept as is in the output. (Note, though, that you do not have to preserve case in the output---if a word is capitalized in the input, it does not have to be capitalized in the output.) All the words should be written to the output file. Other than prompting for the filenames, there should be no other output to the IDLE shell.

For example, using the provided files $\verb#pirateWords. txt#$ and $\verb#myInput. txt#$, a run of your program could look like this:
Enter name of dictionary: pirateWords. txt
Enter name of text to translate: myInput. txt
Enter name of output file: myOutput. txt

There should be nothing printed, and the contents of $\verb#myOutput. txt#$ would be:
avast i have come to swipe ye filthy lucre
ye filthy lucre or ye life

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
question
Computers and Technology, 23.06.2019 01:20
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 24.06.2019 07:40
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
You know the right answer?
In this problem, you will write a translation program. First your program will prompt the user for t...
Questions
question
Chemistry, 27.05.2021 19:30
question
Mathematics, 27.05.2021 19:30
question
Mathematics, 27.05.2021 19:30
question
Mathematics, 27.05.2021 19:30
Questions on the website: 13722363