Jump to content
UBot Underground

Spintax And Data-Merge, Stumped


Recommended Posts

I'm trying to figure out a way to do a data-merge (Spintax with table) with Ubot and I'm kind of stumped!  So far, while tedious, I got a killer app going and this is one of the last pieces.  

Here's the Spintax example:
{{I saw|I found|My wife noticed} {a great piece|an article|a writeup} on a [Year] [Car], it was {a beautiful|an amazing|a brilliant} [Color]{ and| &|,} [Car-Company] was {doing everything right|on-point} {at the time,|then,} {check it out|here's the article}: [Article]}}

Here's what the table would look like:

Year,Car,Color,Car-Company,Article
1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article
1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article

I need to figure out how to merge the Spintax file with the table.  The output with the above Spintax merged with the table would look like this:

I found a great piece on a 1967 Mustang, it was a beautiful Candy Apple Red & Ford was on-point at the time, here's the article:  http://ford.com/mustang-article
My wife noticed an article on a 1969 Camaro, it was a brilliant Canary Yellow and Chevrolet was doing everything right then, check it out: http://chevy.com/camaro-article
 
Suggestions?
 
Many Thanks!

LJ
Link to post
Share on other sites

Might not be the best way but this will work

create table from text(&cars,"Year,Car,Color,Car-Company,Article
1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article
1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article")
set(#year,$table cell(&cars,$rand(1,2),0),"Global")
set(#car,$table cell(&cars,$rand(1,2),1),"Global")
set(#color,$table cell(&cars,$rand(1,2),2),"Global")
set(#company,$table cell(&cars,$rand(1,2),3),"Global")
set(#article,$table cell(&cars,$rand(1,2),4),"Global")
set(#example,$spin("\{\{I saw|I found|My wife noticed\} \{a great piece|an article|a writeup\} on a {#year} {#car}, it was \{a beautiful|an amazing|a brilliant\} {#color}\{ and| &|,\} {#company} was \{doing everything right|on-point\} \{at the time,|then,\} \{check it out|here\'s the article\}: {#article}\}"),"Global")
load html(#example)
Link to post
Share on other sites

 

Might not be the best way but this will work

 

This will randomize each row number which is not good because you can get an output like this (notice the Ford in there):

My wife noticed a writeup on a 1969 Camaro, it was an amazing Canary Yellow & Ford was on-point at the time, check it out: http://chevy.com/camaro-article

Instead you would loop through the table since you don't want to randomize that information but the spintax and use all the information once I'm guessing.

clear table(&cars)
create table from text(&cars,"1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article
1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article")
set(#table_row,0,"Global")
loop($table total rows(&cars)) {
    set(#year,$table cell(&cars,#table_row,0),"Global")
    set(#car,$table cell(&cars,#table_row,1),"Global")
    set(#color,$table cell(&cars,#table_row,2),"Global")
    set(#company,$table cell(&cars,#table_row,3),"Global")
    set(#article,$table cell(&cars,#table_row,4),"Global")
    set(#example,$spin("\{\{I saw|I found|My wife noticed\} \{a great piece|an article|a writeup\} on a {#year} {#car}, it was \{a beautiful|an amazing|a brilliant\} {#color}\{ and| &|,\} {#company} was \{doing everything right|on-point\} \{at the time,|then,\} \{check it out|here\'s the article\}: {#article}\}"),"Global")
    increment(#table_row)
    load html(#example)
    wait(3)
}
Link to post
Share on other sites

Thanks for your suggestion darryl561 however, as HelloInsomnia mentioned it would cause an issue with the car makes getting randomized which would make the article off topic but I sincerely appreciate your efforts!

 

HelloInsomnia, thanks man!  Going to give that one a go :-)  I'll report back in a few hours :-)

 

Thanks again to both of you!

 

Peace,

LJ

Link to post
Share on other sites

Helloinsomnia,

 

Is there any way that you can yak on Skype for a few minutes tomorrow? 

 

I got your example working however I'm having a hard time figuring it out when I only have 1 column of links.

 

You can get me at your pleasure: ej.lear

 

Thanks man!

 

Peace,

LJ

Link to post
Share on other sites

Helloinsomnia,

 

Is there any way that you can yak on Skype for a few minutes tomorrow? 

 

I got your example working however I'm having a hard time figuring it out when I only have 1 column of links.

 

You can get me at your pleasure: ej.lear

 

Thanks man!

 

Peace,

LJ

 

Sorry but I don't use Skype, you can PM me here though and I'll help you out!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...