Your own article spinner in PHP!

Is there a way to automatically spin an article? Sort of like what Senuke does, but through PHP? Anyone knows?
 
Awesome share, I tackled building one myself around 4 months ago to use in some custom scripts and lets just say my script was a little longer :D Very efficient implementation!
 
Hi,

This is a fantastic script and I would love to see madoctopus's code for the php text comparison (n-gram based) so then the spinner code could be extended to only output X number of articles that are of a % of difference from one another.

I hope madoctopus can respond to this as I cannot PM him as I need 15 posts ;-)

thanks a lot.

Simon
 
Holy s#it! I have my own spinner and for very large seeds it is extremely slow. Initially it was about 20 times slower but I optimized it, however it still takes a lot to spin a very long seed (20,000 words, 8 levels deep).

I just benchmarked both scripts (yours and mine) and yours is 30+ times faster. Mine takes over 4.2 seconds and yours takes about 0.13 seconds. One significant difference in the algorithm is that mine built an internal tree data structure for the seed (array) which could obviously grow very large.

I will try to understand your algorithm to make sure the randomness is good and there are no strange things in there that would cause bias in the generated spin. Then I rebuild my spinner class on top of yours. Maybe if it is not too much to ask, you care to describe the algorithm for me so I understand it faster.

I'd rep+ you but I can't because I already did on some other thread lately.

Thank you!

Yours was exactly the way I was going to code mine, but then I remembered phpbuilt had a different concept and came back to check it out ;)

I'm not exactly a good programmer, but I did top my DS class. ;p
 
wow nice dude, thanks a lot, is it possible to make a feature here something like bulk spin and export? or something like remove original like TBS?

check this item below at codecanyon:

Spintax - Your PHP Article Rewriter


pretty nice, i think...
 
PHP:
function spin($pass){
    $mytext = $pass;
    while(inStr("}",$mytext)){
        $rbracket = strpos($mytext,"}",0);
        $tString = substr($mytext,0,$rbracket);
        $tStringToken = explode("{",$tString);
        $tStringCount = count($tStringToken) - 1;
        $tString = $tStringToken[$tStringCount];
        $tStringToken = explode("|",$tString);
        $tStringCount = count($tStringToken) - 1;
        $i = rand(0,$tStringCount);
        $replace = $tStringToken[$i];
        $tString = "{".$tString."}";
        $mytext = str_replaceFirst($tString,$replace,$mytext);
    }
    return $mytext;
}
function str_replaceFirst($s,$r,$str){
    $l = strlen($str);
    $a = strpos($str,$s);
    $b = $a + strlen($s);
    $temp = substr($str,0,$a) . $r . substr($str,$b,($l-$b));
    return $temp;
}
function inStr($needle, $haystack){
    return @strpos($haystack, $needle) !== false;
}
Pass any block of text to the function "spin" and it will return your article, spun. Great for anyone who is developing their own system involving article spinning.

Supports nested spinning to infinite levels.

If you're sending articleranks.com spins to it, just convert "[" and "]" to "{" "}" ... and "~" to "|".

BTW I wrote this myself. Use it however you want. Let me know if you have any questions.

Enjoy!

phpbuilt great script :)

Tell me can we have character counter, word counter why we need it?
and one more thing, maybe another box for title spinning titles

thanks again
katika
 
Thank you ..
I am searcing for information about this ..
I will try ..
Please do share more recent informmasi ..
Thank you ..
 
I know that this thread is old, but I just ran across it and was able to implement it into a project that I am working on. Thank you, saved me a bunch of time with writing my own.
 
Has anyone had any luck using Spintax from CodeCanyon?

Also does anyone have a good synonyms list I could use?
 
Excellent thread, thanks for sharing the code! I'm sure it'll come in handy soon, I'll have to bookmark this.
 
Nice Job Buddy. Thanks for revealing script that everybody has been waiting for.
 
Hi,

I can't leave the page without saying a {huge|bulk|big|great} thank you to you :) .

Excellent work. it will make my life soo easy :)
 
PHP:
<?php
set_time_limit(10);
function inStr($needle, $haystack){
    return @strpos($haystack, $needle) !== false;
}
function str_replaceFirst($s,$r,$str){
    $l = strlen($str);
    $a = strpos($str,$s);
    $b = $a + strlen($s);
    $temp = substr($str,0,$a) . $r . substr($str,$b,($l-$b));
    return $temp;
}
function spin($pass){
    $mytext = $pass;
    while(inStr("}",$mytext)){
        $rbracket = strpos($mytext,"}",0);
        $tString = substr($mytext,0,$rbracket);
        $tStringToken = explode("{",$tString);
        $tStringCount = count($tStringToken) - 1;
        $tString = $tStringToken[$tStringCount];
        $tStringToken = explode("|",$tString);
        $tStringCount = count($tStringToken) - 1;
        $i = rand(0,$tStringCount);
        $replace = $tStringToken[$i];
        $tString = "{".$tString."}";
        $mytext = str_replaceFirst($tString,$replace,$mytext);
    }
    return $mytext;
}

echo '<form action="" method="post"><textarea name="mypost" cols="80" rows="20">';

if(isset($_POST["mypost"])){
    echo $_POST["mypost"];
}
echo '</textarea><br /><input name="" type="submit" /></form>';

if(isset($_POST["mypost"])){
    $mypost = $_POST["mypost"];
    $mypost = str_replace("'","`",$mypost);
    $echoMe = spin($mypost);
    $wordCount = explode(" ",$echoMe);
    $wordCount = count($wordCount);
    $echoMe = str_replace(chr(13).chr(10),"<br />".chr(13).chr(10),$echoMe);
    echo $echoMe;
    echo "<br />";
    echo "wordcount: <b>$wordCount</b>";

}

?>

Save that file on any php server, paste in your article spin and click submit. I'll show the spun content below the text box.

@phpbuild, thanks for this. I was going to write one myself but luckily stumbled across yours.
 
Exactly what I am looking for today, thanks op!
Now I am going to find the spinner function php script, hope it will not take a long time.
 
sorry to bump. instead of pasting article. How i can get the article from folder path
 
Back
Top