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 1 month agoThu, 03 Jan 2019 00:45:25 -0800 | Last update 1 month agoMon, 14 Jan 2019 14:31:27 -0800

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

164 views, 1 RAMs, 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 (1 month ago)
🐏 ⨉ 1
Posted by August R. Garcia 1 month ago

Edit History

• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
• [2019-01-03 0:45 PST] August R. Garcia (1 month ago)
🕓 Posted at 03 January, 2019 00:45 AM PST
Profile Photo - August R. Garcia August R. Garcia Posting on Internet... Portland, OR
🗎 60 🗨 481 🐏 86
Site Owner

Grahew Mattham

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" attributeproxies, regular expressions, sin, and probably some other trash.

Account created 2 months ago.
60 posts, 481 comments, and 86 RAMs.

Last active 1 day ago:
Commented in thread [Master Thread] Notifications for Scheduled Downtime

Post a New Comment

To leave a comment, login to your account or create an account.