Friday 21 February 2014

Markov Chains: letting the evening post write for itself

A quick grep of the internet thows up a Markov Chain generator in the Python programming language.

This program takes the name of a file, parses all the sentences to build a table of the words seen to immediately follow all the other words -and their probabilities of being chosen. For example, "lycra" is followed by "lout" 80% of the time, "clad" 20% of the time.

It then randomly generates sentences using these probabilities, so if it ends up at the word "lycra", it rolls a die and picks "lout" four times in five, "clad" one in 5. Then it does the same thing for "lout" and "clad", respectively, until you have a whole article.

Markov Chains are useful in more places than just evening post letter generation; Google's core page-rank algorithm simulates a markov-chain walk of the entire internet, clicking through one link at random on a page, measuring the probability of reaching the destination page. Those pages that you are more likely to end up on come out higher in the search terms. Readers will now know enough to pretend they understand google web page indexing to scare their friends.

Taking this code, and a set of past evening post articles and letters, we can now generate coherent -yet original- letters for the paper

Example 1
by their arrogance." Mr Drummond, who was struggling to get the message. GRIDLOCK in urban areas is costing households, throughout the winter months and more pedestrians, is it with some Bristol cyclists? The other night I was met with typical cyclist arrogance. It should be fines for cyclists just as much right as they belt along in their pockets, not holding onto the handlebars (no doubt they think this is cool) and adults on children's bikes. And cyclists on pavements or controlled crossings following a lorry along there, who was bombing down the centre with sets of traffic lights is the same as someone who uses their car for every journey (as Frank Woodman – February 11 – seems to confirm my prejudices. In just two hours, at just one junction, the police to take up these modes of transport. "Part of this is an example of a sudden and started mouthing off before jumping the red light. Maybe I was following a lorry along there, who was at fault for not wearing my night vision goggles. One morning on the pavement and they fear the city's pavements. The idea for the accidents they cause. The government has said that it is possible that he would organise a meeting where a chairman and other continental countries, and we can find the money being spent to turn a blind eye to cyclists and sent them to the cheaper alternatives? Because most people of working age live busy, stressful lives, so choose convenient transport over cheap transport. SO Mayor Ferguson and, hopefully, encourage him to move on to households. Traffic congestion, therefore, is reducing productivity, leaving commuters with higher bills and less time, as well as council tax which cyclists do very little room to pass. Then, as I reached my destination cyclist
Run 2

dressed in black are the main cause of road congestion. I regularly cycle to work using use the pub's toilet. "I waited outside for her, but I could not get up on the busy road. Between condolences, one resident says: "The hill is treated like a knife through butter. It is encouraging to see," he tells me. "Everyone is pleased with the rest of the stunt cyclists and they were to get any worse, not spending it on actively increasing congestion and pollution, and creating new problems? Another report from last month tells us that the report does not condone this activity. "But we do not adhere to the rules of the roundabout and pulled out straight in front of them and cyclists adhering to the radio. I don't want my young children killed or injured by motorists each year By The Bristol Post welcomed the crackdown and said I was a major issue for the pressure group designed to protect pedestrians against rogue cyclists. He said: "I am all in favour of it. "The problem is that there's a lot of money being frittered away on the pavement cyclists are as wide as cars! I also appreciate not all cyclists behave like this, just the vast majority, especially the Lycra ones who think they are faster. 20 billion pounds of damage to business is caused by buses and more importantly, improve the car drivers in Bristol have been visiting Bristol from their home in South Gloucestershire Council. 
Run 3 -which actually seems more coherent than "Frank Woodman".

sheer number of cyclists to have advised him to move on to the pavement, as I like to see a massive difference. "I don't think there are many others all over the years? There are more motorists than cyclists, it makes perfect sense to just ban them! Why not a cycle-free day for Bristol drivers? I HAVE just read an opinion in this area, but dangerous cycling is. "Cycling City is helping to address the challenges facing its road network and the reduction of average speeds for motorists. We also have, newer inadequate street lighting, I’d like to add, whizzed by in the city. The number of cyclists ignoring every red light whilst I and the abhorrent decision to allow dogs into council owned properties. I have seen pedestrians walking out in front of them were dressed in very dark and a better quality of life through reduced congestion. In Bogota they instigated a policy of putting even more people at risk in an attempt to raise more funds, through fines, for the accidents they cause. The government has said that it plans to spend millions on projects as part of the stunt cyclists and drivers. If you think I am sure each and every time someone turns up a bit shaky with a sense of self-righteousness, superiority and entitlement as they have. Then there are the young children killed or maimed by all the time we were disgusted by their arrogance." Mr Drummond, who was bombing down the pavement is really quite dangerous. There were lights on my car just once a week ago today. Last week police were out in force at Zetland Junction in Gloucester Road, which is not much done about their attitude and to make the roads are paid for by general taxation.

we  may do this regularly -just collect more articles and letters every week for a better dataset.

No comments: