Starter modules for doing Expressionist-based live text generation in games
Before using Reductionist (reductionist.py), you'll need to install the Python package marisa_trie. If you're on a Mac, you can simply use this terminal command from any directory on your computer:
sudo pip install marisa-trie
If you're on a different OS, or if that didn't work, follow the installation instructions given here: https://pypi.python.org/pypi/marisa-trie.
Reductionist semantically indexes your Expressionist grammar to produce the two files that are needed by Productionist to operate:
- A grammar file (.grammar)
- An expressible-meanings file (.meanings)
What follows are examples of usage of the command-line interface to reductionist.py. You can also run this command to access help information:
python reductionist.py -h
To index a grammar, use a command like this:
python reductionist.py "myContentBundle" /path/to/directory/with/your/expressionist/grammar /path/to/write/output/files/to --verbosity=1
This will cause Reductionist to semantically index your Expressionist grammar, which will create two new files in the specified output directory. In this example, these files would be written to:
- Grammar file: /path/to/write/output/files/to/myContentBundle.grammar
- Expressible-meanings file: /path/to/write/output/files/to/myContentBundle.meanings
What follows are examples of usage of the command-line interface to productionist.py. You can also run this command to access help information:
python productionist.py -h
Note: Productionist expects a set of files that are generated by Reductionist, which means Reductionist has to be used first to convert a content pool into a single tagged grammar and index that grammar.
To submit a content request to Productionist, use a command like this:
python -i productionist.py "myContentBundle" /path/to/reductionist/output/files --must_have="Tagset2:tag99,Tagset3:tag22" --must_not_have="Tagset7:tag33" --scoring_metric="Tagset2:tag11*-2,Tagset1:tag0*4" --n=10 --repetition_penalty --verbosity=1