Past projects: Style guide bot

I’m catching up on some recent projects before moving on to the next wave of stuff. First, a Slack bot I built for Pacific Standard.

Every newsroom has a large, detailed style guide, a document that outlines preferred spellings, formatting and other guidelines for writing and editing stories. These documents are static and underutilized. I wanted to build a tool that would make Pacific Standard’s more accessible to the newsroom.

The problem: Every piece of information in the style guide is crucial, but it’s hard for reporters on deadline to find and search through such a large reference for the one detail they need to check.

The solution: Supplement the style guide document with something that brings only the most relevant information into an existing newsroom workflow.

Implementation: The finished product needed three parts: A database of terms linked with entries, a newsroom-facing interface and a way for editors to make changes. To make the database, I converted a Word document of the style guide into a Python dictionary for testing, which meant finding the right set of format, spacing and length rules that would cleanly pull out terms and entries from a block of text. Once the hard part was over, I moved the dictionary to a PostgreSQL database.

I chose Slack for the user interface. It’s a tool that the newsroom was already comfortable using and one that editors and reporters use throughout the process of building a story. Using a Flask server, I set up a bot that listens for a keyword in the main editorial channel and in direct messages. Writers send the bot terms, and it either returns the corresponding entry or gives a list of close and partial matches to try. The editing tools use a similar keyword system, allowing editors to add, edit and delete entries directly in Slack.

Challenges: Finding the right set of rules to convert a Word document to a dictionary took a lot of time. A large, clean dataset or a style guide formatted with this sort of use in mind would make the process faster than brute force trial and error.

Further work: Setting up an automatic connection between the style guide document and the Slack bot would remove the need for editing tools, and it would take out the redundant step of making changes in both. Outside of Slack, a tool that scans drafts and flags style guide errors could speed up the editing and remove the need for a manual reference.

If you’d like to know more, email me at or find me on Twitter.