Kadhim Shubber Markov Text Generator

Well, it’s Christmas so I’m taking on stupid self invented programming projects, much like last year with Selenabot. This year I’ve decided I’m going to create a Markov Text generator that recreates the work of a Young Kadhim Shubber (YKS).

I’ve decided to scrape all Kadhim’s work on Felix that’s available in non-PDF form (for now… if this becomes very easy perhaps I’ll try and automate PDF reading so we can even get his frozen hot-takes on world politics from 2008).

First order of the day is making a markov text parser and generator that work in python3. I forked an old python2 code I found on github into Markov_text3, which is a python3 module for generating Markov chains of text from a given source (saved as a .txt file).

Now we have Markov_text3, I need to get the source material. Having a quick look at Kadhim’s page on Felix (http://felixonline.co.uk/authors/ks607/) he has around 140 articles online, although not all of them published under his name are written by him (he used to be editor and thus I guess uploaded other people’s stuff). It appears to be material from pages 6 & 7 (his later work) so I’ll scrape that material manually.

Mid-Jan Update: I got busy over the xmas holidays and this project fell by the wayside, the main problem was that I have completely forgotten how to use Beautiful Soup properly and thus couldn’t easily get a list of all the articles that Kadhim had written. This was stupid because I managed to get a Markov Generating script going quite nicely.


The Last Jedi

Contains Spoilers

One word Review: Lazy

9 Word Review: Lazy reliance on pantomime to cover a weak script

1,978 word Review: Lazy reliance on pantomime to cover a weak script became a staple of the Marvel Universe films since the first Avengers movie, and appears to be spreading through Disney’s other big franchises like syphilis through a nursing home. It is abundantly present in Star Wars: The Last Jedi.

The Last Jedi’s script is all over the shop: too many characters and too many half-hearted storylines. The cement that holds this mosaic of mediocrity together is panto japes, which is a shame because an economically written script with a few jokes thrown in for relief could’ve been doable with the story they presented, and would’ve been preferable to what we actually got given.

In moderation, playing for laughs works really well, especially when it stops the film from getting too bogged down into cliches of its own creation. Let’s take the example of the caretaker fish/bird/nun critters on the island. The quick, simple establishment of them having a matronly hostility to Rei and the conclusion of their arc as the comedy pin used to safely deflate the over-blown Lightsaber training montage was a great example of comic relief. The look of stoic loathing when Rei sends a boulder crashing into their wheelbarrow was a perfect resolution to the training montage that got carried away with silhouetted aerial shots and sweeping orchestral scores, fast becoming a piece of self parody. It was definitely Panto, but it was well executed and served a purpose. Compare these caretaker critters to the Porgs (pictured above), who were supposed to be set up as a comedy counterfoil to the now devastatingly solo sans-Solo Chewbacca. Instead, they have no clear purpose — not even to deliver a gag like the caretaker fish-nuns– and appear to exist purely to eat up large portions of the scant screentime alotted to Chewie, whilst preventing Chewie from eating one of their own.

Leaving Panto aside for one minute, the interplay between Chewie and the Porgs brings up a second major flaw that the script kept committing: too many characters. I don’t really understand why they bothered bringing Chewbacca into the script to so blatantly under use him. Chewie, logically, is one of the most interesting characters in this whole film: a lovable sidekick whose loyalties have proven unquestioningly true who is now left alone. The only short insight into his grief is when, upon opening Skywalkers’s door with a hairy paw, Luke asks “Where’s Han?” and the Wookie emits a particularly sad cry. Chewie is now reduced to semi-inexplicably playing taxi driver to one of the three protagonists, and the relationship between Chewbacca and Rei, which presumable had plenty of time to develop on their pan-galactic hop to turn up just in the nick-of-time remained largely unexplored in a way that was irritating.

Bringing in characters to then not bother with them has become a somewhat recurring theme in these new brace of Star Warses, and isn’t limited to just Chewie in this film. Rogue One saw the complete waste of Mads Mikkelsen talents as a guy who turns up, sets a few plots half-rolling, and then dies. This film even more insanely wastes the towering talents of Benicio Del Toro, by setting him up to be an interesting enigmatic character who could really take the plot in interesting directions, but instead sells him out as a Lando-lite betrayer, except the script forgot to make us really trust or care about him (unlike Lando in Empire), so the audience don’t really feel his betrayal (unlike Lando in Empire) and ultimately his betrayal doesn’t really result in any major plot changing events (unlike Lando in Empire) so why did we even bother? And also, if we’re bringing back characters why haven’t they bought back Lando? An entire act of Last Jedi took part in a sleazy casino full of unethical millionaire gambling traders: Lando presumably owned and/or was imprisoned in the joint. If this franchise has one eye constantly winking to its past, why didn’t we get him back, perhaps to have a scene with Chewie where we could get some meaningful morning over Han? That way we could’ve avoided having to bring in an underwritten new character, and got some actual leg work out of another bit character.

One character we did get back was Master Yoda, to provide advice to Luke Skywalker. Given the context that Luke was a self-exiled Jedi Master who hates himself and everything he once stood for because he was responsible for the creation of the bad-guy who is now destroying the galaxy, Obi-Wan Kenobi would’ve surely been a more useful character to have turn up, given his extensive experience in the matter, but Alec Guinness died 17 years ago and thankfully they didn’t attempt a rerun of the weird CGI Peter Cushing of Rogue One. Yoda has been one of the most malleable characters in movie history. An Orientalist trope in Empire, an Oracle of doom in Return, and a sort of superhero Hans Moleman in the prequels, he returns in Last Jedi as a combination of all three, to help Luke carry out some casual firey iconoclasm before kicking the mid-life crisis ex-protagonist into action. His frustration at Luke for still not really learning anything that he’s been taught for decades was palpable, and elicited a sympathetic response in me because Luke, and a lot of his plot, are inherently frustrating in this film.

Inherently Frustrating

The script of this whole film fails at every point where Luke Skywalker is concerned. As I’d alluded to above, the basis of Luke’s plot line in this film is that he’s banished himself to a remote location to avoid Jedi-haters and to reflect on his own failing and responsibility in allowing the Dark Side to rise. This would be interesting, were it not also the exact arc that Old Ben Kenobi goes through in A New Hope, a fact the film even plays up to it wheeling out R2-D2 and the “Help Us Obi Wan” video clip, which even Luke points out is a “cheap trick”. The Last Jedi script blows though because Ben Kenobi actually turns out to be useful for both the audience and the protagonist, wheras Luke takes us on a mute hike up a mountain to milk some some Snorks — using pantomime to hide a poorly written script.

Luke’s choice of refuge seems thoroughly baffling. He refers to his hideaway as the “Hardest to Find place in the Galaxy”, but he’s hiding out at the literal centre point of his 10,000 year old religion. That’d be like the Pope going into hiding in the Basillica of the Nativity in Bethlehem: really obvious and a location that’s surely known to a few scholars here and there, especially as it appears to a) have magic rocks and caves and shit that clearly have strategic powers and b) an entire economy of fish-bird-caretaker nuns that doesn’t appear to be self sufficient (they have wooden tools on a completely deforested island). The script’s choice of hiding place for Luke is poorly thought through, the location too important to have been lost, and thus not really a good hiding space at all. But hey, it’s got Porgs, so we can smooth over these cracks in the script with more panto-plaster.

These are trivial complaints about Skywalker’s plot line though, and do not compare to the completely screwed up revelation that Luke kinda forced Han to hand over his only son to Luke to train into a Jedi, which Luke the royally ballsed up, before deciding to murder a defenseless teenager, deciding against it, ballsing that up too, and then setting into motion the creation of Kylo Ren.

Let’s pause here, we’re supposed to be sympathetic and hopeful about a character who tries to kill his nephew and then lies about it to everyone. His best friend dies not knowing that the reason his son hates him is ENTIRELY JUSTIFIABLE. His own sister appears to be unaware of this completely mental revelation. The effect of this completely mad bit of writing is that it renders Kylo Ren the most sympathetic character in the entire film. His offer to Rei after the death of Snoke of “let’s let both sides go to hell and start this galaxy again” is the most sensible idea anyone comes up with in the whole film, and entirely justified considering everything that’s happened to him. By rejecting his offer, Rei come accross as the brainwashed violent fundamentalist, not Kylo.

We don’t really get any resolution to this either. The now inadvertent good guy, Kylo Ren doesn’t get to kill the tyrannical Luke by his own hand, instead Luke inexplicably wafts off in a billowing gas of hot air after serving as a time-wasting distraction in an otherwise interesting battle, his death serving as a perfect metaphor for how his character was written throughout the shonky script. Luke and Kylo will presumably have some beyond-the-grave reconciliation moment in the next film, with the potential for a problematic scene where an abuse victim has to ask for the forgiveness of his abuser.

I could go on and on, and already have. So here’s a quick bullet list of parts where I thought the film succeeded.

  • The battle on the snow covered red-dust planet allowed for some excellent visuals, allowing the film to echo familiar scenes from the Battle of Hoth but putting a novel twist on them that made the battle genuinely exciting.
  • The ultimate emasculation of the alpha male by a team of experienced, thoughtful¬† and powerful women, despite the alpha male constantly trying to undermine them to the point of literal mutiny was genuinely satisfying. In a rare show of strength of the script that the idea that Vice-Admiral Holdos was a baddie undercover or wildly incompent was kept close to the chest and perhaps the only bit of the film where they mostly managed to reveal the plot using show, not tell. Of course, the script then did derail because not only did they also choose tell to make sure the people at the back of the theatre understood, they then had to send this carefully developed powerful female character on a suicide mission to save the bloody irritating alpha male. But points for trying, and the scene where she became a hyperspace bullet was genuinely cool.
  • The 37 seconds Benicio Del Torro was on screen he utterly ate up. That man could read a phonebook and the result be edited by a 15 year old Media Studies student and it’d still pack more nuance and powerful than films can manage.
  • I wound up buying into the relationship between Fin and Rose way more than I thought I would. The symmetry of her saving him from betraying himself at the beginning and dragging him on a trolley to the brig compared to him saving her from death by storm troopers and dragging her to the Falcon on a trolley at the end was subtle enough to be enjoyable, and her lesson that battles are best fought for the ones you love, not against the ones you hate, was the only clear uplifting message that came from this otherwise insane scattered patchwork of a script that tried to get us to sympathise with a violent abuser hermetic freak. The resolution of this potential Fin-Rei-Rose love triangle is one of only two thing i’m looking forward in the final part of the trilogy (the other one being more shots of Adam Driver topless in leather trousers)

In conclusion, a terrible script with too much winking and panto to be worthy of being a fully fledged star wars film. As bad as the lowest lows of the reviled prequels. I really hope¬† John Boyega and Kelly Marie Tran’s (and to a lesser extent, Daisy Ridley’s) careers can survive one more assault from this rapidly crumbling franchise.


How does an algorithm tweet a selfie?

A few weeks ago whilst reading a hand-wringing article about how automated content production on YouTube & social media will lead to the inevitable collapse of western civilization, my mind wondered to the idea of social media content algorithms behaving like real social media users. Then the stupid question at the top of this post popped into my head and the stupid answer popped in right afterwards. An algoritm’s selfie would be its source code. I’m a big fan of contextless text robotic tweets, especially @IAM_SHAKESPEARE, and have always wanted to own one of my own. So I filed this in my head under “stupid programming exercise to do when you’ve got nothing on” and got on with my life, which currently involves a lot of redecorating.

Fast-forward to today, where I am in day 2 of what feels like a 2 day cold. I’m too bleary and snotty to concentrate on anything serious like my job, but I’ve also just slept for about 18 hours, so I needed some moderate activity to tire me out in preparation for another long sleep. 2 hours later, I present you with @Recurbot.

Code below, but basically it’s a standard twitter bot that reads itself, chops three random lines out of itself and then tweets them. I chose to make it random, as opposed to sequential, to add a bit of variety to it .


So far I’ve not set this up to be automated yet, it’s just running manually when I execute it on my laptop. I’m going to use this as an excuse to start playing around with pythonanywhere.com to see if I can get it to work there. If I can, i expect i’ll set it up to tweet every 2 hours.

Further work?

By picking three random lines the bot has 27 unique tweets, whereas going through the code sequentially in 3 line chunks would only give 10, a 170% increase in content !! I’m not sure if I should beef up the code by adding in the module that it currently imports: Random.py, json.py and tweepy.py. Random.py is 726 lines long and obviously most of it isn’t really used in the production of the tweets — only randint is called once to get a number between 0 and 27. The more of this paragraph I write, the more convinced I am to just leave it at 30 lines long and let it have some repetition. After all, the bot that tweets Shakespeare is on it’s 4th run through and it doesn’t make it any less amusing when it pops up in my work feed.

Speaking of which, I’m going to finish my off-brand lemsip and go back to bed.