Humanize your bot! - Markov chains by renzoarg

View this thread on steempeak.com
· @renzoarg ·
$1.05
Humanize 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>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 20 others
properties (23)
post_id1,931,097
authorrenzoarg
permlinkhumanize-your-bot-markov-chains
categorybot
json_metadata"{"app": "steemit/0.1", "format": "markdown", "links": ["http://s000.tinyupload.com/index.php?file_id=01135072690252144181"], "image": ["https://cdn.pixabay.com/photo/2015/02/08/20/40/teens-629046_960_720.jpg"], "tags": ["bot", "bots", "steemit", "ai", "programing"]}"
created2017-02-08 19:59:39
last_update2017-02-08 19:59:39
depth0
children4
net_rshares10,483,681,124,696
last_payout2017-03-11 20:31:33
cashout_time1969-12-31 23:59:59
total_payout_value0.910 SBD
curator_payout_value0.141 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length6,637
author_reputation62,934,514,884,081
root_title"Humanize your bot! - Markov chains"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (84)
@dwinblood ·
Interesting subject.   Thanks for writing these last few posts.   I have an interest in such things, but haven't played with these techniques before.
properties (22)
post_id1,931,113
authordwinblood
permlinkre-renzoarg-humanize-your-bot-markov-chains-20170208t200202385z
categorybot
json_metadata"{"app": "steemit/0.1", "tags": ["bot"]}"
created2017-02-08 20:02:00
last_update2017-02-08 20:02:00
depth1
children0
net_rshares0
last_payout2017-03-11 20:31:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length149
author_reputation223,300,085,257,919
root_title"Humanize your bot! - Markov chains"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@personz ·
🤔 Doing it on the word level doesn't give great results when strictly using a Markov chain because of course it's _memoryless_.

An easy way to see that is by tapping one of the random three suggestions on top of the Android keyboard, I'd bet they use that. Here's one I made earlier (edited very lightly to remove personal info, of course it's "learns" from what you type):

> I am she's very good quite European as it appears there only thing with the same as it is it's very small to be sure it'll be a few years ago the last two days and nights in a few years ago the same as last year and I will be quality to it because it has a lot too playing here has to stay on liquids is a cryptocurrency is so have you ever went they were rehearsing.

I think the real Laura uses full sentences, parts there of phrases or at least some knowledge of syntax, somehow. 😜
properties (22)
post_id1,939,256
authorpersonz
permlinkre-renzoarg-humanize-your-bot-markov-chains-20170209t220053206z
categorybot
json_metadata"{"app": "steemit/0.1", "tags": ["bot"]}"
created2017-02-09 22:00:54
last_update2017-02-09 22:00:54
depth1
children2
net_rshares0
last_payout2017-03-11 20:31:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length862
author_reputation42,440,234,781,798
root_title"Humanize your bot! - Markov chains"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@renzoarg ·
You kind of nailed it, she does, her sentencing is backed up by a neural path "scoring" that get a (+1) or (-1) usage modification every time she "reads" a sentence structure or pattern. This allows her to use "common" language without disregarding more elaborate phrasings.

I thought I clarified, this is a function, part of her tools... Not her whole repertoire of weaponry :p
properties (22)
post_id1,939,268
authorrenzoarg
permlinkre-personz-re-renzoarg-humanize-your-bot-markov-chains-20170209t220413472z
categorybot
json_metadata"{"app": "steemit/0.1", "tags": ["bot"]}"
created2017-02-09 22:04:15
last_update2017-02-09 22:04:15
depth2
children1
net_rshares0
last_payout2017-03-11 20:31:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length379
author_reputation62,934,514,884,081
root_title"Humanize your bot! - Markov chains"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@personz ·
Ah I didn't pay attention to that qualification 😳   Oops! So thanks, maybe next post on neural path scoring then! Interesting topic.

It can be applied also to music and the exact same issues arise. "Authenticity" of the piece, can you tell the difference, what does it mean if you can / can't, is it really music, etc. etc. 🤖  🎶
properties (22)
post_id1,939,300
authorpersonz
permlinkre-renzoarg-re-personz-re-renzoarg-humanize-your-bot-markov-chains-20170209t220954253z
categorybot
json_metadata"{"app": "steemit/0.1", "tags": ["bot"]}"
created2017-02-09 22:09:54
last_update2017-02-09 22:09:54
depth3
children0
net_rshares0
last_payout2017-03-11 20:31:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length329
author_reputation42,440,234,781,798
root_title"Humanize your bot! - Markov chains"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000