Humanize your bot! - Markov chains
bot·@renzoarg·
0.000 HBDHumanize your bot! - Markov chains
<p>All users in steemit have come across <strong>automated upvotes</strong>, that is for sure.</p> <p>What not many have experienced is the <strong>comments some of those bots dump a minute after a post has been made</strong>... A post that is 1000+ words long and would need an experienced reader to glance through.<p> https://cdn.pixabay.com/photo/2015/02/08/20/40/teens-629046_960_720.jpg <blockquote> <p> "Nice post, I like it"<br /> "Good post, thanks for sharing" </p> </blockquote> <p>If something characterizes bots is how <strong>"stiff" their behavior is</strong>. Perhaps it is a residue of the "robot dance?<br /> The <strong>lack of variation</strong>, the <strong>predictability responses</strong> have once one learns them. What conforms human speech as "human" is precisely the <strong>slight variations we add in to not sound stupid</strong>, repeating the same phrases once and again.</p> <h3>Here is where Markov Chains kick in</h3> <p>Watering it down to vulgar language, we combine a set of variables (words) in a way that allows us to build several phrases with the exact same meaning as a result. <br /> <table><tbody> <tr><td>dog</td><td>eating</td><td>food</td></tr> <tr><td>hound</td><td>consuming</td><td>meal</td></tr> <tr><td>canine</td><td>devouring</td><td>nourishment</td></tr> <tr><td>mongrel</td><td>ingesting</td><td>fare</td></tr> <tr><td>cur</td><td>gulping down</td><td>nutriment</td> </tr> </tbody> </table> As you may observe, by combining any on the items in each column we may acquire exactly the same sentence! </p> <h3>Lets build this up!</h3> <p>This is part of <strong>Laura's phrasing tools</strong>, she does not use a table to get her variables, but a syntactic analysis tool that allows her to identify synonyms and antonyms by researching the largest linguistic database on Earth: Google.</p> <p>First, we need a GUI (graphic user interface) to make it "visible" to people (we will use a set of arrays, for the sake of simplicity). <blockquote> Local $WordArray[3][5] = [["dog", "hound", "canine", "mongrel", "cur"], ["eating", "consuming", "devouring", "ingesting", "gulping down"],["food", "meal", "nourishment", "fare", "nutriment"]]<br /> <br /> $Form = GUICreate("Steemit Example", 393, 194, 407, 229)<br /> $Input1 = GUICtrlCreateInput($WordArray[0][0], 8, 8, 121, 21)<br /> $Input2 = GUICtrlCreateInput($WordArray[0][1], 8, 32, 121, 21)<br /> $Input3 = GUICtrlCreateInput($WordArray[0][2], 8, 56, 121, 21)<br /> $Input4 = GUICtrlCreateInput($WordArray[0][3], 8, 80, 121, 21)<br /> $Input5 = GUICtrlCreateInput($WordArray[0][4], 8, 104, 121, 21)<br /> $Input6 = GUICtrlCreateInput($WordArray[1][0], 136, 8, 121, 21)<br /> $Input7 = GUICtrlCreateInput($WordArray[1][1], 136, 32, 121, 21)<br /> $Input8 = GUICtrlCreateInput($WordArray[1][2], 136, 56, 121, 21)<br /> $Input9 = GUICtrlCreateInput($WordArray[1][3], 136, 80, 121, 21)<br /> $Input10 = GUICtrlCreateInput($WordArray[1][4], 136, 104, 121, 21)<br /> $Input11 = GUICtrlCreateInput($WordArray[2][0], 264, 8, 121, 21)<br /> $Input12 = GUICtrlCreateInput($WordArray[2][1], 264, 32, 121, 21)<br /> $Input13 = GUICtrlCreateInput($WordArray[2][2], 264, 56, 121, 21)<br /> $Input14 = GUICtrlCreateInput($WordArray[2][3], 264, 80, 121, 21)<br /> $Input15 = GUICtrlCreateInput($WordArray[2][4], 264, 104, 121, 21)<br /> $output = GUICtrlCreateInput("", 8, 160, 377, 21)<br /> $button = GUICtrlCreateButton("Build my sentence!", 8, 128, 379, 25)<br /> GUISetState(@SW_SHOW)<br /> <br /> While 1<br /> $nMsg = GUIGetMsg()<br /> Switch $nMsg<br /> Case $GUI_EVENT_CLOSE<br /> Exit<br /> Case $button<br /> ; here's where the call for the functions go<br /> EndSwitch<br /> WEnd<br /> </blockquote> <p> Yes, all that to build this: </p> https://s27.postimg.org/ppz10v5k3/ss_01.png <p>And it still does <strong>nothing</strong>.</p> <p>Now, we need to mix the variables and call them into useful combinations that we will read from the GUI (we will add a couple of lines that will redefine the array in case that we change any of the texts in the inputboxes), this is where <strong>having everything organized in an array of variables comes in handy</strong>:</p> <blockquote> Func rewrite()<br /> $WordArray[0][0] = GUICtrlRead($Input1)<br /> $WordArray[0][1] = GUICtrlRead($Input2)<br /> $WordArray[0][2] = GUICtrlRead($Input3)<br /> $WordArray[0][3] = GUICtrlRead($Input4)<br /> $WordArray[0][4] = GUICtrlRead($Input4)<br /> <br /> $WordArray[1][0] = GUICtrlRead($Input5)<br /> $WordArray[1][1] = GUICtrlRead($Input6)<br /> $WordArray[1][2] = GUICtrlRead($Input7)<br /> $WordArray[1][3] = GUICtrlRead($Input8)<br /> $WordArray[1][4] = GUICtrlRead($Input9)<br /> <br /> $WordArray[2][0] = GUICtrlRead($Input10)<br /> $WordArray[2][1] = GUICtrlRead($Input11)<br /> $WordArray[2][2] = GUICtrlRead($Input12)<br /> $WordArray[2][3] = GUICtrlRead($Input13)<br /> $WordArray[2][4] = GUICtrlRead($Input14)<br /> EndFunc<br /> </blockquote> <h3>Now, build my sentence already!</h3> <p>For this, we use our good friend <em>random()</em>, querying a random entry of each part of the array and building the final sentence!</p> <blockquote> Func mixup()<br /> $1st= $WordArray[0][random(0,4,1)]<br /> $2nd= $WordArray[1][random(1,4,1)]<br /> $3rd= $WordArray[2][random(2,4,1)]<br /> GUICtrlSetData($output, "The " & $1st & " is " & $2nd & " his " & $3rd & ".")<br /> EndFunc<br /> </blockquote> <hr> <p>You can combine <strong>any words you like</strong>, go as far as you imagine. You may even go deeper and "tweak" the probabilities of one variable being chosen over others (to, for example, trend to pick "dog" above all other options). <br /> I'll leave the source script and a compiled version for people to take a peek and play around.</p> <a href="http://s000.tinyupload.com/index.php?file_id=01135072690252144181">Sample + Source</a> <p>Now, botters, you've no excuse! Make your bots a bit more interesting!</p> <hr> <blockquote> <p>If you liked this post and its informal way of talking about sciences, please, follow me for more!</p> <p>Leave a comment either for good or for bad reviews. I take everything as constructive, and I really appreciate the feedback, even from trolls (at least a troll read it before being himself!).</p> </blockquote> <hr> <h3>Copyrights:</h3> <hr> <blockquote> <p>All the previously used images are of my authory or under a CC0 license (Source: pixabay), unless openly stated.</p> <p>All the Images created by me possess a WTFPL licencing and they are free to redistribute, share, copy, paste, modify, sell, crop, paste, clone in whatever way you want.</p> </blockquote> <hr>
👍 iflagtrash, dwinblood, fyrst-witness, steemspeak, steemservices, barvon, timbot606, ebryans, countryfolk1, sergey44, stellabelle, bue-witness, bue, mini, healthcare, boy, daniel.pan, bunny, moon, helen.tan, craigslist, thebatchman, thebatchman1, grey580, kyzer, sqube, svamiva, jocelyn, biodragon, joseph, idol, berkah, picokernel, tamersameeh, speda, starrkravenmaf, steemalf, nomadsteem, shaka, felixxx, votebot, twinner, peccio, permacryptofolio, uhu, beers, steem-munich, steem.map, sonstiges, fyrstikken, qubes, sponge-bob, brains, whatsup, glitterfart, cub1, handmade, inchonbitcoin, thecryptofiend, joshbreslauer, annaarthur, loreennaa, cmp2020, proctologic, proctologic2, proctologic3, lovethepeople, porco-bastardo, rigaronib, ikarus64, patrice, zoee, onlyvoluntary, blacklist, pedrovillegas96, gabosh, sykochica, kenny-crane, kingscrown, mor, personz, aniestudio, fydel, bit20009,