Open serin-delaunay opened 4 years ago
First step is getting pytracery to assign a unique path to each choice made in expanding the grammar. This is mostly done, but some assignment syntaxes produce an empty path for some reason. The code's jumping around in one file a lot, so I'm going to have to debug this in pycharm.
Fixed! I wasn't passing path information through grammar.flatten()
I've got a basic version working! Due to laptop issues I'm coding on an offline device, so no preview for now. To-do list:
Preview after the easier tasks above are completed, using the grammar from https://twitter.com/BokuWaKinoDesu :
A Lovely Country.
An Awful Country.
A Country That Longs For Favoritism.
A Country That Longs For Determination.
A Country Where Tournaments Age.
A Country Where Tournaments Walk.
A Country Where Wars Walk.
A Country Where Everything Is Destroyed.
The Country Of The Indefatigable.
The Country Of Shopkeepers That Read.
A Country Where Everyone Is Registered.
A Country Where Everyone Tells Hysterical Aristocrats That Normal Soldiers Must Oppress Rabbits Who Are Popular.
A Country Where Everything Is Registered.
A Country That Longs For Forgiveness.
An Indolent Country.
A Flaky Country.
I think this is a reasonably-themed grammar to use for this concept, but I have some different plans (and this grammar has some bugs and other undesirable qualities because I was still learning tracery).
I've got a grammar written and it's looking good!
Preview without weird punctuation:
they dash under a grammar pyramid despite you boulder
they trudge under a grammar pyramid despite you boulder
they trudge to a grammar pyramid despite you boulder
they trudge to a grammar pyramid despite you trudge
they trudge to a grammar pyramid despite you trudge or we and me slide through birmingham
they trudge to a grammar pyramid despite you trudge or Kelsey and me slide through birmingham
they trudge to a grammar pyramid despite you trudge or Kelsey and me slide through here
they trudge to the word tree despite you trudge or Kelsey and me slide through here
they trudge to the word tree despite you trudge following them or Kelsey and me slide through here
they trudge to a phrase structure despite you trudge following them or Kelsey and me slide through here
they trudge to a phrase structure despite you trudge following them or Kelsey and me slide through a word tree
they trudge to a phrase structure despite you trudge following them unless I bumble through the phrase diagram
they trudge to a phrase structure despite you trudge following them unless you bumble through the phrase diagram
they trudge to a phrase structure despite you trudge following them unless you sprint through the phrase diagram
they trudge to a phrase structure despite you trudge following them unless you sprint past the phrase diagram
they trudge to a phrase structure
we and you and Kaden trudge to a phrase structure
we and you and Kaden trudge with Evelyn
we and you and Kaden trudge
we and them and Kaden trudge
we and them and us trudge
we and you and you and Giovanni trudge
Antonio and us trudge
Alex and us trudge
with weird punctuation:
Alicia and me swagger next to, the parse structure unless you backpack far. from the sentence structure or. Kevin and us. paddle through there but. they stroll or we traipse like you and you and them you. ride and. Alicia and me! swagger next (to the parse) structure unless you (backpack far from the sentence structure or Kevin and us paddle through there but they stroll or we traipse like "you" and me and them you ride and Alicia and me swagger next to a phrase pyramid unless you backpack far from the) sentence structure. or Kevin and. us paddle. through there.
but they "stroll or we traipse like you and" me and them you. ride and Alicia and me swagger next to (a phrase pyramid (unless you backpack far from) the sentence) structure - or Kevin and us paddle through there but they stroll or I and Johnathan traipse like, you. and me and them, you ride and Alicia and me swagger next to a phrase pyramid unless?
I think I prefer the weird punctuation one, but there's no reason not to generate both.
They need a bit of capitalisation.
It's done! Before the deadline! Just gotta get it uploaded :)
Grammar: https://github.com/serin-delaunay/mutatery-nngm-2019/blob/master/definite_actual_grammar.json
It's a bit weird for a Tracery grammar - It generates sentences from the inside out, starting with a basic SP VP phrase and wrapping layers around it. Ordinarily this wouldn't be necessary, but doing this affects the structure of the syntax tree space that this generator randomly walks in, allowing the inner words to be preserved when the surrounding phrase elements are mutated.
Being in a rush, I forgot to use the nice capitaliser on the unpunctuated version or add full stops. Whoops!
I like the way https://www.naturalreaders.com/online/ attempts to interpret the punctuated version! Might work for other NNGM entries as well.
I don't know if I'll have time to finish this during the 11 hours remaining (it has been a busy November), but I plan to modify https://github.com/aparrish/pytracery so that I can save a tracery-generated syntax tree and randomly modify a single node (and generate any necessary descendants). Then I'll generate a sequence of phrases randomly walking around the state space of a tracery grammar. Not sure which grammar, probably something recursive!
I might also generate an independent random sequence of punctuation and intersperse that to break up the sentences and exploit any ambiguities in the text.
No repo yet!
=====================
Repository: https://github.com/serin-delaunay/mutatery-nngm-2019 Plain: https://github.com/serin-delaunay/mutatery-nngm-2019/blob/master/story.txt Punctuated: https://github.com/serin-delaunay/mutatery-nngm-2019/blob/master/story_punctuated.txt