joaquin112
Regular Member
- Apr 4, 2010
- 287
- 224
Is there a way to automatically spin an article? Sort of like what Senuke does, but through PHP? Anyone knows?
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!
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?
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.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; }
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!
any 1 tried this or not ?
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.