256 Kilobytes

The Ultimate Guide to Spintax: Overview, Formatting, and Running Spintax in Google Sheets (and JavaScript in General)

Articles in Content Creation | By August R. Garcia

Published | Last Update

{What is|what's} the deal with {airline food|the food they give you on airplanes}?

6,165 views, 1 RAM, and 0 comments

A few weeks ago, Hash Brown posted a guide on how to generate bulk content with a variety of different terms using Excel, which can be found here:

As noted in a comment/reply to that article:

Also, this post reminds me of some code for running spintax in Google Sheets (or anywhere that JavaScript can be used). Will post as an article when I have a minute. Easily able to be combined with your method here if/when variance desired in the output.

The Ultimate Guide to Spintax

What is content spinning?

Content spinning is the act of randomizing content in a way that changes the phrasing, but that keeps the same meaning. This can be done in a fully-automated way, where a robot throws a thesaurus at your content, or it can be done with input from a human using what is know as spintax.

Depending on how the spin is performed, some spins may be grammatically incoherent, while others may be completely legiible rephrasings.

What is Spintax?

Spintax is a way of communicating to a content spinner how to spin the content. It can be used to achieve spins that are more readable and coherent than automated spins. The tool below can be used to run spintax.

An example of spintax is shown below.

Spintax Formatting

Spintax formatting consists of wrapping specific words or terms to spin in curly braces with different possible options for the output separated by the pipe character. For example:

  • Sentence with Spintax:
    • If {you are|you're} looking for an aquarium filter from {an award winning|a trusted|a reputable} {brand|company}, Coralife {has you covered|is a solid choice|is worth checking out}.
    Some Possible Outputs:
    • If you are looking for an aquarium filter from an award winning brand, Coralife is a solid choice.
    • If you're looking for an aquarium filter from an award winning company, Coralife has you covered.
    • If you're looking for an aquarium filter from a trusted brand, Coralife is worth checking out.

Some implementations of spintax may support other markup, such as nested spintax. Since spintax itself is a crime against god, it should be noted that there are no real standards for spintax beyond the basic syntax shown above.

Implementing Spintax in JavaScript

// @param   -- spintax. Required. String. A string of text marked up with spintax. 
// @example -- run_spintax("{What is|what's} the deal with {airline food|the food they give you on airplanes}?")
function run_spintax(spintax) { 

  // Define a variable to store a REGEX that will match all spintax instances  
  var regex = new RegExp(/{([^{}]+?)}/);

  // Loop through all spintax instances  
  while((to_spin = regex.exec(spintax)) !== null) { 
    // Break the current spintax match from a string into an array split on the pipe character
    opts = to_spin[1].split("|"); 

    // Get a random option from the spintax options
    random = Math.floor(Math.random() * opts.length); 

    // Replace the full spintax string with the chosen option 
    spintax = spintax.replace(to_spin[0], opts[random]); 
  return spintax;

Implementing Spintax in Google Sheets

Custom functions can be added to Google Sheets using the built-in script editor. Implementing this specific script is very straightforward:

  1. Open a Google Sheets file
  2. Go to Tools --> Script Editor
  3. Copy paste the code from the "Implementing Spintax in JavaScript" step into the script editor
  4. Press Ctrl+S to save the code
  5. Go back to the spreadsheet and enter this code into a cell to verify the function has been added:
    • =run_spintax("{Here|This} is {very nice|good|some} spintax{.|!}")

For more information on the specifics of Google Apps/Sheets Scripts, this link is a good place to start.

Users Who Have Downloaded More RAM:
Hash Brown (3 years ago)
🐏 ⨉ 1
Posted by August R. Garcia 3 years ago

Edit History

• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
• [2019-01-03 0:45 PST] August R. Garcia (3 years ago)
🕓 Posted at 03 January, 2019 00:45 AM PST

Read More:
Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account