Superspin is a JavaScript library for spinning a text. This is useful for article generator that seed many alternative texts.
Node:
npm install superspin
Go:
go get -u github.com/raitucarp/superspin
Node/Javascript:
const Superspin = require('superspin');
const $superspin = new Superspin();
let str = 'Hello there. {You should eat {fruits, veggies and grains|veggies, fruits and grains|fruits, grains and veggies|grains, fruits and veggies|veggies, grains and fruits|grains, veggies and fruits} if you want to be healthy.|If you want to be healthy, you should eat {fruits, veggies and grains|veggies, fruits and grains|fruits, grains and veggies|grains, fruits and veggies|veggies, grains and fruits|grains, veggies and fruits}.}';
let spinText = $superspin.spin(str);
console.log(spinText)
Golang:
import "github.com/raitucarp/superspin"
func main() {
sp := superspin.New()
str := "Hello there. {You should eat {fruits, veggies and grains|veggies, fruits and grains|fruits, grains and veggies|grains, fruits and veggies|veggies, grains and fruits|grains, veggies and fruits} if you want to be healthy.|If you want to be healthy, you should eat {fruits, veggies and grains|veggies, fruits and grains|fruits, grains and veggies|grains, fruits and veggies|veggies, grains and fruits|grains, veggies and fruits}.}"
spinText := superspin.Spin(str)
}
That's it
new Superspin(openToken, closeToken, orToken)
default params:
- openToken = {
- closeToken = {
- orToken = |
Do spin a text with random seed. If withSeed set to true, then it will generate static result based on seed. Useful for a unique spun text.
Set superspin seed. This seed will be used as seed generator if spin second argument set to true.
See godocs or superspin_test.go source
MIT