Polish your Data with Auto-Tagging

The other day a friend of mine watched as I imported 7,000 support tickets from Jira into Airtable and then auto-tagged them in less than a minute. He was amazed; I was yawning.

I suppose it’s a pretty cool thing, but we often get good at something(s) and forget about how much time they save and possibly how much more useful the data becomes when we attend to the seemingly little things like consistent keyword tagging through automation.

I use my Airdrop framework to do this - it’s a simple script management system that allows me to use ordinary javascript functions in Google Apps Script (or in Airtable) to perform acrobatics on Airtable data and all without setting up a new API app every time I need a new API process. But I think you can also do this through Zapier, Integromat and your own API code of course.

Airdrop allows me to frame an API process in a pseudo-code script like this:

Once this script is made “active”, Airdrop will run this function passing the support Titles field values and getting back the comma-delimited keyword tag list and finally, dropping the results into the Tags field.

The function references a list of stopwords (cCommonWords) which is an array of commonly used words that are non-operative and should be disregarded as tags. I’ll publish that below along with the text of the javascript function itself.

Enjoy…

var cCommonWords = ["0","1","2","3","4","5","6","7","8","9","a","about","above","after","again","against","all","am","an","and","any","are","aren't","as","at","be","because","been","before","being","below","between","both","but","by","can't","cannot","could","couldn't","did","didn't","do","does","doesn't","doing","don't","down","during","each","few","for","from","further","had","hadn't","has","hasn't","have","haven't","having","he","he'd","he'll","he's","her","here","here's","hers","herself","him","himself","his","how","how's","i","i'd","i'll","i'm","i've","if","in","into","is","isn't","it","it's","its","itself","let's","me","more","most","mustn't","my","myself","no","nor","not","of","off","on","once","only","or","other","ought","our","ours", "ourselves","out","over","own","re","re:","same","shan't","she","she'd","she'll","she's","should","shouldn't","so","some","such","than","that","that's","the","their","theirs","them","themselves","then","there","there's","these","they","they'd","they'll","they're","they've","this","those","through","to","too","under","until","up","very","was","wasn't","we","we'd","we'll","we're","we've","were","weren't","what","what's","when","when's","where","where's","which","while","who","who's","whom","why","why's","with","won't","would","wouldn't","you","you'd","you'll","you're","you've","your","yours","yourself","yourselves"];

//
// tags extractor 
//
function tagExtractor(str)
{
  
  // make sure we're dealing with a clean text string
  str = str.toString().toLowerCase().replace(/[^\w\d ]/g, '');
  
  // tokenize the string
  var aTokens = str.split(' ');
  
  // remove all the stop-words while creating the tags list
  var aTags = [];
  for (var i in aTokens)
  {
    if ((cCommonWords.indexOf(aTokens[i]) === -1) && (aTags.indexOf(aTokens[i]) === -1))
      aTags.push(aTokens[i]);
  }
  
  // return a string (because Airtable's multi-select doesn't support dynamic creation of new tags)
  return(aTags.toString());
  
}
3 Likes

Nice :slight_smile:

JB