13.07.2015 Views

Fun with Algorithms, 4 conf., FUN 2007(LNCS4475, Springer, 2007)(ISBN 9783540729136)(281s)_CsLn_

Fun with Algorithms, 4 conf., FUN 2007(LNCS4475, Springer, 2007)(ISBN 9783540729136)(281s)_CsLn_

Fun with Algorithms, 4 conf., FUN 2007(LNCS4475, Springer, 2007)(ISBN 9783540729136)(281s)_CsLn_

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Efficient <strong>Algorithms</strong> for the Spoonerism Problem 79(“weight of rages”) that can be tracked back to Spooner and says: ’Many otherSpoonerisms, such as those given in the previous editions of O.D.Q., are nowknown to be apocryphal.’In French (contrepéterie) this play <strong>with</strong> word for amusement is also verypopular. However traditionally the swap results in an often indecent meaningsuch that only the original part should be said. The sometimes hard task to findthe swap revealing the funny meaning is left to readers or listeners.As said before, the substitutions often rhyme. In German there are shortrhymes that are based on the exchange of the last two stressed syllables (orparts). These are known as “Schüttelreim” (shaken rhyme). Examples are: ”EinSchornsteinfeger gegen Ruß / am besten steht im Regenguß.” (A chimney sweeperavoids soot best when standing in the rain) and “Beim Zahnarzt in denWartezimmern / hört man oft auch Zarte wimmern.” (In dentist waiting roomsone often hears tender ones whimper). The latter example (and many more) canbe found at de.wikiquote.org.In Slovak and Czech, the spoonerism is known as “výmenka” (exchange riddle).An example is “úľbeználady – ľúbezná lady” (A hive in bad mood – lovablelady).In psychological tests, spoonerisms have been used to analyze phonologicalawareness which is related to spelling abilities [1].In string matching and analysis, transposition of letters is used as metric forthe similarity of strings. For instance, the Jaro distance metric [4, 5] and theJaro-Winkler distance [8] are string comparators that account for transpositionsof single letters.We consider here the problem of deciding whether a given word or sentence isa spoonerism, i.e., whether there exists a transposition of two letters such thatthe resulting string is a valid word according to a given dictionary or can bedecomposed into valid words. The problem was introduced in an unpublishedpresentation [7]. Some sketch of the ideas of the presentation can be found inan unpublished manuscript [2]. All the algorithms and results achieved and presentedthere (see the comparison in Section 2) are disjoint from our results.The problem can be formalized in the following way. A sentence s is given asa string, i.e., as a concatenation of its words. Its length n is the total numberof letters in s. The second part of the input is a dictionary D of valid words.The task is to decide whether there exist two positions in the string such thata swap of the letters at these position leaves a string that can be decomposedinto words of the dictionary. For example, by swapping the letters l and p in thephrase “a lack of pies” we get another meaningful phrase “a pack of lies” whichis correctly spelt in English.In this paper, we will give some efficient algorithms for deciding if a givensentence is a spoonerism and analyze their worst-case running times. In Section2, we will fix our notion and present a formal definition of the problem. InSection 3, we will present a first dynamic-programming approach for solving thespoonerism problem; two technically more involved algorithms <strong>with</strong> improvedrunning times will be presented in Sections 4 and 5.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!