Meerakat
Elite Member
- Sep 9, 2019
- 1,505
- 1,695
Hey BHW!
I felt like contributing again and this time I am presenting a really good script. It will benefit the sellers and also the people who like building links. I am releasing a script here which is coded in NodeJS and what it does is, it spits out the most readable article by spinning it again and again till a certain limit is reached (specified in the script). It will show you the spun article that has the most readable score.
What it does?
It spins your article with spintax as soon as a certain limit has reached, then it finds an article with the best readable score. It does output good quality article or an article that only requires little editing, try it yourself!
Why did I use "readable" score as my factor? Well, it uses specific algorithms to detect whether the article is good or not. Unless if I try to maybe create an A.I which can detect good quality article, it will probably take time and will be time consuming so I just took the easy way out.
Code:
Requirements:
1. NodeJS
2. You should know how to install the modules.
Module list: fs-extra, request, cheerio, html-to-text, node-spintax, steno, async-request
Improvements it could use:
1. After setting up everything, create two files called original.txt and spinned.txt. Paste the original article in original.txt and the one with spintax in spinned.txt. Right now it does not detect the similarity (it is still being worked on).
When you open the script, you will see this code. Change 100 to the number of times you want to spin the article.
After it reaches that limit, it will output: "Highest score found is: articlex - readability score". Please note that if it shows article55.txt, the spinned version will be in 54.txt or 56.txt (a bug which i will fix soon). It will automatically create files with the spinned articles.
Improvements are welcome, if anybody wants to use this they are welcome to do so. Let me know if you need help
I felt like contributing again and this time I am presenting a really good script. It will benefit the sellers and also the people who like building links. I am releasing a script here which is coded in NodeJS and what it does is, it spits out the most readable article by spinning it again and again till a certain limit is reached (specified in the script). It will show you the spun article that has the most readable score.
What it does?
It spins your article with spintax as soon as a certain limit has reached, then it finds an article with the best readable score. It does output good quality article or an article that only requires little editing, try it yourself!
Why did I use "readable" score as my factor? Well, it uses specific algorithms to detect whether the article is good or not. Unless if I try to maybe create an A.I which can detect good quality article, it will probably take time and will be time consuming so I just took the easy way out.
Code:
Code:
const [fs, request, html, htmlz, spintax, steno, req] = [require('fs-extra'), require('request'), require('cheerio'), require('html-to-text'), require('node-spintax'), require('steno'), require('async-request')];
let article1 = fs.readFileSync('./spinned.txt', 'utf8'),
article = fs.readFileSync('./original.txt', 'utf8');
function retnum(str) {
let num = str.replace(/[^0-9\.]+/g, '');
return num;
}
function levenshtein(a, b) {
if (a.length == 0) return b.length;
if (b.length == 0) return a.length;
var matrix = [];
var i;
for (i = 0; i <= b.length; i++) {
matrix[i] = [i];
}
var j;
for (j = 0; j <= a.length; j++) {
matrix[0][j] = j;
}
for (i = 1; i <= b.length; i++) {
for (j = 1; j <= a.length; j++) {
if (b.charAt(i - 1) == a.charAt(j - 1)) {
matrix[i][j] = matrix[i - 1][j - 1];
} else {
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1,
Math.min(matrix[i][j - 1] + 1,
matrix[i - 1][j] + 1));
}
}
}
return matrix[b.length][a.length];
}
Number.prototype.round = function(places) {
return +(Math.round(this + "e+" + places) + "e-" + places);
}
let test = (async function() {
let i = 0
arr = [],
obj = {};
let waitFor = (ms) => new Promise(r => setTimeout(r, ms))
while (i < 100) {
let dataz = request.post('https://spintaxtool.appspot.com/spintax', {
method: 'POST',
form: {
spin: article1
},
headers: {}
}, (error, res, body) => {
$ = html.load(body)
var data = $('textarea').next().next().next().text()
request.post('https://www.prepostseo.com/frontend/readabilityAjax', {
form: {
text: data
},
headers: {}
}, (error, res, body) => {
try {
let content = htmlz.fromString(body).split(' '),
content1 = retnum(content[33]),
num = content1;
let dataz = num.toString(),
sim = 100 - (((2 * levenshtein(article, data)) / (article.length + data.length)) * 100),
simz = sim.round(2);
obj[dataz] = {
value: `${data} \r\n\ Flesch Reading Score: ${dataz}`,
score: i,
sim: simz
};
let filename = `./Article${i}.txt`;
steno.writeFile(filename, obj[dataz].value, (err) => {})
arr.push(num)
console.log(`Score: ${num} - Filename: Article${i} \r\n`)
i++
} catch (err) {
console.log(err)
}
})
})
await waitFor(1300)
}
let max = arr.sort((a, b) => a - b)[arr.length - 1];
console.log(`Highest score found is: ${max} - Filename: Article${obj[max].score - 1} \r\n`)
//console.log(Math.round(arr.reduce((avg, e, i, arr) => avg + e / arr.length, 0)))
})()
Requirements:
1. NodeJS
2. You should know how to install the modules.
Module list: fs-extra, request, cheerio, html-to-text, node-spintax, steno, async-request
Improvements it could use:
- Instead of sending request to websites like prepto, it needs to use its own spintax spinner from the script itself, which will make the script even faster.
- Detect similarity between the spun and original article while spinning.
- Ability to spin multiple articles.
1. After setting up everything, create two files called original.txt and spinned.txt. Paste the original article in original.txt and the one with spintax in spinned.txt. Right now it does not detect the similarity (it is still being worked on).
Code:
while (i < 100) {
When you open the script, you will see this code. Change 100 to the number of times you want to spin the article.
After it reaches that limit, it will output: "Highest score found is: articlex - readability score". Please note that if it shows article55.txt, the spinned version will be in 54.txt or 56.txt (a bug which i will fix soon). It will automatically create files with the spinned articles.
Improvements are welcome, if anybody wants to use this they are welcome to do so. Let me know if you need help