Computational Modelling of Linguistic Humour: Tom Swifties

Greg Lessard,
French Studies, Queen's University, Canada

Michael Levison
Computing and Information Science, Queen's University, Canada

ALLC/ACH Conference, 1992, Oxford

1. Introduction

The current paper describes an attempt to model a particular type of linguistic humour, Tom Swifties, by means of a sentence generator. Tom Swifties are pun-like utterances ascribed to the character "Tom", in which (typically) a manner adverb enters into a formal and semantic relation with other elements in the sentence, as in the following:

(1) "I can't find the sleeping bag" Tom said intently (i.e. in + tent + ly).

The motives for the experiment are twofold. On the one hand, as Menn and Obler (1982) point out, exceptional language use, such as linguistic humour, performance errors and the like, often provides us with valuable insights into the mechanisms which underlie "normal" language production. On the other hand, if we assume that play languages, as defined by Sherzer (1982), build upon and exceed normal language use, then the ability to mimic such extended utterances provides a valuable test of a generation environment.

2. Corpus

Materials for the analysis come from an online discussion facility called SOAPBOX, available on the IBM mainframe at Queen's University, Canada. Users of the system are free to propose subjects for debate or conversation, and all other users then have the opportunity to append their comments.

In 1988, one user proposed Tom Swifties as a topic, provided a simple example, and asked for others. By the end of the discussion, 116 examples had been proposed. It is this corpus which underlies our analysis.

3. Lingustic Analysis

Let us restrict the analysis to the simplest type of Tom Swifty, having the form:

(2) "SENTENCE" said Tom ADV[manner]

Within this structure, ADV must include at least one substring with a phonetic link (homonymy or at least paronymy - partial phonetic resemblance) to another word in the lexicon. For example:

(3) "I hate seafood" Tom said crabbily. [linked form: crab]

(4) "I'm just a poor cripple" Tom said lamely. [linked form: lame]

(5) "Bartender, pour me one more" Tom said gingerly. [linked form: gin]

As well, the linked form must be semantically related to some element in the SENTENCE quoted. These semantic links may be of varying complexity, and include:

(6) "I wish I were taller" Tom said longingly. [synonymy]

(7) "Turn up the heat" Tom said coldly. [antonymy]

(8) "I'll have the lamb" Tom said sheepishly. [hyponymy]

(9) "I like pizza" Tom said crustily. [meronymy (part-whole relation)]

(10) "I'm being crucified" Tom said crossly. [instrumentality]

(11) "I hate chemistry" Tom said acidly. [domain relations]

(12) "I don't like computers" Tom said byteingly. [domain relations]

(13) "There's too much tabasco in this chili" Tom said hotly. [object-quality relations]

Additional formal structures (for example "SENTENCE", Tom VERBed) are possible, as well as other, more complex semantic links (Lessard, 1988). Following that paper, we will use the term PIVOT to designate the manner adverb, the term BASE to designate the form carried in the manner adverb, and the term TARGET to designate the item or items in the sentence with which the base entertains semantic links. The relation between base and pivot will be called the FORMAL BRIDGE, while the relation between base and pivot will be called the SEMANTIC BRIDGE. Thus, in example (3), the base is crab, the pivot is crabbily, the target is seafood, while the formal bridge is that between crab and crabbily, and the semantic bridge that between crab and seafood.

(14)                               ---<----
                                   |      |
                                 pivot    |
                               --------   |
    "I hate seafood", Tom said crabbily.  | formal bridge
            -------            ----       |
            target             base       |
               |               |  |       |
               ------<------<---  ---->----
                 semantic bridge

In principle, manner adverbs used in Tom Swifties appear to be lexicalized. Thus, of the 116 cases found in (Lessard, 1988), only 4 had manner adverbs not attested by the Webster's III. And these were only marginally Tom Swifties, as the following example illustrates:

(15) "This money order should postpone Vakia from repossessing my stuff", Tom said Czekolslovakialy (sic). [cheque'll slow Vakia]

On the other hand, the components of SENTENCE vary over a wide range, as the above examples illustrate.

Let us be aware, however, that this linguistic evidence does not demonstrate psycholinguistic priority of the manner adverb. In other words, nothing prevents us from assuming that the producer of a Tom Swifty begins by finding a sentence and only subsequently selects a manner adverb which produces the appropriate response. Only the appropriate experimentation would allow us to clarify this latter issue.

In fact, at this stage of the investigation, the most prudent model will recognize the relations between manner adverb and sentence without imposing priority.

4. Computational Modelling

In order for a generation device to appropriately produce Tom Swifties, it is necessary to capture both the formal bridge between manner adverb and related lexical item, and the semantic bridge between lexical item and sentence contents, and to distribute this information around the syntax tree. The VINCI sentence generator (Levison and Lessard, forthcoming), which uses an attribute grammar formalism, is used to illustrate the generation process. In what follows, we discuss problems associated with capturing both the semantic and formal bridges.

4.1. Semantic Bridge

Note first that all models share one trait. The specific nature of the semantic bridge has no importance for the humour produced. We can demonstrate this by replacing one semantic bridge by another in the examples given above. For example, replacing synonymy by antonymy in (6) gives

(6a) "I wish I were taller", Tom said shortly.

and replacing quality relations with hyponymy in (13) gives

(13a) "There's too much tabasco in this chili" Tom said saucily.

Consequently, we will assume that ANY semantic bridge is sufficient. On the other hand, obtaining such a bridge is a task of varying complexity. In the simplest case, the base and the target will share the same attribute value, either for domain (as in example (11), where acid and chemistry share the domain chemistry) or for sense (as in (6), where tall and long share the attributes length and exceeding the norm). In more complex cases, such as hyponymy, meronymy, instrumentality and object-quality relations, it will be necessary to use lexical pointer information which, for any given lexical entry, specifies other lexical items related by formal, derivational or semantic links.

In the examples which follow, we have chosen to build the semantic bridge before the formal bridge. This is without prejudice to the psycholinguistic priority between them.

4.2. Formal Bridge It is possible to envisage a variety of devices for establishing formal links between base and pivot, while at the same time retaining the semantic bridge. We will examine three competing mechanisms:

4.2.1. Attribute Values

Let us restrict our attention to cases such as (4), (7) and (11), where adjectives such as lame, cold, acid function as bases. Such adjectives accept the suffix -ly to form adverbs. We can model Tom Swifties by means of an attribute value (say ly) attached to all adjectives in the lexicon having corresponding adverbs in -ly. The syntax for producing Tom Swifties of the sort may then be written (in a simplified form, with attributes in square brackets):

(16) SENTENCE[semantic_value] said Tom ADJ[semantic_value,ly]

where semantic_value shared by SENTENCE and ADJ represents the semantic bridge. Appropriate syntactic rules can then generate a sentence containing the attribute semantic_value somewhere in its leaf-nodes, while a morphological rule adds -ly to the adjective, making it an adverb.

We have tested this model using a basic syntax:

(17) %include "att"




and applying the syntax to a limited range of attribute values having to do with the physical characteristics of physical objects. These values include:

(18) couleur, humidité, illumination, largeur, longueur, manipulation, orientation, poids, profondeur, propreté, résistance, rigidité, tactile, température, tranchant, variabilité, vitesse,

The adjective lexicon for this run was based on adjectival forms having the capacity to function as adverbial forms - this is signalled by the attribute 'ly'. A sample of the lexicon follows:


Application of the syntax to such a lexicon produces a range of output, shown below.

(20) ' this slime is colorful ' , said Tom colorfully
     ' this basketball is colorful ' , said Tom colorfully

     ' this matter is opaque ' , said Tom obscurely
     ' this rock is big ' , said Tom shortly

     ' this slime is wet ' , said Tom drily

     ' this basketball is light ' , said Tom heavily
     ' this rim is heavy ' , said Tom leadenly
     ' this block is light ' , said Tom leadenly

     ' this figure is filthy ' , said Tom dirtily

     ' this work is robust ' , said Tom toughly
     ' this figure is rugged ' , said Tom robustly
     ' this piece is hard ' , said Tom robustly

     ' this lampshade is rigid ' , said Tom slackly
     ' this flag is limp ' , said Tom firmly

     ' this work is oily ' , said Tom abrasively
     ' this rock is sleek ' , said Tom flatly
     ' this rock is silky ' , said Tom abrasively
     ' this article is flat ' , said Tom smoothly

     ' this material is frosty ' , said Tom torridly
     ' this cover is cool ' , said Tom coolly
     ' this property is hot ' , said Tom frostily
     ' this rock is frosty ' , said Tom tepidly
     ' this ice is cold ' , said Tom chillyly

     ' this work is dull ' , said Tom pointedly
     ' this object is blunt ' , said Tom dully

     ' this block is even ' , said Tom plainly

While such a model produces appropriate results, it has two essential weaknesses: first, the attribute ly indicating the possibility of adding the suffix -ly has no great plausibility in a psycholinguistic model; and secondly (and more seriously), such a mechanism fails entirely to capture cases where the relation between base and pivot is more complex, such as example (5).

(5) "Bartender, pour me one more" Tom said gingerly. [linked form: gin]

It would be odd to postulate a word-formation rule adding -gerly to a noun base gin to yield adverb gingerly.

4.2.2. Lexical Pointers

An alternative analysis consists in displacing the formal bridge information into the lexicon itself, by means of lexical pointers. The generation of a Tom Swifty then takes place in two steps. In the first, phrase structure rules produce a tree in which the base is formed by a noun carrying a semantic value in common with the target:

(21) "SENTENCE[semantic_value]" said Tom OP:N[semantic_value].

In the second step, a noun is chosen to satisfy the requirements imposed by phrase structure rules. Then an operation, denoted here by OP, searches the lexicon for an adverb indicated by a lexical pointer stored with the noun, and inserts it in the tree.

To illustrate this with example (5), we must suppose that one of the fields of the lexical entry for the noun gin contains a lexical pointer to the adverb gingerly. If the noun chosen by the phrase structure rules is gin, then gingerly becomes a potential adverb choice when the operation is applied.

We have implemented this approach using a limited (44 item) lexicon of animate nouns. Each noun points at a related (synonymous, antonymous, hyponymous) noun:

(22) professional -> ant:"amateur"
     monkey -> syn:"ape"
     lout -> syn:"boor"
     girl -> ant:"boy"

At a second level, each of the nouns pointed at in the lexicon has in its own lexical entry another pointer to a derived adjectival form:

(23) amateur -> adj:"amateurish"
     ape -> adj:"apish"
     boor -> adj:"boorish"
     boy" -> adj:"boyish"

Finally, each adjectival form pointed at has in its lexical entry a pointer to an adverbial form in "ly".

(24) amateurish -> adv:"amateurishly"
     apish -> adv:"apishly"
     boorish -> adv:"boorishly"
     boyish -> adv:"boyishly"

When these lexical items are combined with a basic syntactic frame as shown below:

(25) %include "att"




the result is a series of utterances as follows:

(26) ' I am not a nun ' , said Tom monkishly.
     ' I am not a cat ' , said Tom kittenishly
     ' I am not a girl ' , said Tom boyishly.
     ' I am not a flirt ' , said Tom coquettishly.
     ' I am not an idiot ' , said Tom doltishly.
     ' I am not a rogue ' , said Tom rakishly.
     ' I am not a joker ' , said Tom clownishly.
     ' I am not a rake ' , said Tom roguishly.

Such a system is more plausible, but still falls short in two respects: first, in many cases, the noun (or whatever) chosen by the phrase structure rules will not point to any appropriate adverb, in which case the potential Tom Swifty fails; and second, the use of lexical pointers continues to miss a significant generalization, that is, the possibility of only partial formal links between base and pivot, as in:

(27) "I'll have the lobster" Tom said shellfishly.

In response to this requirement, we propose a third approach.

4.2.3. Word Generation

We are currently working on the concept of syntactic and morphological "malrules" to account for student errors in second-language production (Sleeman & Brown, 1982), and also on lexical transformations for word formation. These give us the possibility of creating new words (or perhaps non-words) from existing ones by way of formal rules, or of establishing formal links between pairs of lexical items.

To generate strings such as (27), then, the system begins by using phrase structure rules to build the same sort of skeleton as in 4.2.2, and selects an appropriate noun. Rather than following lexical pointers, however, it continues by creating or seeking out an adverb having some rule-governed formal link with the noun base. This could include a simple substring relation, as in gin/gingerly, but could also include more or less developed phonetic similarity (as long as that lexical items include a phonetic transcription).

We have implemented this third approach in the following way. Beginning with a 100000+ item lexicon made available by Evan Antworth of SLI, we grepped out all items in "-ly", and added appropriate markup:

(28) actively|ADV|man|

As a second step, we used grep again to remove from the large lexicon all three letter words, further reducing these to nouns describing physical (including animate and human) entities and built lexical entries for all of these (184 items in all)

(29)act aid aim air ale ant ape arc arm art ass awe awl axe bag
    bar bat bay bed bet bib bin bit bog bow box boy bra bud bug
    bum bun bur bus cab cad can cap car cat cob cod cog cop cot
    cow cub cup cur cut dab dad dam day dew dig din dip doc doe
    dog dot dye eel egg elf elk elm end ewe eye fad fat fax fib
    fig fin fir flu foe fog fox fun fur gag gal gas gem gin gum
    gun gut guy gym hag ham hat hay hen hip hoe hog hub hut imp
    ink inn jam jar jet job joy jug keg key kit lab lad lap lip
    log loo man map mat mix mob mop mud mug nap net nun nut oaf
    oak oar oat owl pan pat paw pen pet pig pin pit pop pot pun
    pup ram rat ray rum rut rye saw ski sky sod son sow spy sub
    sun tag tap tar tea tee tie toy tub tug van vet wax wig wit
    yak yam zen zoo

A macro was then built to find all occurrences in the adverb lexicon where the first three letters of an adverb were matched by one of the three-letter nouns. The resulting links were then recorded.

As a final step, a double lexicon was built, one part composed of the three- letter nouns given above, a second part composed of lexical items having semantic links with one or more of these nouns:

(30) beer -> syn:"ale"
     flab -> syn:"fat"
     pastry -> syn:"bun"
     sheep -> hpy:"ram"

This lexicon was then used within the following syntactic frame:

(31) %include "att"




and the lexical pointers in the noun used to link first to the related lexical items, and thence to matching forms in the adverb lexicon. Output of such a mechanism is as follows, where * denotes failure to find a related adverb and where / separates alternative outputs from the adverb lexicon.

(32) ' I perceive the hair ' , said Tom *wig
     ' I look at the cove ' , said Tom *bay
     ' I stare at the flab ' , said Tom fatly / fattily / fatuously
     ' I notice the enemy ' , said Tom *foe
     ' I stare at the sheep ' , said Tom *ewe
     ' I consider the pastry ' , said Tom bunchily
     ' I consider the omelette ' , said Tom *egg
     ' I notice the kitten ' , said Tom cataleptically / catarrhally /
                                        catastrophically / categorically /
                                        catholically / cattily
     ' I look at the beef ' , said Tom cowedly
     ' I look the hotel ' , said Tom innately / innerly / innocently /
     ' I see the witch ' , said Tom haggardly
     ' I perceive the hatchet ' , said Tom *axe
     ' I see the lout ' , said Tom cadaverously / caddishly
     ' I consider the slip ' , said Tom brainlessly / brainily / brashly /
                                        brassily / bravely / brawlingly
     ' I perceive the man ' , said Tom *guy
     ' I notice the help ' , said Tom *aid
     ' I perceive the excavation ' , said Tom pitchily / piteously / pithily /
                                              pitiably / pitifully /
                                              pitilessly / pityingly

In our full paper, we examine the models presented here in more detail, and discuss the implementation of the system in the VINCI environment. In particular, we trace the progression from a simple system where what comes out is a direct consequence of data already embedded in the system, to a more complex system where output is a consequence rather of strategies embedded in the system.

It must be recognized that a given form may be the product of several alternative mechanisms, as the following examples illustrate.

(33) "We've struck oil," Tom said crudely.
     "My bicycle has a flat," spoke Tom tiredly.
     "Go out and milk the cows!" Tom uddered.

Alternatively, a Tom Swifty may include multiple bases, each linked to a separate target in the embedded sentence:

(34) "I'll take the prisoner downstairs," said Tom Swift condescendingly.
     "I'm trapped in the wizard's necklace," Tom said independently.
     "I'm the navy chaplain on a crowded destroyer", Tom said worshipfully.

Finally, it must be recognized that the range of linguistic material available to serve as bases is not restricted to lexical items:

(35) "I dislike biology," Tom said lifelessly.
     "All my employees have quit", said Tom helplessly.
     "I am not 3.14 years old", Tom said unpiously.
     "They had to amputate him at the shoulder," Tom announced disarmingly.
     "NO, you fool!! It used to be a fundamental principle, but it isn't any
       more!" expostulated Tom Swift.
     "Yes, I will resume persistent questioning," replied Tom Swift.

As a final note, we should recognize that the use of Tom Swifties appears to implement a certain number of learning strategies. Thus, the following series, presented in order of appearance, shows the initiation and copying of a model based on domain relations:

(36) "I don't like computers," Tom said byte-ingly.
     "I like this song.  I should buy a copy," Tom noted.
     "I dislike biology," Tom said lifelessly.
     "I hate chemistry," Tom said acidly.
     "I like physics," Tom said energetically.
     "I also like math," Tom added.


Lessard, G. (1988) "Tom Swifties: analyse sémantique et formelle." Annual Meeting, Canadian Linguistics Association, Kingston, Canada.

Levison, M. and Lessard, G. (forthcoming) "A System for Natural Language Sentence Generation." To appear in Computers and the Humanities.

Mann, L. and Obler, L.K. (eds.) (1982) Exceptional Language and Linguistics. New York: Academic Press.

Sherzer, J. (1982) "Play Languages: with a Note on Ritual Languages." In: Mann & Obler (eds.), Exceptional Language and Linguistics, Academic Press, 1982, pp175-199.

Sleeman, D., Brown, S. (1982) Intelligent Tutoring Systems. New York: Academic Press.