Spin content

phil3627

Registered Member
Joined
Jan 22, 2009
Messages
63
Reaction score
2
How do you spin content in visual basic? I searched google but found nothing. What I mean by spin content: {dog|puppy|pit bull} want to make a bot that spins and post articles.
 
Last edited:
are you talking about the code needed to make a text box/area where your able to produce spun content ?
 
are you talking about the code needed to make a text box/area where your able to produce spun content ?

No I'm talking about the code that takes my already spun content, spins it so that I can submit to sites like ezinearticles, hubpages, blogger.
 
Last edited:
You'd do it pretty much the way you'd do it in any similar language.

Open your spun file. Create an output file. Start reading the input file until you come to an opening "{" bracket. Send all the characters up to but not including the bracket to the output file.

Then, begin counting the "|" characters until you come to the end "}" bracket. Add one to the count. Generate a random integer between 1 and the count. Go back to the opening bracket, starting to form a string until you get to the "|" character again. Pick the string the corresponds to the random number selected earlier.

Send that string to your output file.

Proceed as before, going through and looking for the next opening bracket, writing all the character up to the bracket to the output file. etc. etc.

Save the output file.
 
You can use this function to help generate random numbers
Public Function RandomNumber(ByVal MaxNumber As Integer, Optional ByVal MinNumber As Integer = 0) As Integer
Dim r As New Random()
If MinNumber > MaxNumber Then
Dim t As Integer = MinNumber
MinNumber = MaxNumber
MaxNumber = t
End If
Return r.Next(MinNumber, MaxNumber)
End Function
 
You'd do it pretty much the way you'd do it in any similar language.

Open your spun file. Create an output file. Start reading the input file until you come to an opening "{" bracket. Send all the characters up to but not including the bracket to the output file.

Then, begin counting the "|" characters until you come to the end "}" bracket. Add one to the count. Generate a random integer between 1 and the count. Go back to the opening bracket, starting to form a string until you get to the "|" character again. Pick the string the corresponds to the random number selected earlier.

Send that string to your output file.

Proceed as before, going through and looking for the next opening bracket, writing all the character up to the bracket to the output file. etc. etc.

Save the output file.

I don't want to create articles from my spun content trying to create a bot that will log into sites like blogger spin my article and post it to blogger the same way senuke does.
 
Well thats exactly what Kid Shaleen was trying to help you with. In order to spin the article you're going to have to parse the text and look for the brackets. When the program sees the brackets you're going to need to store those words that are seperate with "," into an array. Get the length of that array and then generate a random number that falls inside the arrays length. Once you have that number you can grab the nth word in the array and the that part is spun.
 
translate using G translate. for example english => french => german => back to english
 
So I have to do what Kid Shaleen wrote each time I want to auto post a new article to web 2.0 sites? If thats the case I'm better off buying ubot.
 
Well..yeah...the vb program would run through that coded statement each time it spun an article...its not liking you're going to be writing this code for each article...and for the translation bit thats pretty easy as well....if you're not very savy with .net and vb you may be better off getting ubot...i wont knock it but I will say that i will pay itself over a thousand times if you take the time to learn vb and .net instead of going for ubot.
 
Merry Christmas.



Code:
Public Function Spin(ByVal SourceString As String) As String
        '
        '    Create a temp return info
        '
        Dim ReturnString As New System.Text.StringBuilder
        '
        '    The loop position in the source string
        '
        Dim I As Integer = 0
        '
        '    Sart a new random sequence
        '
        Randomize()
        '
        '    While there is something in the source
        '
        Do While I < SourceString.Length
            '
            '    Get the char to process
            '
            Dim c As Char = SourceString.Chars(I)
            '
            '    Depending on the char
            '
            Select Case c
                Case "{"c
                    '
                    '    This is an opening so must start a deeper level
                    '
                    ReturnString.Append(Spin(SourceString.Substring(I + 1)))
                    Exit Do
                Case "}"c
                    '
                    '    This is a closing one.
                    '--------------------------------------------------------
                    '
                    '    calculate the options using the | separator
                    '
                    Dim Options As String() = ReturnString.ToString.Split("|"c)
                    '
                    '    Clear the return string to get an option. 
                    '
                    ReturnString = New System.Text.StringBuilder
                    '
                    '    Get the option
                    '
                    ReturnString.Append(Options(CType(Math.Floor(Rnd() * CType(Options.Length, Single)), Integer)))
                    '
                    '    Get hte rest of the string past the closing bracket
                    '
                    If I < SourceString.Length - 1 Then
                        '
                        '    Disregard all the source before the ending bracket and reset the pointer
                        '
                        SourceString = SourceString.Substring(I + 1)
                        I = -1
                    Else
                        '
                        '    If this is the last char, then nothing more to analyze
                        '
                        SourceString = ""
                    End If
                Case Else
                    '
                    '    this is a normal char
                    '
                    ReturnString.Append(c)
            End Select
            '
            '    Go for the next char
            '
            I += 1
        Loop
        '
        '    Return the valid string
        '
        Return ReturnString.ToString

    End Function


Then all you have to do is do something like

Code:
TextBox2.Text = Spin(TextBox1.Text)
 
Thanks a thousand times. I know the concept is quite simple, but the example is very very useful.
 
I was just about to start a topic on this very subject. Thanks zacatictac.

Now the next step in my app is to take a page of text and apply the spintax code to it before spinning the output. Anyone done this?
 
Last edited:
Many thanks zacatictac, you are a star!
I have been looking to do this for ages, I dont suppose you could shed some light on the way to choose synonyms and then wrap them in syntax. Or am I being too cheeky!!
 
Back
Top