article spinner

SpiderW3b

new member
Aug 11, 2010
6
0
0
Hi all
I currently develop an article spinner script based on synonims. I've thought about an algorithm using strings in C/C++, but my client wants an integrated php script for online use. Is php suited for that?(I'm not well acustomed with it). Any sugestions about a separate api or integrated script will be apreciated.
Thanks :thumbsup:
 


If anything PHP/Perl is probably even better for that. Amazing Regex system out of the box.
 
I'm back, thanks for your interest guys I've adapted a sample code it but doesn't turn out right, just prints the same text.it may be a problem with the explode code sequence maybe , I' ve tested the partial results(strings) in echoes and the values get screwed up after str_replacement.Any hints pls?
here is the code :

<?php

function spin($txt){

$test = preg_match_all("#,;\{(.*?)\}#", $txt, $out);

if (!$test) return $txt;
//echo ($test);
$toFind = Array();
$toReplace = Array();

foreach($out[0] AS $id => $match){

$choices = explode(”|”, $out[1][$id]);
//echo ($choices[0]);
//echo"<br />";

$toFind[]=$match;
//echo($toFind[0]);
//echo"<br />";
$toReplace[]=trim($choices[rand(0, count($choices)-1)]);
echo "<br />";
echo($choices[1]);
//echo($toReplace[0]);

}

return str_replace($toFind, $toReplace, $txt);
echo "<br />";
echo($txt[0]);



}


$txt = "The {hungry|dire|vicious|savage} {brown|white|black} {fox|wolf|dog|bear}
ate the {lazy|slow|slow paced} {rabbit|dear|pheasant}";
echo spin($txt);
echo "<br />";
echo ($txt);
?>

if anyone has a hint i would much apreciate it , I'm on time pressure.
Thanks.
next post= B.O.O.B.S. , even "BIg'Uns"
 
maybe this will get some atention and an advice for me I'm on a close deadline

22961_3.jpg
nicoleta-luciu-tocuri1.jpg

22961_3.jpg
imgres



P.S. unfortunatelly she got married
 
Spiderweb, isn't she Nicoleta Luciu from Romania? =)

By the way, to the original poster. Google will notice that you replaced every single word with a synonym. Senuke's new content spinner is the shit. Check that out if you want to steal some ideas.
 
I'm back, thanks for your interest guys I've adapted a sample code it but doesn't turn out right, just prints the same text

Well yeah, the regex will never match, so the function will always return $txt.

Code:
$txt = 'This {wont|dont} work';
$test = preg_match_all("#,;\{(.*?)\}#", $txt, $out);

if (!$test) echo $txt;

$test = preg_match_all("#\{([^\}]*)\}#i", $txt, $out);

print_r($out);

Should shed a little light. And you probably want preg_replace.