\documentclass[a4paper]{article}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}
\usepackage{url}

\def\lmpoem{\textsf{Lingua::GMPoem}}
\def\gmp{generalized multi-poem}
\def\Gmp{Generalized multi-poem}
\begin{document}

\title{\lmpoem -- a tool to animate human written multi-poems}
\author{José João Dias de Almeida}
\date{\today}
\maketitle

\begin{abstract}
We will call \gmp{} to a literature resource that includes a definition
of variants of a poem (also a text, proverb, song) with simple constraints.

In this work we discuss a tool -- \lmpoem{} -- a toolkit
that randomly generate texts (Poem, proverb, etc) from a human
created \gmp{}.

The aimed of the tools is to foment the human creative-writing activities,
and the human analysis of the process involved.
\end{abstract}


\section{Introduction}
Creativity with computers is a subject where we often find
very different approaches, different intentions and strong opinions.

We believe that it can be useful to:
  . write tools to analyze good quality creative resources (related
to build models)
  . write tools to learn from several kinds of good  quality resources
(related to populate models data-bases / knowledge bases)
  . write tools to simulate human creativity (to understand the creativity
process)
  . write tools to assist in human creation
  . write tools to \emph{animate} in several ways human created artifacts
  . write tools, builds scenarios to foment human discussion,
and human creative experiments.
#

In this article we present a tool that has no intelligence, no creativity,
can not learn, is not capable of human analysis.

\lmpoem{} is just a tool that parse a \gmp{} file and produces a poem
-- a tool to animate \gmp{}.


\subsection{Some history about the project}

Some years ago I was going to present a Portuguese text2speech tool in a PLN
conference and I received an email-message from Miguel de Asén
challenging me to build a system for reading his Spanish generated sonnets!
His idea was to build a stand where poetry was present: poems continuously
being generated and declaim.

He sent me a his windows' poem-generation system, 16 multi-sonnets and
a brief explanation of his multi-sonnets model.

Miguel de Asén could not go to the conference, (in fact we have hot met yet)
and there was not a opportunity to try to build the stand,
but I was surprised to see the good quality of the generated sonnets.

Basically, Miguel's purpose for multi-sonnets is writing 4 compatible variants
of each verse\cite{miguel,miguel2}.

\begin{Verbatim}
  multi-sonnet → 4 × 14 verse
\end{Verbatim}
and the generate process random selects a verse from each group
\begin{Verbatim}
  generate:multi-sonnet → sonnet
  generate(ms)=  [ ms[i×4+rand(4)] | i ∈ [0..13] ]
\end{Verbatim}

The syntactical format he used for the multi-sonnets was the most
simple possible.
Following we show an extract of a multi-sonnets written by Miguel de Asén:
\begin{Verbatim}[numbers=left]
BANDO DEL SE
DESIGNIO DE UN VERSO
SINO DE UN SENTIR
ENTE PARA SENTIR FORJADO
Certero el abrazo del destino,
Cruel el impulso del desatino,
Umbrío el caminar, solo, vespertino,
Sombra, laguna anónima del sino,
cuando sentir a veces es morir,
cuando nos pesa también existir,
si no sabemos nuestra alma sentir,
cuando no sabemos ni que decir,
... 48 more lines
\end{Verbatim}
Where:
 . lines 1..4 are the variants of the title;
 . lines 5..8 are the variants of the verse 1 of strophe 1;
 . lines 9..12 are the variants of the verse 2 of strophe 1;
 . ... lines 57..60 are the variants of the verse 3 of strophe 4 of the sonnet.
#

With Miguel de Asén challenge, we soon realized and claim that:
 .1 Playing is an important learning tool.
 .1 One of the most important and fun parts of this exercise is to
write the multi-poems.
 .1 Writing new variants for an existing poem, or verse is a good challenge.
 .1 In order to assembly a multi-poem, the verses must follow \emph{verse
equivalence classes} sometimes connected to rhyme, part-of-speech, semantic
contents. It is important to understand and model verse equivalence classes.
 .1 The concept of multi-sonnet can be generalized do deal with other
domains.
 .1 A good verse good for one's soul.
#

~\\


In this work we discuss \lmpoem{} a toolkit that, starting from
a \gmp, generates one or more poems.

\Gmp{} include:
  . any kind of multi-poems (any number of strophes, with any number of
verses, with any number of variants)
  . proverbs, maxims\cite{proverbs};
  . prose;
  . multiple choice exercises; etc.
#

Mechanisms are provided to define simple coupling constraints, repetitions and
templating.



\section{\Gmp format}

A \gmp is a set a strophes separated by a line containing a "=":

\begin{Verbatim}
 GMpoem  = strophe ("\n=\n" strophe)*
\end{Verbatim}

Each strophe is formed by \emph{mverses} separated by empty lines.
A strophe can be saved in a variable, in order to provide strophe
repetitions.
\begin{Verbatim}
 strophe = mverses ("\n\n"  mverses)*
         | "s\d+=" strophe            ( save a strophe )
         | "+s\d+"                    ( repeat a previously save strophe )
\end{Verbatim}

Each \emph{mverse} is formed by \emph{verses}.
A mverses can be saved in a variable, in order to provide verse
repetitions.

\begin{Verbatim}
 mverses = verse   ("\n"    verse)*
         | (v\d+=) mverses            ( save a verse )
         | "+v\d+"                    ( repeat a previously save verse )
\end{Verbatim}

Optionally, verses may have a starting number to force subclasses:
during the random choice selection process, just verses with the some
number are possible.

\begin{Verbatim}
 verse   = ("\d+")? line              ( restricted agreement )
\end{Verbatim}

The verses may also contain inline verse alternatives.
Example of the inline alternative syntax:
\begin{Verbatim}
 sentence (alternative 1 | alternative 2 | ... ) continuation
\end{Verbatim}

As usually, comments are provided in \gmp{} format
(\verb!#.... to end of line!  and everything after \verb!__END__! is ignored).

\section{\lmpoem{} by example}


In the following examples we will focus in proverbs, maxims
anti-proverbs because they are short and very rich field.

\subsection{Proverbs, maxims and anti-proverbs}

\subsection*{\emph{Nobody is perfect}}
Starting from \emph{nobody is perfect}, we can build the following
\gmp\footnote{one strewth, tho verses}:
\begin{Verbatim}
 nobody
 no body
 no Linux programmer
 (no|nobody's) mother in law
 everybody

 is perfect
 knows the trouble I've seen
 is to blame for all
 has ever bet enough on a winning horse
\end{Verbatim}

This gmp will generate 24 (=6×4) anti-proverbs including for example
\:
. \emph{no body is perfect},
. \emph{no mother in law knows the trouble I've seen}.
#

The process of building an anti-proverb from proverb is a very good
creative-writing exercise. Some of the common building blocks are:
. similar proverbs cross merging,
. substitution by similar words or expression (nobody → no body),
. refinement with local domain concepts (nobody → no Linux programmer),
. negation (nobody → everybody) -- important things often make sense
after negation,
. explore ambiguity,
. adding mother-in-law...
#

Some of these building blocks can be use to automatically suggest promising
ant-proverbs candidates (this is not our focus!).

\subsection*{\emph{Early to bed, early to rise}}

The proverb / maxim \emph{Early to bed, early to rise}, often associated
with Benjamin Franklin, can easily originate several anti-maxims.

In order to correctly anti-maximize it, we need to control verses association in order
to keep rhyme, and sound semantics:
\begin{Verbatim}
 1 Early to bed, early to rise
 2 Late to bed, late to rise
 3 Late to bed, early to rise
 4 Early to rise, early to bed

 1 makes a man healthy, wealthy, and wise.
 1 ... dull isn't it?
 1 And your girl goes out with the other guys.
 1 makes sure you get out before her husband arrives.
 1 and I'm afraid you'll never meat Marilyn Monroe.
 1 what the (hell|fuck) is wrong with my life?
 2 makes a man diseased and that’s unwise!
 2 could be cardiometabolically unwise
 2 Who in the hell wants to be wise?
 2 what the (hell|fuck) is wrong with my life?
 3 leaves me with very tired eyes!
 4 makes a man healthy, (wise and|but socially) dead.
\end{Verbatim}

With this verse constraint numbers, we may obtain \emph{Early to bed, early to
rise, makes sure you get out before her husband arrives}, but can not generate
\emph{Early to bed, early to rise, makes a man healthy, but socially dead} \footnote{Although quite true, it would not rhyme.}.

\subsection*{\emph{Penso, logo existo}}

\begin{Verbatim}
Penso

logo existo
logo hesito
logo exausto
logo ferida
logo
\end{Verbatim}

\subsection{Experiences}

The use of \gmp{} in general poetry, can easily fall into
into too restrictive \emph{fake poetry}\cite{fakePoetry}.
Turing test games\cite{turingTest} often use rules and techniques that
are too predictable to constitute fair poetry.

The definition of a good \gmp{} plot is very important
for obtaining satisfactory results.

Consider the following poem from Luísa Ducla Soares\cite{diabrete},
\begin{Verbatim}
Ser um rapaz com juízo?
Ah, isso não é preciso!

É tão bom ser diabrete, pintar de verde o tapete.
É tão bom ser um mauzão, deitar pimenta no pão.
É tão bom ser um pirata, puxar o rabo da gata.
É tão bom ser um traquinas, despentear as meninas.
É tão bom ser um travesso, vestir tudo do avesso.
É tão bom ser um marau, pôr no lixo o bacalhau.
É tão bom ser desastrado, cair no lago calçado.
É tão bom ser malandrão, roer os ossos do cão.
É tão bom ser um maroto, pôr no prato um gafanhoto.
Tão bom ser insuportável, pisar um senhor notável.
Ser sempre inconveniente, ao careca dar um pente.
É tão bom ser mau, mau, mau, Soltar na aula um lacrau.

O pior é quando a mãe
resolve ser má também.
\end{Verbatim}
This poem has a clear structure \emph{star, (it is so good to be...)*, end}.
In this situation the \emph{(it is so good to be...)*} section is
a good candidate for good quality \gmp{}: elements are commutative,
small, and grammatically homogeneous.

We used a \gmp{} based on this poem to generate
a dynamic karaoke game: sing a song with unpredictable
generated lyrics.


\section{Conclusions}

The \gmp{} challenge is interesting and formative.

Playing with higher-order elements, is a good for learning abstraction,
language modeling
and understanding hidden rules.

\Gmp{} animation tools can help in building a viable
environment where people can assume creative roles.

\bibliographystyle{plain}
\bibliography{sant}

\appendix
\section{Infalible method to write (fake-)poetry}
Extracted from: Nueva introducción a la teoría de la literatura
\cite{fakePoetry}.

Consta de una introducción y siete breves reglas:

\begin{description}

\item[Introducción]. Para hacer un poema no es necesario esperar a que llegue ninguna inspiración especial, ni hace falta estar en ayunas, ni ninguna de esas condiciones que hacen falta siempre para las demás cosas. Basta aplicar las siete reglas siguientes.

\item[Primera]. Se cogen unas cuantas palabras, en sí mismo poéticas, y se van distribuyendo poco a poco entre las diferentes estrofas. Por ejemplo, susurro, desvelo, tintineo, alborada, crespones, aleteo, nenúfar, alondra, etc.

\item[Segunda]. Se cogen unas cuantas palabras más bien vulgares a las que se poetiza dándoles una terminación adecuada: pajarillo, arroyuelo, blanquecino, etc.

\item[Tercera]. Se forman unas cuantas parejas de diferentes colores, de modo que se contradigan lo más posible los colores de cada pareja: negro verdor, blanco escarlata, azul blanquecino, etc.

\item[Cuarta]. A unos cuantos verbos se les cambia de ocupación habitual, sin que se den cuenta. Por ejemplo: se cierran las sombras –en lugar de las puertas o ventanas-, se masca el silencio –en lugar de un buen filete-, se le clava un rejón al firmamento –en lugar de a un toro de trapío-, se borda un aciago destino –en lugar de un sufrido mantel-, etc.

\item[Quinta]. Se distribuyen también entre las estrofas unas cuantas palabras, de esas que a veces emplea la gente sin saber lo que quieren decir: enhiesto, hirsuto, inerme, inane, incólume, baldío, etc.

\item[Sexta]. Puede ir bastante bien, para lograr mayor fuerza poética, aprovechar algún pedacito de una poesía clásica conocida; así, a Rubén Darío, se le puede coger eso de los “claros clarines”.

\item[Séptima]. Si se encuentra a mano, algún estribillo, aunque sea cortito, para repetir entre cada dos estrofas, mejor que mejor.
\end{description}
\end{document}

