{'fraction_non_alphanumeric': 0.02846222655932341, 'fraction_numerical': 0.005448483369927625, 'mean_word_length': 5.192346424974824, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
HAHAcronym: A Computational Humor System

Computational humor will be needed in interfaces, no less than other cognitive capabilities. There are many practical settings where computational humor will add value. Among them there are: business world applications (such as advertisement, e-commerce, etc.), general computer-mediated communication and human-computer interaction, increase in the friendliness of natural language interfaces, educational and edutainment systems. In particular in the educational field it is an important resource for getting selective attention, help in memorizing names and situations etc. And we all know how well it works with children.Automated humor production in general is a very difficult task but we wanted to prove that some results can be achieved even in short time. We have worked at a concrete limited problem, as the core of the European Project HAHAcronym. The main goal of HAHAcronym has been the realization of an acronym ironic re-analyzer and generator as a proof of concept in a focalized but non restricted context. To implement this system some general tools have been adapted, or developed for the humorous context. Systems output has been submitted to evaluation by human subjects, with a very positive result.


Introduction
Society needs humor, not just for entertainment. In the current business world, humor is considered to be so important that companies may hire humor consultants. Humor can be used "to criticize without alienating, to defuse tension or anxiety, to introduce new ideas, to bond teams, ease relationships and elicit cooperation".
As far as human-computer interfaces are concerned, in the future we will demand naturalness and effectiveness that require the incorporation of models of possibly all human cognitive capabilities, including the handling of humor (Stock, 1996). There are many practical settings where computational humor will add value. Among them there are: business world applications (such as advertisement, ecommerce, etc.), general computer-mediated communication and human-computer interaction, increase in the friendliness of natural language interfaces, educational and edutainment systems.
Not necessarily applications need to emphasize interactivity.
For instance there are important prospects for humor in automatic information presentation. In the Web age presentations will become more and more flexible and personalized and will require humor contributions for electronic commerce developments (e.g. product promotion, getting selective attention, help in memorizing names etc) more or less as it happened in the world of advertisement within the old broadcast communication.
Little published research exists on whether humor is valuable in task-oriented human-computer inter-action (HCI). However (Morkes et al., 1999) did some experiments concerning the effects of humor in HCI and computer-mediated communication situations. Especially in computer-mediated communication tasks, participants who received jokes rated the "person" or computer they worked with as more likable and competent, reported greater cooperation, joked back more often etc. The experiments show that, humor enhances the likeability of an interface "without distracting users".
There has been a considerable amount of research on linguistics of humor and on theories of semantics or pragmatics of humor (Attardo, 1994). Within the artificial intelligence community, most writing on humor has been speculative (Hofstadter et al., 1989). Minsky (Minsky, 1980) made some preliminary remarks about formalizing some kind of humor within an artificial intelligence/cognitive science perspective. He refined Freud's notion that humor is a way of bypassing our mental "censors" which control inappropriate thoughts and feelings (Freud, 1905). So far, very limited effort has been put on building computational humor prototypes. The few existing ones are concerned with rather simple tasks, normally in limited domains. Probably the most important attempt to create a computational humor prototype is the work of Binsted and Ritchie (Binsted and Ritchie, 1994). They have devised a model of the semantic and syntactic regularities underlying some of the simplest types of punning riddles. A punning riddle is a question-answer riddle that uses phonological ambiguity. The three main strategies used to create phonological ambiguity are syllable substitution, word substitution and metathesis. In general, the constructive approaches are mostly inspired by the incongruity theory (Raskin, 1985), interpreted at various level of refinement. The incongruity theory focuses on the element of surprise. It states that humor is created out of a conflict between what is expected and what actually occurs when the humorous utterance or story is completed. In verbal humor this means that at some level, different interpretations of material must be possible (and some not detected before the culmination of the humorous process) or various pieces of material must cause perception of specific forms of opposition. Natural language processing research has often dealt with ambiguity in language. A common view is that ambiguity is an obstacle for deep comprehension. Exactly the opposite is true here.
The work presented here refers to HAHAcronym, the first European project devoted to computational humor (EU project IST-2000-30039), part of the Future Emerging Technologies section of the Fifth European Framework Program. The main goal of HA-HAcronym was the realization of an acronym ironic re-analyzer and generator as a proof of concept in a focalized but non restricted context. In the first case the system makes fun of existing acronyms, in the second case, starting from concepts provided by the user, it produces new acronyms, constrained to be words of the given language. And, of course, they have to be funny.
HAHAcronym, fully described in (Stock and Strapparava, 2003) (Stock and Strapparava, 2005), is based on various resources for natural language processing, adapted for humor. Many components are present but simplified with respect to more complex scenarios and some general tools have been developed for the humorous context. A fundamental tool is an incongruity detector/generator: in practice there is a need to detect semantic mismatches between expected sentence meaning and other readings, along some specific dimension (i.e. in our case the acronym and its context).

The HAHAcronym project
The realization of an acronym re-analyzer and generator was proposed to the European Commission as a project that we would be able to develop in a short period of time (less than a year), that would be meaningful, well demonstrable, that could be evaluated along some pre-decided criteria, and that was conducive to a subsequent development in a direction of potential applicative interest. So for us it was essential that: 1. the work could have many components of a larger system, simplified for the current setting; 2. we could reuse and adapt existing relevant linguistic resources; 3. some simple strategies for humor effects could be experimented.
One of the purposes of the project was to show that using "standard" resources (with some extensions and modifications) and suitable linguistic theories of humor (i.e. developing specific algorithms that implement or elaborate theories), it is possible to implement a working prototype. For that, we have taken advantage of specialized thesauri and repositories and in particular of WORDNET DO-MAINS, an extension developed at ITC-irst of the well-known English WORDNET. In WORDNET DOMAINS, synsets are annotated with subject field codes (or domain labels), e.g. MEDICINE, ARCHI-TECTURE, LITERATURE,. . . In particular for HA-HAcronym, we have modelled an independent structure of domain opposition, such as RELIGION vs. TECHNOLOGY, SEX vs. RELIGION, etc. . . , as a basic resource for the incongruity generator. Other important computational tools we have used are: a parser for analyzing input syntactically and a syntactic generator of acronyms; general lexical resources, e.g. acronym grammars, morphological analyzers, rhyming dictionaries, proper nouns databases, a dictionary of hyperbolic adjectives/adverbs.

Implementation
To get an ironic or profaning re-analysis of a given acronym, the system follows various steps and relies on a number of strategies. The main elements of the algorithm can be schematized as follows: • acronym parsing and construction of a logical form • choice of what to keep unchanged (for example the head of the highest ranking NP) and what to modify (for example the adjectives) • look for possible, initial letter preserving, substitutions using semantic field oppositions; reproducing rhyme and rhythm (the modified acronym should sound as similar as possible to the original one); for adjectives, reasoning based mainly on antonym clustering and other semantic relations in WORDNET. Making fun of existing acronyms amounts to basically using irony on them, desecrating them with some unexpectedly contrasting but otherwise consistently sounding expansion.
As far as acronym generation is concerned, the problem is more complex. We constrain resulting acronyms to be words of the dictionary. The system takes in input some concepts (actually synsets, so that input to this system can result from some other processing, for instance sentence interpretation) and some minimal structural indication, such as the semantic head. The primary strategy of the system is to consider as potential acronyms words that are in ironic relation with input concepts. Structures for the acronym expansion result from the specified head indication and the grammar. Semantic reasoning and navigation over WORDNET, choice of specific word realizations, including morphosyntactic variations, constrain the result. In this specific strategy, ironic reasoning is developed mainly at the level of acronym choice and in the incongruity resulting in relation to the coherently combined words of the acronym expansion.

Examples and Evaluation
Here below some examples of acronym re-analysis are reported. As far as semantic field opposition is concerned, we have slightly biased the system towards the domains FOOD, RELIGION, and SEX. For each example we report the original acronym and the re-analysis. We note that the system tries to keep all the expansions of the acronym coherent in the same semantic field of the main concepts. At the same time, whenever possible, it exploits some incongruity in the lexical choices.

ACM -Association for Computing Machinery
Testing the humorous quality of texts or other verbal expressions is not an easy task. There are some relevant studies though, such as (Ruch, 1996). For HAHAcronym an evaluation was set with a group of 30 American university students. They had to evaluate the system production (80 reanalyzed and 80 generated acronyms), along a scale of five levels of amusement (from very-funny to not-funny). The results were very encouraging. The system performance with humorous strategies and the one without such strategies (i.e. random lexical choices, maintaining only syntactic correctness) were totally different. None of the humorous re-analyses proposed to the students were rejected as completely nonhumorous. Almost 70% were rated funny enough (without humorous strategies the figure was less than 8%). In the case of generation of new acronyms results were positive in 53% of the cases.
A curiosity that may be worth mentioning: HA-HAcronym participated to a contest about (human) production of best acronyms, organized by RAI, the Italian National Broadcasting Service. The system won a jury's special prize.

Conclusion
The results of the HAHAcronym project have been positive and a neat prototype resulted, aimed at a very specific task, but operating without restrictions of domain. It turns out that it can be even useful per se, but we think that the project opens the way to developments for creative language. We believe that an environment for proposing solutions to advertising professionals can be a realistic practical development of computational humor. In the log run, electronic commerce, for instance, could include flexible and individual-oriented humorous promotion.