Paprika is a language, and software, for generating semi-random arrangements of words - like computer-driven mad-libs. This can be useful for generating game dialogue, tweet bots, and flavour text which have spice and variety! Paprika (the software) takes a "request" and uses it to execute some "grammar" (grammars are the files which make up your random options). Better to show than to tell:
# Here's a grammar file. Hashes denote comments (lines the software should not read)
# Below is a "category", denoted with an asterisk:
* animal
cow
horse
mouse
* nice
lovely
delightful
amazing
If this grammar was loaded, the user could enter the following input to get the following example output:
Check out this [animal]
-> "Check out this cow"
My [animal] is [nice]
-> "My mouse is delightful"
If you run each command again, the output can be different, because the bits in [square brackets] are randomised.
The language has many more features than this, which you can explore at http://paprika.me.uk
Paprika.Net is the core functionality of the Paprika engine. It can load, parse, execute, and validate grammars and queries. It is well unit-tested in Paprika.NetTests. This project is available as a NuGet package as SteGriff.Paprika.Net.
Paprika.Net.Console is basically a desktop client for Paprika. It's a command line app which calls upon Paprika.Net, letting you play with and iterate your grammar files rapidly.
WIP
Install the NuGet package using Install-Package SteGriff.Paprika.Net
- Instantiate a
Coreobject usingvar engine = new SteGriff.Paprika.Net.Core(); - Load a grammar with
engine... - Parse a request with
engine.Parse("My query is [cool/nice]") - You can select specific values you want to use (instead of random ones) using an overload of
engine.Parse...
By default, the grammars are chosen from the paprika-grammar submodule (../../paprika-grammar/) but you can override this in App.config like so:
<appSettings>
<add key="GrammarRoot" value="C:/path/to/my/paprika-grammar/" />
</appSettings>
The specified directory must contain an index.grammar file.
- Build in Release Mode
- Publish from VS, not Nuspec
- Go to nuget.org Upload and upload the new package from the Build directory