A Rust implementation of the story-grammar generation library Tracery (https://github.com/galaxykate/tracery)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.0 KiB

define this | define this | | V V "animal": ["dog", "cat"] ^^^^^^^^^^^^^^ | define this

definitions are always valid json files (why?)

existing syntax

pluralize with .s

"sentence": ["the #animal.s# were in the garden"], "animal": ["dog", "cat"] ==> "the dogs were in the garden"

singular with .a

"sentence": ["#animal.a# was in the garden"], "animal": ["dog", "cat", "eagle"] ==> "an eagle was in the garden"

past tense with .ed

"sentence": ["he #action.ed# in the park"], "action": ["sprint", "walk", "stroll"] ==> "he walked in the park"

proposed syntax

  • name instances of words with the = syntax
  • all variables begin with the @ symbol
  • there's logic available to exclude particular lookup values (e.g. the ! syntax)

"sentence": ["#animal=@pet# made a #@pet.noise# another animal is #animal:!@pet#"]

  • definitions can have attributes and default attributes

"animal": {"__list": ["dog", {"noise": "bark"}, "cat", {"noise": "meow"}], "noise": "screech"},