In this exam you are going to implement a web application that translate English words into Spanish. In particular, the application reads an English-Spanish Dictionary File (downloaded from The Internet Dictionary Project) from disk, stores the data in a Java bean, and uses a JSP to take user input and to display the output.
The dictionary file is also available on the CS3 server under the /tmp directory so you don't have to copy it there. Each line in the file is either a comment line which starts with an #, or a dictionary entry which consists of an English word and its Spanish translation separated by a tab. Note that some words have multiple translations.
is requested without any parameters, it
displays an input form asking for the word to be translated, as shown below:
|Please enter an English word:
After the user enters a word and clicks the Translate button, Translator.jsp displays the Spanish translation(s) of the word, as well as a link that takes the user back to the input form. For example, if the given word is "language", the following should be displayed:
If no translation is found for a given word, Translator.jsp
displays a list of words that are similar to the given word, and the
user may click on each word to see its translation. For example, if the
user enters the word "helo", the following should be displayed:
|No translation was found. Did you mean
The "similarity" between two words can be determined by their Edit Distance, a.k.a. Levenshtein Distance, which is the number of edits (insertion, deletion, or substitution of a letter) it takes to transform one word into the other. For example, the edit distance between "held" and "helo" is 1 because it takes one substitution to transform "helo" into "held".
The list of the similar words should include all the words in the dictionary that is within edit distance of 1 to the given word. And to calculate the edit distance between two words, you may utilize the Java source code available at http://www.merriampark.com/ld.htm.
Finally, if no similar words are found, simply display
|No translation was found. Try another word?
where the link will take the user back to the input form.