Inspiration

A friend in a start-up company was telling me about writing text for his product and the difficulty of crafting quality content, while also including keywords for search engine optimization and managing character counts.

A tool to automatically track keyword usage and other statistics would let him focus on making the content appeal to human readers.

His process reminded me of how I used to composed sentences with spelling words to dictate to my language arts students. Trying to cram up to twenty spelling words in five original sentences every day for years was a mental workout. At least those sentences didn't have to fit together! I also assigned my students vocabulary words to use in compositions. A tool to automatically highlight those vocabulary words would have made grading those compositions much easier.

What it does

You configure the block for a pair of fields in an Airtable base: one field for the text content, and another field with a list of keywords. As you work with a record, the block shows which keywords exist in the text content, including a count of how many times each keyword appears and a color-coded view of the text with each keyword highlighted.

How I built it

I had the idea for this custom block only a few days before the deadline for the Custom Blocks contest. In order to develop this block quickly, I leveraged one of my existing custom blocks as a template. Other than a few minor text changes, I only had to focus on the single file that calculates the keyword statistics.

As I had a fast-approaching fixed deadline, I used an iterative development approach, rather than a waterfall process. I started with essentials first: identifying character and keyword counts. Then I circled back and put keywords in bold and required keywords to appear at the beginning of a word boundary. Then I circled back and let users pick a color for keywords used instead of making the keywords bold, and I added support for accented characters. Then I circled back and let users pick two colors: one for the used keywords and another for unused keywords.

Challenges I ran into

In order to color-code keywords, I had to insert html tags into the text string. Those html tags included words like "span", "style", and "color", which could also end up as keywords. As I added the html tags, I had to figure out a way to exclude keywords that were part of an html tag and not in the original text.

Accomplishments that I'm proud of

I'm proud that I was able to to incorporate last-minute feedback provided from a remote beta tester over the phone.

What I learned

Regular expressions have trouble identifying word boundaries in Asian characters, even if there are spaces between words.

What's next for Keyword Counter

In addition to knowing which keywords are used in the text, it would also be useful to know statistics about the other words in the passage, such as identifying the most frequently used words (even if they aren't keywords).

Built With

Share this project:

Updates