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, 21.06.2019 23:30
Show that there is a language a ⚆ {0, 1} â— with the following properties: 1. for all x â a, |x| ≤ 5. 2. no dfa with fewer than 9 states recognizes a. hint: you don’t have to define a explicitly; just show that it has to exist. count the number of languages satisfying (1) and the number of dfas satisfying (2), and argue that there aren’t enough dfas to recognize all those languages. to count the number of languages satisfying (1), think about writing down all the strings of length at most 5, and then to define such a language, you have to make a binary decision for each string about whether to include it in the language or not. how many ways are there to make these choices? to count the number of dfas satisfying (2), consider that a dfa behaves identically even if you rename all the states, so you can assume without loss of generality that any dfa with k states has the state set {q1, q2, . . , qk}. now think about how to count how many ways there are to choose the other four parts of the dfa.
Answers: 3
question
Computers and Technology, 22.06.2019 08:10
Alook-up table used to convert pixel values to output values on a monitor. essentially, all pixels with a value of 190 or above are shown as white (i.e. 255), and all values with a value of 63 or less are shown as black (i.e. 0). in between the pixels are scaled so that a pixel with a value p is converted to a pixel of value 2/127 −+3969). if a pixel has a value of 170 originally, what value will be used to display the pixel on the monitor? if a value of 110 is used to display the pixel on the monitor, what was the original value of the pixel?
Answers: 1
question
Computers and Technology, 22.06.2019 16:20
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
question
Computers and Technology, 23.06.2019 02:50
There’s only one game mode that stars with the letter ‘e’ in cs: go. which of the options below is it?
Answers: 1
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
Mathematics, 16.07.2019 01:30
Questions on the website: 13722363