Question
Textbook Exercise: As some of you know well, and others of you may be interested to learn, a number of languages (including Chinese and Japanese)
Textbook Exercise:
As some of you know well, and others of you may be interested to learn, a number of languages (including Chinese and Japanese) are written without spaces between the words. Consequently, software that works with text written in these languages must address the word segmentation problem--inferring li_kely boundaries between consecutive words in the Exercises text. If English were written without spaces, the analogous problem would consist of taking a string like "meetateight" and deciding that the best segmentation is "meet at eight" (and not "me et at eight," or "meet ate ight," or any of a huge number of even less plausible alternatives). How could we automate this process? A simple approach that is at least reasonably effective is to find a segmentation that simply maximizes the cumulative "quality" of its individual constituent words. Thus, suppose you axe given a black box that, for any string of letters x = xlx2-., xk, will return a number quality(x). This number can be either positive or negative; larger numbers correspond to more plausible English words. (So quaIity("rne") would be positive, while quality("ght") would be negative.) Given a long string of letters y = YlY2 " "Yn, a segmentation of y is a partition of its letters into contiguous blocks of letters; each block corresponds to a word in the segmentation. The total quality of a segmentation is determined by adding up the qualities of each of its blocks. (So wed get the right answer above provided that quaIity("rneet") + quality("at") + quality(" eight") was greater than the total quality of any other segmentation of the string.) Give an efficient algorithm that takes a string y and computes a segmentation of maximum total quality. (You can treat a single call to the black box computing quality(x) as a single computational step.) (A final note, not necessary for solving the problem: To achieve better performance, word segmentation software in practice works with a more complex formulation of the problem--for example, incorporating the notion that solutions should not only be reasonable at the word level, but also form coherent phrases and sentences. If we consider the example "theyouthevent," there are at least three valid ways to segment this into common English words, but one constitutes a much more coherent phrase than the other two. If we think of this in the terminology of formal languages, this broader problem is like searching for a segmentation that also can be parsed well according to a grammar for the underlying language. But even with these additional criteria and constraints, dynamic programming approaches lie at the heart of a number of successful segmentation systems.)
2. (25) [Word segmentation] Textbook Exercise 5 in Chapter 6. Show the optimal substructure (with an explanation), give the memoized bottom-up dynamic programming algorithm, and state the resulting run time complexity (with an explanation). Assume we are given a function quality(i, j) which returns the quality of the string yiyi...y. 2. (25) [Word segmentation] Textbook Exercise 5 in Chapter 6. Show the optimal substructure (with an explanation), give the memoized bottom-up dynamic programming algorithm, and state the resulting run time complexity (with an explanation). Assume we are given a function quality(i, j) which returns the quality of the string yiyi...yStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started