Information Technology Reference
In-Depth Information
used and the domain boundaries provide an approximation to meaning. But poetic
text should exhibit certain features, such as regular metre and rhymes.
The next step deals with the evolution of the generated text, towards a poemwith a
stronger presence of those features. For this purpose, we developed three generation
strategies, each based on an evaluation function that scores lines regarding how well
they exhibit the target feature. The strategies are briefly described as follows:
Evolutionary (Ev): an initial population of n poems is generated with the basic
strategy. Each poem is scored with the evaluation function. New generations of
poems consist of those with the best evaluation among the population, new poems
created with the basic strategy, and some resulting from crossing two random
poems in the population—a descendent poem has the same configuration and
lines selected from both of its ancestors. In the end, the best scoring poem of the
last generation is returned. Evolution stops either after a predefined number of
generations or after m consecutive generations with the same best score.
Plain generate-and-test (G&T): for each line in a poem template, n random
sentences are generated, one after each other. The best scoring line is selected. All
unused sentences are indexed and can be picked later, if a new line needs exactly
the same number of syllables.
Generate-and-test + Evolutionary (G&T+Ev): similar to the evolutionary
approach except that poems in the initial population are created using the plain
G&T, typically with a lower n .
A comparison of poems generated with these strategies is provided in Sect. 12.5 .
In the remaining of this section, we describe how the poems can evolve towards the
desired metre and the presence of rhymes. All the examples were obtained with the
G&T approach, because this strategy generates poems with the correct metre more
consistently.
12.4.5.1 Matching the Metre
For matching the metre, it is enough to have an evaluation function that, for each
generated sentence, computes the absolute difference between their number of syl-
lables and the number of syllables in the target line of the template — the lower the
evaluation, the better the sentence is. Syllables Util is used to count the number of
syllables of each sentence and to identify its last stress. For a poem with n lines, this
evaluation function is formally:
n
Score metre
=
1 |
# syllables
(
sentence i
)
# syllables
(
target i ) |
i
=
To illustrate how metre is matched, we present a block of four, with 8 syllables
per line. It was obtained with the G&T strategy, with n
=
100,
ʴ =
1,
ʽ =
0
.
01.
desenhos retratos carretas
é da poesia das obras
Search WWH ::




Custom Search