Question: Can someone help me with this java question. ***Reduction and transformation The syllable reduction is meant to reduce the number of the different syllables in
Can someone help me with this java question.
***Reduction and transformation
The syllable reduction is meant to reduce the number of the different syllables in a text. The user inputs a value that indicates the number of syllables (k) that he should have in the final text. We reduce the syllables, one at a time until were left with k. If there is less than k at the beginning, then there is no reduction. To remove a syllable, you can find the syllable to remove and then replace it by the syllable that should replace it.
To do these operations, you must find the distance between each pair of possible different syllables in the text. For example, the following text has 4 different syllables:
fu.ta.fu.ma.fu.ta.fu.na.fu.ta.fu.ma.fu.ta.fu
So, we have 6 pairs of different syllables. We now must calculate the distances between them

Once we have the distances between each pair, were only left with choosing the pair that has the smallest distance. In the example, its the pair ma & na. Then, we must choose the syllable that will be replaced by another. For that, well use the occurrences of the syllables. The syllable of the pair that has the highest occurrence will replace the syllable with the lowest occurrence. In our example, the syllable ma has an occurrence of 2 and the syllable na has an occurrence of 1. So, were going to replace the syllables na by the syllables ma in the text. After this replacement, we must readjust the number of occurrences of the syllables ma in the text. Since there was 1 occurrence of the syllable na, this adds 1 occurrence of syllable ma who has now an occurrence of 3.
Syllabe 2 ta ma Syllabe 1 fu fu fu ta ta na Distance 10 11 12 3 2 1 ma na ma na Syllabe 2 ta ma Syllabe 1 fu fu fu ta ta na Distance 10 11 12 3 2 1 ma na ma na
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
