3. Plan
1) Prepare list of buzzwords
2) Prepare rhymes
3) Generate base from given number of syllables in lines and number of lines
4) Find list of rhymes for generated base
5) Fill poem base with buzzwords from given rhyme scheme and base
3
4. Algorithm
1) Knowing the total number of syllables in each line — generate all combinations
of sums (compositions) from all available number of syllables.
Compositions of 3:
1 + 1 + 1
1 + 2
2 + 1
3
NB: Each positive integer n has 2 ** (n - 1) distinct compositions.
4
5. Algorithm
2) Knowing the number of syllables in each line, generate the base (I call it so) for
future poem from random compositions for each number of syllables.
E.g. for number of syllables in lines [4, 4], poem base is:
1, 2, 1
1, 3
5
6. Algorithm
3) After generating of poem base and known rhyme scheme — find rhymes.
For poem base:
1, 2, 1
1, 3
and rhyme scheme AA (i.e. first and second lines rhyme with each other).
To prepare rhymes get only last values (here 1, 3), because only the last words
form a rhyme.
I.e. for the poem above find rhymes for words with number of syllables 1, 3.
Storm and Ter-ra-form are fit.
6
7. Algorithm
4) Fill the poem base with buzzwords. Insert the rhymes found in previous step.
1, 2, Storm
1, Ter-ra-form
Fill the remaining values with not used buzzwords:
Go Sca-la Storm
Vault Ter-ra-form
7