3. Consider an editor that compares a typed in word say of length n and changes it to the nearest word in the dictionary, which can be of size m. For example, if you mistyped ”floyre”, it can change the word to ”flower” or ”flow” or ”floe” or ”floor”. To judge the best word, the spell checker computes the minimum number of changes between the typed word and the words in its dictionary. The changes can be as follows; (i) inserting a character, (ii) deleting a character or (iii) changing a character. All the change operations have equal weightage.
(a) Describe an algorithm to find the minimum number of changes between two given words. This is a well-known problem in dynamic programming, so you can take help of other resources. Just explain the process in your own words (20)
(b) Using this method show step by step how to determine to which word” sdimnas” should be changed. The candidates are (i)dynast, (ii) summer, (iii)dismal, (iv)dimmer, (v)sadden. (3*5=15) (please show the stapes too)
(c) Suggest two other criteria to select the most appropriate word, excluding the minimum number of changes. Gives reasons for why you selected the criteria (5)
4. Huffman Coding (40) The Latin alphabet is used in many European languages such as English, Spanish, French, German, etc. Show that the Huffman coding depends on the language used as well as the content. To do so apply Huffman coding on texts from different languages and different subjects, as follows;
Compress, using Huffman coding, the first 2000 words from Chapter 1 of the following novels in their original language; (Moby Dick; Don Quixote, Three Musketeers). (10)
Translate the exact 2000 words into English, Spanish, and French (whichever of the two is not the original language), using an online translator.
Compress these using Huffman code as well (10) Create a histogram comparing the length of the code per letter for (i) the three novels in the same languages and (ii) the same novel in different languages. Discuss your results
Answer 3:
We can solve this problem using dynamic programming. We can
observe a pattern after solving some examples by hand that for
writing each character we have two choices either get it by
inserting or get it by copying, whichever takes less time. Now
writing relation accordingly,
Let dp[i] be the optimal time to write i characters on screen
then,
If i is even then,
dp[i] = min((dp[i-1] + insert_time),
(dp[i/2] + copy_time))
Else (If i is odd)
dp[i] = min(dp[i-1] + insert_time),
(dp[(i+1)/2] + copy_time + removal_time)
In the case of odd, removal time is added because when (i+1)/2 characters will be copied one extra character will be on the screen which needs to be removed. Total time complexity of solution will be O(N) and auxiliary space needed will be O(N).
whole code:
def minTimeForWritingChars(N, insrt,
remov, cpy):
if N == 0:
return 0
if N == 1:
return insrt
dp = [0] * (N + 1)
for i in range(1, N + 1):
if i % 2 == 0:
dp[i] = min(dp[i - 1] + insrt,
dp[i // 2] + cpy)
else:
dp[i] = min(dp[i - 1] + insrt,
dp[(i + 1) // 2] +
cpy + remov)
return dp[N]
3. Consider an editor that compares a typed in word say of length n and changes...
please read this articel and write one page summary atleast 250 words: MLB managers learn Spanish to unite teams and clubhouses: At spring training of 1962, the newly hired manager of the San Francisco Giants, Alvin Dark, gathered several of his side's Latin American players together behind second base. Once there, he gave an order that left them surprised, stunned and outraged. "He told us that we couldn't speak Spanish to each other in the clubhouse", said Orlando Cepeda, who...
*Psychology Essay *: The text of your essay must be approximately 1500-2000 words in length (not including references), written in clear and grammatical English, and submitted as double-spaced typed stapled hard copy with a cover page (there are staplers in the Library). You must have a minimum of three Psychology references, not including the textbook, websites etc. Use APA format for citations and quotations. The references should be listed in APA style on a ‘References’ page at the end of...
Explain how the below key concept are linked to this
case (i.e. how the key concepts you have learned in this topic is
applied in this case study?)
Culture and Cross-Cultural Risk
Culture is the values, beliefs, customs, arts, and other
products of human thought and work that characterize the people of
a given society. Cross-cultural risk arises from a situation or
event in which a cultural misunderstanding puts some human value at
stake. Values and attitudes are shared beliefs...
14. Select the number of participants in the Beck & Watson
study
Group of answer choices
8
13
22
35
15. Beck & Watson determined their final sample size via
Group of answer choices
coding
saturation
triangulation
ethnography
16.Through their study, Beck & Watson determined
Group of answer choices
after a traumatic birth, subsequent births have no troubling
effects
after a traumatic birth, subsequent births brought fear, terror,
anxiety, and dread
Subsequent Childbirth After a Previous Traumatic Birth Beck, Cheryl...