Skip to content
Sam Davis edited this page Jul 21, 2015 · 1 revision

Welcome to the grammaR wiki!

I'm still relatively new to GitHub, so bear with me. I'm also not as familiar with MarkDown as I like the DokuWiki style better. Oh well.

What is grammaR?

It's an R package with a goal: to help you (really, me) write generative fiction. I have cobbled together this code as I've worked on my hobby for a while, and I decided to put it into a package to make it easier for me to use, as well as perhaps enticing others who are interested. The premise is simple. When we write -- which many of us do frequently, we're often recycling words, concepts, and arguments. Especially in science. For example, every scientific paper has the general format: Introduction, Methods/Materials, Results, Discussion, References. Within those, there are often structures as well, e.g., the introduction usually starts broad and narrows. If you're publishing three papers on the same topic, your intros might all look the same.

But what if there was a way to write it once, and then be able to spit out 20 different versions of it with a computer? Select the one you like best, and BOOM! your paragraph is done. Not quite an article spinner, because it's not meaningless dribble, nor is it a cheap attempt to get page views. After all, you pick the words. You write the code. It is still your work. You might be thinking something like a "random picker" -- and yes, that's basically the idea. But my random picker is also recursive, and follows the rules of a context-free grammar. If you don't know what CFG is, I'll refer you to my [http://ecology.rocks/doku.php?id=blog:weekend_project_grammar](recent blog post) describing the grammar and how it works.

What grammaR Does

grammaR helps you focus on the writing. Or, it should, when I'm done with it. Right now, it kinda streamlines the process. Basically, grammaR will do things like:

  • Help build "dictionary" entries
  • Combine text files
  • Use Perl and OCaml to generate and process a grammar
  • Call ImageMagick on a set of stock images to turn them into ebook covers
  • Split and combine "dictionary" entries into and out of their key/value format and into vectors
  • Look at a piece of writing and use your custom dictionary to insert keys where values exist, e.g., "He ate the broccoli" reverts to "He ate the ", allowing the computer to pick from a list of vegetables every time the grammar is compiled.

What I want grammaR to do next

  • Convert the grammars in-house, instead of relying on perl and OCaml
  • Provide command-line, interactive tools for R-newbies to play around at being writers.
  • Easy interface for me to write
  • Support for citations

What grammaR will not do for you

  • Write. It will not generate content. That's on you.
  • Publish. I have zero plans for grammaR to be able to push files to any sort of server.