"""
{ "origin": "I have two pets: a #pet# and a #pet#"
, "pet": ["cat","dog","fish","parrot"]
}
"""
|> generate
--> "I have two pets: a fish and a cat"
Definitions may also be recursive.
"""
{ "origin": "I have #pets#"
, "pets": ["a #pet#","a #pet# and #pets#"]
, "pet": ["cat","dog","fish","parrot"]
}
"""
|> generate
--> "I have a cat and a dog"
You can define constants by providing a string instead of a list.
"""
{ "origin": "My #favoritePet# is the best #favoritePet# in the world"
, "favoritePet" : "#pet#"
, "pet": ["cat","dog","fish","parrot"]
}
"""
|> generate
--> "My fish is the best fish in the world"
You may define sub-definitions to organize your definitions.
"""
{ "origin": ["My #cat#","My #dog#"]
, "cat":
{ "origin":"cat is named #name#"
, "name": ["Cleopatra","Cesar"]
}
, "dog":
{ "origin":"dog is named #name#"
, "name": ["Athena","Zeus"]
}
}
"""
|> generate
--> "My dog is named Athena"
Turns a tracery json-string into a generator
A tracery json is a object that has a
originfield.You can reference other fields using
#..#Definitions may also be recursive.
You can define constants by providing a string instead of a list.
You may define sub-definitions to organize your definitions.