Giter Club home page Giter Club logo

sharpspin's Introduction

Recursive {Content|Text|Article} Spinner Algorithm

Effortlessly create variations of your text, either for possible SEO benefit or to simply keep things fresh for your users by reducing content redundancy.

So this SEO copywriter walks into a {bar | pub} for a {drink | beer | cocktail}.


Features

  • Simple consistent spin syntax
  • Supports unlimited nested spin choices
  • 100% Unit Test Code Coverage
  • Very fast

How to use

var spun_text = Spinner.Spin("The {quick|fast} brown fox jumped over the lazy dog.");

Quick Guide to Spinning Syntax

Nested Spinning Vs. Flat Spinning

There are 2 types of spinning - flat spinning (Jet format) and nested spinning. Flat spun content only has one level of spinning, while a nested spun format allows you to spin phrases within phrases.

Sample sentence

The quick brown fox jumped over the lazy dog.

###Flat Spinning

The {quick|fast} brown fox jumped over the lazy dog.
Example nested spun variations
  • The quick brown fox jumped over the lazy dog.
  • The fast brown fox jumped over the lazy dog.

###Nested Spinning

The {quick {brown|red}|smart} fox jumped over the lazy dog.
Example nested spun variations
  • The quick brown fox jumped over the lazy dog.
  • The quick red fox jumped over the lazy dog.
  • The smart fox jumped over the lazy dog.

###Complex Nested Spinning

{The {quick|fast|speedy} brown fox {jumped|leaped|hopped} {over|right over|over the top of} 
the {lazy|sluggish|care-free|relaxing} dog.|{While|Although} just {taking|having} 
a{| little| quick} {siesta|nap} the dog was {startled|shocked|surprised} by a {quick|fast|speedy} 
{brown|dark brown|brownish} fox that {leaped|jumped} right {over|over the top of} him.}
Yes, you can do things like this:
{a|b{c|d{e|f{g|h{i|j{k|l{m|n{o|p{q|r{s|t{u|v{w|x{y|z}}}}}}}}}}}}}
Pro Tip

If you use nesting wisely, you get {a wide variety of|very different} content.

  1. Spin first at the paragraph level. If you divide your content into stand alone paragraphs on the same subject and write enough paragraphs, you can easily make paragraph-based spun content.
  2. Then rewrite every sentence of every paragraph 3 times. This is your second spin level within the paragraph level.
  3. Third you can spin words within the sentences with synonym replacements (at least every other fourth word).
  4. Set a few of the sentences or paragraphs to optional for even more variation.

If you follow this advice, you will get highly different output that will stay readable.


Documentation

Options:

You can use custom section {} and option | delimeters if you'd like. For example it's possible to do something like this:

The [quick~fast] brown fox jumped over the lazy dog.
Methods:
  • Spin (string content)

    • summary:

      • Takes a string of text and recursivly spins it returning the output as a string.
    • content: string

      • Text string to spin.
    • example:

       var spun_text = Spinner.Spin("The {quick|fast} brown fox jumped over the lazy dog.");
      

License

(The MIT License)

Copyright (c) 2011 Daniel Lamb <daniellmb.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sharpspin's People

Contributors

daniellmb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sharpspin's Issues

result of total permutation is not correct

string stringToSpin = "{quick|fast} {1{a|b}|2}."; var total_spun_text = Spinner.Permutations(stringToSpin); Console.WriteLine("total spun: " + total_spun_text);

above code give me total spun: 8

does it should be just 6?

  1. quick 1a
  2. quick 1b
  3. quick 2
  4. fast 1a
  5. fast 1b
  6. fast 2

show all possible spun texts

anyone can help me how to show all possible spun texts?

for example the spintax is "fox {1{a|b}|2}"

i wan to show for all possible spun texts, which is:

  1. fox 1a
  2. fox1b
  3. fox2

using Spintax.spin is only give me 1 result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.