Markov Chaining (to generate Fake Alex Jones) — Transcript
Full transcript
- 0:00all right welcome back everyone uh can i
- 0:02treat it as a 2d array we can't treat it
- 0:04like a vector
- 0:05uh yeah so if you have an end pointer an
- 0:08endpointer is simply a memory address
- 0:10nothing more nothing less is it a 1d
- 0:13array is it a 2d array who knows who
- 0:15cares it's up to you to figure that that
- 0:17stuff out
- 0:18so if it's a 2d array that means it's
- 0:20going to be laid out in some format you
- 0:22know it's like you're going to have the
- 0:23first row first followed by the second
- 0:25row of all with it
- 0:27but
- 0:28it's kind of up to you right like
- 0:30especially when you're processing image
- 0:31data
- 0:32image data a lot of times can be held
- 0:35with a complete plane of red data
- 0:37and then a complete plane of green and
- 0:39then a complete plane of blue or you can
- 0:41do what's called interleaved or
- 0:42interlaced or something like that redo
- 0:44the red the green the blue for pixel at
- 0:47row zero column zero red green blue of
- 0:50row zero column one red green blue row
- 0:52zero column two so the format the layout
- 0:55of where the data is when you have a
- 0:56pointer like it doesn't contain any of
- 0:58that information it's just where is the
- 1:01spotted memory there's a spot in ram
- 1:02right here and that's where the image
- 1:04begins you know nothing else beyond that
- 1:06so if you want to pass in
- 1:08additional information like how big is a
- 1:10row how big is a column then you pass
- 1:13those in as separate parameters and
- 1:14that's why the
- 1:15code has a width and a height parameter
- 1:18so it tells you how the
- 1:20uh the thing is formatted the rows tell
- 1:22you you know how long it goes until you
- 1:24get down to the next row and or the
- 1:27columns rather tell you how far
- 1:30you go until you're down to the next row
- 1:32and then the rows tell you how far it is
- 1:33till the end of the image or the
- 1:35into the elevation field
- 1:37so i prefer using vector vectors because
- 1:40it contains all that information
- 1:42we may be getting matrices in c plus
- 1:44plus 23.
- 1:46don't hold your breath
- 1:47um
- 1:48the standards moves
- 1:50not quickly but there is currently some
- 1:54um
- 1:57some indication we might get
- 1:59matrices in
- 2:02in 23
- 2:03um
- 2:05coin toss whether or not that actually
- 2:06happens but that'd be nice because it's
- 2:08like these kinds of like
- 2:10things like come up you know like a 2d
- 2:13matrix wow that's
- 2:14it's crazy somebody would want that in
- 2:16the standard
- 2:21what kind of obscure use case do you
- 2:22have for a 2d matrix man
- 2:26it'd also be cool if you added in
- 2:28support for numerical vectors cross
- 2:30product dot product so that everybody
- 2:32and their mother doesn't have to write
- 2:34their own matrix library and their own
- 2:35vertex library none of which are
- 2:37compatible with each other that'd be
- 2:38kind of cool too wouldn't it i don't
- 2:40know
- 2:41and then you could just multiply a
- 2:43vector in a matrix and
- 2:45a point in a
- 2:47yeah okay
- 2:48so our next topic is going to be
- 2:53markov chains
- 2:56markov
- 2:58chain
- 3:00so markov chain
- 3:02is
- 3:04pretty cool pretty cool stuff um
- 3:08basically um
- 3:10you can imagine it's a graph okay
- 3:13stream oh i'm not streaming
- 3:17there so
- 3:19uh
- 3:20markov
- 3:21chains are graphs
- 3:24and the edges indicate the probability
- 3:27the transition from one graph to another
- 3:30and so all the outgoing probabilities
- 3:33must always
- 3:35add up to one
- 3:36right because one is 100
- 3:39so if we're on the e node right here
- 3:42we roll it i
- 3:44inside a die if we get a
- 3:46one two or three
- 3:48we stay at e we print e again
- 3:50and if we
- 3:52get a four through ten
- 3:54we print a instead and then we're at
- 3:56eight
- 3:57and then we roll another ten sided die
- 3:58if we get let's say two we transition
- 4:00back to e we roll a two we transition
- 4:02back to e
- 4:03roll five transition to a roll of five
- 4:05we transition to a
- 4:07and so this will randomly generate
- 4:09strings of just e's and a's
- 4:12not very useful
- 4:14what is useful
- 4:15is when you take
- 4:18the english language
- 4:20and feed it
- 4:22into building a markov chain graph
- 4:25okay
- 4:27so for example if you wanted to make a
- 4:30program that would generate
- 4:31random names
- 4:33for let's say a specific
- 4:35country
- 4:36what you could do is
- 4:38grab census data for that country
- 4:41and
- 4:43grab just the first names let's say and
- 4:45feed them into this
- 4:46markov
- 4:47chain generator and what you basically
- 4:49do is you say all right
- 4:53for every letter you read
- 4:56what is the probability that it moves to
- 4:58one of the other letters
- 5:00and so there's 26 letters in the english
- 5:02language so if i'm if i'm feeding in all
- 5:04the names of
- 5:06babies
- 5:08um
- 5:09you know
- 5:10how often does the letter i
- 5:12follow the letter b and you just count
- 5:14you just count how many times each
- 5:16letter follows another letter so you
- 5:17have a 26 by 26 matrix
- 5:20and it's
- 5:21you know you just count every time a
- 5:23letter follows another letter you count
- 5:25and
- 5:25then you have two special letters one is
- 5:27start of word
- 5:29and one is end of word and so
- 5:32you can count how often a certain letter
- 5:34starts a word for example you
- 5:36probably does not start a word in the
- 5:39english language very often
- 5:41but like j
- 5:42would even though j is not a very common
- 5:44letter in the english
- 5:45language overall
- 5:47there's a lot of j names
- 5:49so what you do then when you want to
- 5:51generate a random
- 5:52a random name is you start at the
- 5:56it's a graph that you've essentially
- 5:57created
- 5:58um you normalize all those values down
- 6:00to
- 6:01you know
- 6:02zero to one
- 6:04and you basically start at the start
- 6:06node start graph start vertex
- 6:09and you roll die and
- 6:11then you see okay uh i rolled a j okay
- 6:14then you move to the j spot on the graph
- 6:16and then j could be followed by o or u
- 6:19or i or
- 6:21um
- 6:23a for james you know something like that
- 6:25and you roll die you're like okay you
- 6:26got an a so you move to a and you see
- 6:28what what letters follow
- 6:30a you know very often you roll and you
- 6:32get a s
- 6:34you know and so you sit there you move
- 6:36around and the end word is one of the
- 6:38possible moves you can make and
- 6:40eventually it'll move around and
- 6:41eventually it'll move on top of the end
- 6:43node and then you stop and there's your
- 6:45random there's your random name
- 6:47so markov chains are great for learning
- 6:49patterns of data and then you can
- 6:51randomly generate new names based on the
- 6:54patterns of the language or the country
- 6:56or the county or the city that you're
- 6:59trying to emulate
- 7:02just pretty cool stuff
- 7:04yeah
- 7:05so i have a program on
- 7:07the server called mc
- 7:10andre because i think
- 7:15yeah andrea is his name
- 7:17so uh i have a program on my
- 7:20server called mc andre that takes in rap
- 7:23lyrics
- 7:24and it and it randomly generates rap
- 7:26lyrics and it has some additional
- 7:28constraints on it to make sure that the
- 7:31um
- 7:32versus rhyme and things like that like
- 7:34it actually
- 7:35looks at the random
- 7:37data coming out and rejects those that
- 7:39don't sort of follow the
- 7:41like if you're trying to
- 7:42go with a certain you know beat or
- 7:44number of syllables and rhyme pattern
- 7:46and things like that
- 7:47then it will reject
- 7:49um
- 7:50verses that don't follow that pattern
- 7:52but the uh the upshot is that it can it
- 7:55can randomly spit out you know okay at
- 7:58least sounding wrap wrap lines
- 8:02you should take note of the smart off
- 8:03chain counts if you should because it's
- 8:04your next homework assignment you're
- 8:05gonna have to do this
- 8:09okay
- 8:10so
- 8:12uh more graph theory yay
- 8:16graph theory is fun a lot of uses okay
- 8:19so let's see if we can have a picture
- 8:21here
- 8:47yeah like something like that okay
- 8:50so let's say that you notice how the
- 8:51outgoing probabilities always add up to
- 8:53one right
- 8:54so let's say you start at one
- 8:57and so you roll a hundred sided die
- 8:59and you get a 72
- 9:01okay so
- 9:03if it's if you got a zero to one to 23
- 9:05you'd go to two but we didn't so we're
- 9:07gonna go to four
- 9:08so you output one you go to four you
- 9:10roll a die
- 9:12and i got a thirty okay so then i move
- 9:15to five then i roll another thirty well
- 9:17a hundred percent of the time
- 9:19i move to six so it's going to print out
- 9:20one four five six
- 9:22do you see how this works it and it'll
- 9:24just keep moving around
- 9:25the system at every point you roll a die
- 9:28and that randomly chooses
- 9:30which direction you're gonna go in right
- 9:32so if it's raining today
- 9:34there's a 60 chance it'll rain tomorrow
- 9:36it's a 10 chance it'll be sunny and a 30
- 9:38chance it'll be cloudy so if you want to
- 9:40generate fake weather forecasts for a
- 9:42video game let's say
- 9:44then um you know you're playing harvest
- 9:46moon or something you probably want to
- 9:47start the game in sunny because it's a
- 9:49little weird to start again with it like
- 9:51thunderstorming right
- 9:53but it'll stay sunny probably for a
- 9:55while and then oh it switches into
- 9:57cloudy and then cloudy switches into
- 9:59rain then it stays raining for a while
- 10:01then it switches back into cloudy and
- 10:02then switches back into raining and
- 10:04switches into sunny
- 10:06and so you can use this to generate
- 10:07weather forecasts you know that so
- 10:09rather than it going like sunny rainy
- 10:11sunny rainy it's kind of weird you know
- 10:13maybe
- 10:14not too weird for fresno giving her our
- 10:16weather the last couple of days
- 10:19uh it was super windy yesterday now it's
- 10:21just like
- 10:22dead
- 10:22right i was like all excited i got my
- 10:24kites you know ready
- 10:30i was gonna go to woodward park with my
- 10:31kites and there was too much dust there
- 10:33was so much dust flying up i was like
- 10:36all right it's too windy for kite flying
- 10:37i'll go tomorrow now it's there's like
- 10:40it's completely dead
- 10:41so
- 10:44um
- 10:48so this makes sense to you
- 10:50and so you can use these things to
- 10:51generate you know fairly realistic
- 10:53looking and feeling
- 10:56um
- 10:58that's interesting
- 11:01yeah that weather and
- 11:03words and things like that so
- 11:06well they're probably home yesterday now
- 11:07you're back in front of where where is
- 11:08home cohen
- 11:17west coast washington yeah
- 11:19yeah probably a little more dust storm
- 11:21than usual
- 11:23um
- 11:24okay so let's talk about bridges markov
- 11:28so bridges markov
- 11:37we're going to be doing
- 11:39we're not going to be doing word
- 11:41generation we're going to be doing
- 11:43sentence generation so what we're going
- 11:45to do is we're going to feed in a corpus
- 11:49a body of
- 11:50work
- 11:51and what we're going to do is write down
- 11:52how often each word
- 11:54follows another word
- 11:56okay
- 11:58so
- 12:00for example i put in 1500 lines of
- 12:03wu-tang clan lyrics
- 12:05and then
- 12:07once you build it
- 12:09it it's basically just you know
- 12:12kind of a hash table right you have a
- 12:14hash table rehash based on the word
- 12:17and then each each word has a
- 12:20a vector
- 12:21of possible words that it connects to
- 12:23and how often those words happen
- 12:26and then once you build the graph phase
- 12:27one is building the graph then phase two
- 12:31is generating new sentences
- 12:33and you generate a new sentence by just
- 12:35picking a word again that connects to
- 12:37the start node
- 12:39and then you roll a die you're like okay
- 12:41well this one's 75 chance i rolled a 50
- 12:44i'm gonna go there and you sit there and
- 12:46you hop around on this graph until you
- 12:48get to the end note and you stop
- 12:51so for example um
- 12:53generating random i've had 1500 lines of
- 12:55wu-tangler it's my favorite wu-tang
- 12:57wraps not all of them just my favorite
- 12:59ones i put into this
- 13:01beast of a
- 13:03input fed it into the markov thing it
- 13:06generated a graph and then i had it just
- 13:08sit there spitting out wu-tang lyrics
- 13:11and so i've got my glock like voltron
- 13:13which i think is
- 13:14like
- 13:17it's
- 13:18pretty good pretty aligned i don't know
- 13:20i'm stealing my glock like voltron it's
- 13:22the name of your new rap band
- 13:29that's a bar my clock like voltron bring
- 13:32to mother bring to mother bring it like
- 13:33it was kicking rhymes like your meth
- 13:35hidden caps on the gizza
- 13:37diluted broken down you ruined smokey
- 13:39bear when you don't need that wu-tang
- 13:40style like it's actually like not all of
- 13:42it's good like some of it's just kind of
- 13:43like
- 13:44like you know somebody's having a stroke
- 13:46but like some of these are like actually
- 13:49like pretty good lines you know
- 13:51chopping through your problems the gods
- 13:52are hotter than heavy metal frame like
- 13:54you know
- 13:56and if you uh
- 13:58are a fan of the wu-tang clan you
- 13:59probably recognize the wraps that some
- 14:00of these things come from right
- 14:03stop quick hold this so grab your whole
- 14:05era like i don't know i don't know what
- 14:06that means but it's it's provocative so
- 14:10uh
- 14:11testing on the declaration of
- 14:12independence
- 14:13i got this sentence he has endeavored to
- 14:15the lives our separation and of english
- 14:17laws of our trade with his assent to our
- 14:19constitution and hold them to dissolve
- 14:21the supreme judge of immediate and
- 14:22payment of constant guanudi we therefore
- 14:25the most wholesome and magnificent the
- 14:26people in accordance with deriving their
- 14:28country to the conditions of the right
- 14:29yeah
- 14:30the declaration of independence has some
- 14:32long-ass sentences in it and so um
- 14:35the odds of going to the end node
- 14:37weren't aren't very high and so you tend
- 14:39to get these very long run-on sentences
- 14:41which actually do kind of
- 14:42represent the declaration of
- 14:44independence to attend to the
- 14:45inhabitants of fatiguing them of an
- 14:46inheritable jurisdiction foreign
- 14:48mercenaries to all experience has shown
- 14:50that governments
- 14:53right but i mean this is
- 14:55a random generated thing but it sounds
- 14:57like
- 14:58the dui you know what i mean so
- 15:02um
- 15:03rap music's your favorite
- 15:06uh load data from disk three points
- 15:09so uh
- 15:10the this one is auto graded i believe
- 15:13and so
- 15:14um
- 15:17when you run it you can just print out
- 15:18your your graph
- 15:20and quit and so three of the test cases
- 15:22are based on that so
- 15:24you
- 15:25load the corpus
- 15:27you make a graph based on it and then if
- 15:29the user hits one it just prints it and
- 15:31then it quits
- 15:33three points
- 15:35part two generate random sentences you
- 15:37must use my random number generator you
- 15:39cannot use your own because it's going
- 15:41to be auto-grading you based on
- 15:44the the random roles you get have to be
- 15:46the same random roles i get
- 15:49and then visualizing it on bridges is
- 15:51three
- 15:52points okay
- 15:54so how do you load
- 15:57how do you load the data let's first of
- 15:59all take a look at this
- 16:01m4
- 16:03so this is hamlet's uh
- 16:05the soliloquy from was it act two or act
- 16:08three
- 16:16it's low queen act two
- 16:19uh no it's not it's
- 16:34so to be here not to be that is a
- 16:36question whether it is number in the
- 16:37mind service things in the narratives of
- 16:38our ages 4 channel take arms against
- 16:40troubles by
- 16:41opposing them to die to sleep to sleep
- 16:43to dream if i sleep
- 16:46tonight to sleep no more and if i sleep
- 16:47say in the heart i can
- 16:49so
- 16:50that's the whole thing
- 16:52and so
- 16:53we've got
- 16:55you can feed this in and then what
- 16:56you're gonna do
- 16:58is every single word here thousand and
- 17:01life and love and after all these words
- 17:05are going to go into a hashtag
- 17:07and that hash table
- 17:09because it's very easy to hash into it's
- 17:11very easy to find the record for after
- 17:14let's say so you go there
- 17:16and it's going to have just basically a
- 17:19vector of all the other words that come
- 17:20after it or a set
- 17:22of all the words that come after it
- 17:24and every time a word comes after it
- 17:26like death
- 17:27you put
- 17:28death into the set so you you find after
- 17:31you get it set
- 17:33and you stuff death into it and if it's
- 17:35already in there you increase its count
- 17:37by one
- 17:39okay
- 17:40that's it so what it looks like is this
- 17:42so if we come up here come into bridges
- 17:46markov
- 17:48archive dot reference
- 17:53so
- 17:55print graph
- 17:57so here is um here is the graph okay so
- 18:01every word in
- 18:03every word in the hamlet soliloquy goes
- 18:06in here and it's sorted by count
- 18:08okay
- 18:09so two
- 18:10is the word that appears the most in the
- 18:12act three soliloquy from hamlet
- 18:15happens
- 18:1715 times
- 18:19and
- 18:21it starts the sentence three times it
- 18:23ends a sentence zero times
- 18:25as
- 18:26once a comma following it
- 18:29and it has
- 18:3015 words coming out of it and it has 15
- 18:32words coming out of it because there's
- 18:34no
- 18:36you know
- 18:37it doesn't end the sentence ever so
- 18:38every time the word two kio appears in
- 18:41the soliloquy
- 18:42it has a word following it what words
- 18:44following it well
- 18:45be follows it three times
- 18:47suffer
- 18:49to suffer no more
- 18:52by silence
- 18:53in the heartache and the thousand
- 18:55natural shocks the flesh is there too
- 18:56does the consummation devalue to be
- 18:58wished
- 19:00to die to sleep to sleep for a chance to
- 19:02dream hi there's the rub
- 19:05um
- 19:07to die to sleep to sleep for a chance of
- 19:09dreams so sleep would come up twice you
- 19:11hear that
- 19:12to die
- 19:13to sleep
- 19:14to sleep
- 19:16for a chance to drink so sleep follows
- 19:18two
- 19:19twice in that little sentence that i
- 19:20said there
- 19:22loading alex jones rant oh
- 19:24could you find one for me i'll do it
- 19:26right now
- 19:27get get like a i need a lot of text
- 19:29because markov chains work best when you
- 19:31get like i need like
- 19:33i need like a kilobyte of alex jones
- 19:35ranting and i will put it in here and i
- 19:37will make a brand new alex jones rant
- 19:39that nobody's ever seen before
- 19:41thank you
- 19:42so you guys understand what's going on
- 19:43here
- 19:44so this is all just using standard
- 19:46library stuff
- 19:48oh
- 19:49just gonna be loading from a file one
- 19:51word at a time
- 19:52every time you load a word
- 19:54you add it to the hash table
- 19:56and every time a word follows a word
- 19:59you add to the count and so later on
- 20:01when you do the random lyrics generation
- 20:05then let's say we were on the the edge
- 20:08the graph vertex for two we roll a die
- 20:11how many
- 20:12we roll a 15 sided die
- 20:14if we get a one two or a three we're
- 20:16gonna output b
- 20:17if we get a four we output suffer if we
- 20:19get a five we have to take get a six or
- 20:22seven die
- 20:24eight nine or ten sleep do you
- 20:25understand
- 20:26and then we're now on sleep okay so
- 20:29let's say we
- 20:30did sleep uh
- 20:32where are you if you were asleep
- 20:49i know that happens what is it sorted on
- 20:52i guess it's just on the order that yeah
- 20:54i guess it's just the order they appear
- 20:56in the text okay
- 20:58question whether it's not really it's
- 21:00not sorted
- 21:07[Music]
- 21:10all right to sleep
- 21:13to dream perchance to dream right and so
- 21:16whenever you get to the sleep
- 21:18vertex
- 21:20there are
- 21:22three
- 21:23so sometimes it ends the sentence so
- 21:25twice
- 21:26when we got to sleep it ends the
- 21:28sentence
- 21:29and then three times it printed out a
- 21:31word instead to sleep to dream to sleep
- 21:34for chance to dream sorry
- 21:36okay
- 21:37and that's sleep of death what dreams
- 21:38may come when yeah so in that sleep of
- 21:43okay so when we get to the sleep edge we
- 21:45roll a five-sided die
- 21:48and if we get a one or two we end the
- 21:50sentence
- 21:51if we get a three we print out two we
- 21:53get a four we print out per chance if we
- 21:55got a five we print out up
- 21:59okay
- 22:00gives a consummation to value to be
- 22:02wished right uh consummation
- 22:04and so what this is doing it's learning
- 22:06the patterns of shakespeare okay
- 22:10so uh you're counting how many times
- 22:13words are appearing in a sentence
- 22:15that's part of it but what we're
- 22:17counting is how often a word follows
- 22:20another word
- 22:21so if if
- 22:22hamlet says
- 22:24in his speech the word of
- 22:27what word follows of
- 22:31okay we're not just making a random
- 22:33count of like
- 22:35how common different words are because
- 22:37then if you try generating sentences
- 22:39using that you're just going to get
- 22:41nonsense
- 22:42uh you're going to get like fortune
- 22:43perchance of uh the the
- 22:47outrageous fortune of the the the
- 22:50like you just get you get garbage with a
- 22:52markov chain it's about what word
- 22:54follows what word with what
- 22:56proportionality
- 22:58that makes sense
- 23:01[Music]
- 23:03wiki quote alex jones all right
- 23:07he's only three years older than me that
- 23:08dude looks like he's
- 23:10wow okay
- 23:12dang
- 23:14like i mean let's be honest here i've
- 23:16aged better than this guy like
- 23:18can we can we agree on this
- 23:22is that guy
- 23:24all right that's all it has this
- 23:26i don't think
- 23:37okay that's that's that's pretty good
- 23:39okay let's do this copy
- 23:41come into here
- 23:43and
- 23:44then alex jones
- 23:47there
- 23:51get rid of this kind of stuff all the
- 23:54header and footer stuff and get rid of
- 23:58quotes about jones we don't need
- 24:01these are all
- 24:02you've chosen the path of pain
- 24:05um
- 24:08citations we don't need
- 24:15um
- 24:17the alex jones show
- 24:18i think we need to delete
- 24:20all of these lines the alex jones show
- 24:24ashcraft how would you do that
- 24:26how would you delete all lines in vim
- 24:29that
- 24:30have alex jones show on them
- 24:37sashcrafter
- 24:39oh you cut out everything okay all right
- 24:41all right cool cool
- 24:42that's
- 24:44even
- 24:46faster i think
- 24:51uh it's empty dude
- 24:54cut out too much
- 24:55[Laughter]
- 25:03when he said i cut out everything you
- 25:05you were not you're definitely not lying
- 25:06okay
- 25:07you're continuing donations help keep no
- 25:09get rid of that all right there's a
- 25:11warfrog
- 25:20so just need to get rid of all lines
- 25:22that begin with the alex jones show so
- 25:25let's search for beginning with the no
- 25:28it's got indentation just search for the
- 25:30alex
- 25:32jones
- 25:33show
- 25:35and we'll go dd and next a bunch of
- 25:38times
- 25:40record a macro next dd
- 25:43stop recording the macro
- 25:46replay the macro
- 25:48and
- 25:49we'll just do this
- 25:52[Music]
- 25:55okay fast enough
- 25:57okay oh
- 25:58it seems like it didn't get this one the
- 26:00alex jones show
- 26:10next
- 26:22oh over deleted
- 26:32and then anything that has 2000 in it
- 26:39okay
- 26:40dd
- 26:41and next
- 27:39all right good enough
- 27:41all right
- 27:43yeah that was my bad with the empty file
- 27:46it was kind of funny though i
- 27:47got you a new one though
- 27:50uh yeah
- 27:51all right all right
- 27:52all right you got it uh did you is it
- 27:54from the same source is it from a
- 27:55different source
- 27:57it's on the same okay let's take a look
- 27:58here
- 28:04alex
- 28:15uh
- 28:17okay
- 28:17cool
- 28:21okay so let's uh print the graph for
- 28:24alex jones
- 28:35let's let's generate some random
- 28:37alex jones
- 28:39generate random lyrics how many
- 28:41sentences should we make what do you
- 28:42guys think
- 28:44how many alex jones rants should we make
- 28:47george soros or seven okay
- 28:50there you go please enter the random
- 28:52seed zero
- 28:54okay you will you don't think you're
- 28:56part of white men for you and a gimmick
- 28:59you know folks got a love play a little
- 29:01bit wild today excuse me i couldn't put
- 29:02on for no and remember that as if they
- 29:04want to get back there nobody effing
- 29:06moment of cowardice is there not even
- 29:07run your fault you understand that gives
- 29:09me so sweet hitler what i'm angry
- 29:14angry he was thinking in fact
- 29:17wow
- 29:20ireland the most ancient egyptian
- 29:22rituals some of liberty is what i'm not
- 29:25saying veterans are terrorists under
- 29:26rocks they reckon beat these insane
- 29:29people and i want to have youtube
- 29:30banning videos of that you this is the
- 29:33public had a bunch of white people just
- 29:34choking ah you're not the joker
- 29:36experienced
- 29:40[Laughter]
- 29:49that is amazing
- 29:50that is amazing ah
- 29:54uh you're not the chill we're gonna
- 29:56experience up but my testosterone is
- 29:58going to lose most of women across
- 29:59europe didn't happen oh my gosh
- 30:02oh my gosh doing this you're going to
- 30:04perception want to kill the same room
- 30:06with me you know your life and my spirit
- 30:08is cool you i can unlock a 55 year old
- 30:11uh ate a pile of myself
- 30:14from two other people that point the gun
- 30:16you know there's real culprit suicide
- 30:18bills alec baldwin thinks they're not
- 30:20being up and we're a gd to be proud of
- 30:23anti-human trash
- 30:24the reason you sons of it and afromother
- 30:27do whatever you do this isn't periable
- 30:29you're so royal we're such a devil you
- 30:31know
- 30:32we're all over you when never when never
- 30:34never said that attitude when they have
- 30:35you you're ah i want to lick the guns
- 30:38how much didn't happen
- 30:41parasites will return
- 30:49[Music]
- 30:54i'm sorry this is this is too amazing
- 30:56generate random lyrics we'll do seven
- 30:57more with a random seed of one this time
- 31:00okay
- 31:01uh
- 31:03uh is this same one nah all right yeah
- 31:05okay
- 31:06and alex
- 31:12oh
- 31:12dang it uh infowars.com liberties
- 31:15they're clearly used to
- 31:17your stinging guts well i've talked to
- 31:19get free will and staring at her yeah
- 31:20they're going to break your mommy and
- 31:22praising satan we're about family name
- 31:24in fact that you think i'd roll up
- 31:25killing me a mustache you were looking
- 31:27up against your wall i've told them
- 31:28they're
- 31:29i'm not their organs we're going to act
- 31:31like they're like this country over us
- 31:34i mean how i mean give up in this whole
- 31:36life 150 year old uh swam two miles away
- 31:38and harvest their heads disappear them
- 31:40take that they're tough enough and pants
- 31:42at the troops these people often just
- 31:43can't find the stuff that's what i do
- 31:45and you want to catch him calling dana
- 31:47lewis a car a real culprit suicide pills
- 31:49mass murder africa invasion force this
- 31:51because they want to have the smiling
- 31:53learning devil the ultimate buffoons the
- 31:54good knock then come for me
- 32:02what do you guys think pretty uh pretty
- 32:04accurate i don't know
- 32:06i got i gotta stab this one
- 32:15i i i'm gonna i'm gonna have to write
- 32:17this one down yeah
- 32:18that's that's just too funny
- 32:42some of these are even you know like
- 32:44okay
- 32:47can we have a s a copy of it of what of
- 32:50the
- 32:53uh what do you want a copy of ashcraft
- 32:56the paragraph
- 33:02[Music]
- 33:10is
- 33:20[Music]
- 33:24all right
- 33:26there you go
- 33:27so that's uh peak uh computer science
- 33:30for today i think okay let's talk about
- 33:32how to do this right
- 33:35um
- 33:40so if you look at name dot cc
- 33:45um we're gonna be using hash tables
- 33:47which is an unordered map all right
- 33:51and uh let's see do we have a hash table
- 33:53hash tables how do we do it no
- 33:55just have a vertex of edge okay
- 33:58so a vector of edges so
- 34:02probably could be improved with a set
- 34:04but
- 34:06okay
- 34:07so basically every edge represents the
- 34:10word that you're connected to and the
- 34:12count of how often
- 34:13you
- 34:14um
- 34:15go in that direction so if you've got a
- 34:18a bunch of words
- 34:21and for the word
- 34:25joe
- 34:27if 99 percent of the time the word that
- 34:29follows it is rogan
- 34:31then
- 34:32joe would be a vertex
- 34:34all right
- 34:35and
- 34:36it would hold the word joe there
- 34:38count is how many times the word joe
- 34:40appears in the entire corpus
- 34:42and then it's going to have edges
- 34:45to all of the words that follow it
- 34:48so for example there's holloway joe and
- 34:51there's joe rogan experience
- 34:53so like maybe 99 of the time alex jones
- 34:56says rogan following the word joe but
- 34:58maybe one time he says hall after joe
- 35:01then
- 35:02your vector of edges would have two
- 35:05elements in it the first would be
- 35:07an edge
- 35:10holding rogan
- 35:11with a weight of however many times the
- 35:14word rogan follow joe
- 35:16and then you would have a second element
- 35:18in the vector holding the word
- 35:21hall you know for like holloway joe the
- 35:23sea shanty force
- 35:24and
- 35:26then that would have a weight of one
- 35:28because it appeared one time after
- 35:31after joe
- 35:33you guys understand
- 35:34so this is the data structure we're
- 35:35going to be using
- 35:37so we're just going to have a hash table
- 35:40uh
- 35:41right i've already that's cool i've
- 35:43already got a double left error operator
- 35:45done for you so you don't have to even
- 35:46format all that stuff it just prints out
- 35:49all that stuff for you that's cool
- 35:52functions uppercase 5 functions to
- 35:54lowercase if i functions to
- 35:57capitalize just the first letter
- 36:01so when you generate random sentences
- 36:03the first letter in a sentence should be
- 36:04capitalized and the rest should be
- 36:07lowercase
- 36:08but the the graph itself will have
- 36:10everything in uppercase
- 36:14um
- 36:15i wrote a function to strip brackets
- 36:17because
- 36:20a lot of the wu-tang
- 36:21lyrics
- 36:24would say like bracket you know method
- 36:27or whatever
- 36:28odb
- 36:30and so this this function here strips
- 36:32everything within square brackets also i
- 36:34think for maybe hamlet and stuff like
- 36:35that
- 36:36it'll have like hamlet in brackets and
- 36:38so this just strips everything out in
- 36:40brackets in the input corpus
- 36:43okay um yeah so here we go so here is
- 36:46here is the data structure the data
- 36:47structure and this is why i now require
- 36:5041 to take this class because this class
- 36:52is built on the success of 41.
- 36:56if you haven't taken 41 with me then
- 36:58i can go over how these things work but
- 37:01it's basically a hash table if you know
- 37:03what a hashtag works
- 37:09the key that we're searching for is the
- 37:12word like joe
- 37:14and then it's gonna the hash table is
- 37:17just a
- 37:18it hashes between
- 37:20joe
- 37:21and the index
- 37:23of the
- 37:24graph
- 37:25so the hash table just as a quick look
- 37:27up in the graph so that we don't have to
- 37:28search through the whole graph every
- 37:31time
- 37:32instead
- 37:33if joe is in index 50 in the graph we
- 37:36say hey where's joe index 50 cool and
- 37:38then we jump to index 50 in the graph
- 37:41here and this is gonna this hash table
- 37:42here just makes looking up
- 37:46looking up entries in the graph easy and
- 37:48it's a vector vertices and each vertex
- 37:50has a vector of
- 37:53edges coming out of it
- 37:55and each edge holds
- 37:57a word which and if you want to find out
- 37:59where that edge leads to
- 38:01that word joe or whatever you can hash
- 38:04that and it's like oh well that one's at
- 38:05this index here
- 38:07rogan it's at that index there and so
- 38:09you can quickly look up
- 38:11where these things are
- 38:13in the graph
- 38:25so the code to print the graph is
- 38:30done
- 38:31so for every vertex in the graph it
- 38:33prints it
- 38:35uh but you need to do the code to load
- 38:38it
- 38:40so you have to load
- 38:42you have to load the file
- 38:46so you're gonna read through this this
- 38:48file that holds all of the you know
- 38:53hello world okay
- 38:57so
- 38:58it's gonna read two words and your graph
- 39:01will have two nodes in it one is hello
- 39:04one is world
- 39:06hello is a start node world is an ending
- 39:10node in other words the only transitions
- 39:12out of world art ending
- 39:15so you can use that to test your code
- 39:19toad style is immensely strong and
- 39:21immune to nearly every weapon when
- 39:23properly used it's almost invincible
- 39:25that's from five deadly poisons i think
- 39:27also quoted by wu-tang clown
- 39:30okay there's a couple really short
- 39:32corpuses and again you should test your
- 39:34code
- 39:35right like make a little thing like
- 39:38um
- 39:39[Music]
- 39:44and then your
- 39:46your markov graph will say 100 of the
- 39:48time
- 39:49b will be followed by an a
- 39:52okay
- 39:53for a's
- 39:54one two
- 39:56three four times a is followed by
- 39:58another a
- 39:59one time a is followed by a b one time a
- 40:01is followed by a c
- 40:03a starts a sentence one time
- 40:06c ends a sentence one time and that's
- 40:08the graph okay
- 40:11you guys will have nine days to do this
- 40:13it's a fun
- 40:15fun project
- 40:16because you can take anything you want
- 40:18you can take the entire bee movie if you
- 40:20want
- 40:21and
- 40:22generate new new sentences brand new
- 40:24sentences never seen before by humans
- 40:27that are in the style of the b movie or
- 40:30you can take alex jones and generate
- 40:33brand new alex jones sentences or wu
- 40:35tanks you know
- 40:36lyrics and things like that
- 40:38i'll be strictly using hack political
- 40:40pundits yeah we need to get like a
- 40:43like one of those text-to-speech engines
- 40:44you know
- 40:45and just uh
- 40:47wonder if that exists
- 40:50we're basically out of time for today
- 40:51aren't we i know if there's like a
- 40:54alex jones text
- 40:57speech
- 40:58somebody done that there's gotta be
- 41:04vocal synthesis okay
- 41:06what the [ __ ] did you just talking said
- 41:08about me little [ __ ]
- 41:10i'll have you know aggregated jump of my
- 41:13class in the navy settles and i've been
- 41:15involved in numerous sacred raids on
- 41:17altiga and i have over 300 confirmed
- 41:20channels
- 41:21that's not quite
- 41:23too
- 41:24uh accurate but
- 41:26uh
- 41:28huh
- 41:29yeah maybe maybe i can get maybe get
- 41:31that sentence
- 41:34uh text-to-speech in
- 41:37his voice that'd be pretty fun
- 41:42google translated then just have it read
- 41:43it
- 41:45but it doesn't have a it doesn't have an
- 41:47alex jones voice you know
- 41:49okay
- 41:52okay any questions about the homework
- 41:55any questions about the dijkstra's
- 41:56assignment
- 41:57i think what i showed you was pretty
- 41:59much most of the
- 42:01thing and i did turn on recordings
- 42:03you're you're free to
- 42:05to dig into the youtube recording of it
- 42:07and
- 42:08fix up your code
- 42:11so i want to see everybody getting 20
- 42:13out of 20 on this okay
- 42:17a lot of people didn't show up today
- 42:18probably because the assignment was
- 42:21tough or something
- 42:22okay
- 42:24all right so that's it for today guys uh
- 42:25i'm gonna sit here and enjoy
- 42:32my alex jones generator
- 42:37oh here's the b movie
- 42:42kind of a bee community
- 42:45back to change have some lights on
- 42:46steroids
- 42:48what were with a human race can she's
- 42:50human girlfriend tea time snack
- 42:52garnishments
- 42:54bees are cut flowers and be a fellow
- 42:59that's jones
- 43:04oh my gosh
- 43:06if suddenly it starts the foreign war
- 43:08powers act you
- 43:18black uniforms grabbing a jellyfish
- 43:20slacker who were building fema camps in
- 43:22history and a swam to the other do oh
- 43:24what if he was called a lot of a loser
- 43:26you filthy vampire like 11 people all
- 43:28over again put a nast
- 43:29[Laughter]
- 43:35how do you set up bridges on a local
- 43:36machine um you have to go to the
- 43:38bridges.uncc
- 43:40i don't know it's bridges.github.io
- 43:43it's got to download there
- 43:50bridgesuncc.github.io yeah it's got the
- 43:52downloads
- 43:53on there
- 43:57and then uh
- 43:59yeah
- 44:01that's it
- 44:03so if that was fun for you all today
- 44:05it's fun for me
- 44:07so max flow we'll do another um
- 44:10we'll do another minimal spanning tree
- 44:13we'll do max flow and uh i'll test your
- 44:15knowledge on markov on the quiz today
- 44:17okay
- 44:18all right see you guys on thursday and i
- 44:20hope you all get your bridges done by
- 44:23then
- 44:24peace out
About this transcript
This page contains the full transcript of Markov Chaining (to generate Fake Alex Jones) by Bill Kerney, generated from the public captions YouTube serves with the video. The transcript has 6,019 words across 1,120 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.