-
8 votes
-
Cuco - Lover is A Day
2 votes -
With a heat wave coming this week, this video reminds me of the good times when everything was green
3 votes -
After the Fall: Ten Years after the Crash
10 votes -
Australian states and retail chains ban single-use plastic bags
16 votes -
The Dear Hunter - A Night on the Town (2015)
6 votes -
Poland's supreme court constitutional crisis approaches a standoff. The government’s attempt to lower the mandatory retirement age of judges is due to come into effect this week
8 votes -
Ten best tropes in fiction
2 votes -
Seven common (non-sleep-related) reasons that people feel tired
8 votes -
One sinking city's fight against rising sea levels
4 votes -
Reddit Playlists - Reddit Playlists - Create Playlists from a subreddit
8 votes -
The surveillance economy and extreme income inequality: You can't have one without the other by Jaron Lanier
5 votes -
Anti-union laws associated with significantly more workplace deaths in US states, 1992-2016.
12 votes -
It would be nice to have a wiki so that we can document tildes
Any plans to implement it in the future?
9 votes -
Canada tariffs on US goods from ketchup to lawn mowers begin
24 votes -
I created anime girls based off of areas that were in Disney's Hollywood Studios (in 1999 at least). Drawn in MSPaint.
7 votes -
The great firewall of China: Xi Jinping’s internet shutdown
12 votes -
Programming Challenge: Markov Chain Text Generator
Markov Chains are a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. By analyzing a...
Markov Chains are a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. By analyzing a document in some way and producing a model it’s possible to use this model to generate sentences.
For example, let’s consider this quote:
Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.Let’s start with a seed of
be, which there is only one of in this text and it’s following word iswho. Thus, a 100% chance of the next state beingwho. Fromwho, there are several next states:you,mind, andmatter. Since there are 3 options to choose from, the next state has a 1/3 probability of each. It’s important that if there were for example two instances ofwho youthenyouwould have a 2/4 probability of next state. Generate a random number and choose the next state, perhapsmindand continue until reaching a full stop. The string of states we reached is then printed and we have a complete sentence (albeit almost certainly gibberish).Note: if we were in the state
mind, our next two options would be.ordon’t, in which if we hit.we would end the generation. (or not, up to you how you handle this!)To take it a step further, you could also consider choosing the number of words to consider a state. For example, two words instead of one:
those whohas two possible next states:who matterorwho mind. By using much longer strings of words for our states we can get more natural text but will need much more volume to get unique sentences.This programming challenge is for you to create a Markov Chain and Text Generator in your language of choice. The input being a source document of anything you like (fun things include your favourite book, a famous person’s tweets, datasets of reddit / tildes comments), and possibly a seed. The output being a sentence generated using the Markov Chain.
Bonus points for:
- Try it a bunch of times on different sources and tell us the best generated sentences
- Using longer strings of words for the state, or even having it be variable based on input
- Not requiring a seed as an input, instead implementing that into your Markov Chain (careful as infinite loops can occur without considering the seed)
- Implement saving the Markov Chain itself, as it can take very long to generate with huge documents
- Particularly Fast, efficient, short or unique methods
Good luck!
P.S A great place to find many large plain text documents for you to play with is Project Gutenberg.
17 votes -
Bitcoin bloodbath nears historic levels
21 votes -
Democrat. Dictator. Which path will Thailand's Prayuth Chan-ocha choose?
6 votes -
LeBron James signing with Los Angeles Lakers in $154M bombshell
12 votes -
500px will no longer allow photographers to license their photos under Creative Commons, and closes 500px Marketplace
27 votes -
The World Ends With You: Final Remix details new elements, story, characters, more
8 votes -
With Wimbledon about to start, who are your favorites?
I think Kerber and Keys are my favorites to reach the final on the women's side, and Federer and Del Potro are my favorites on the men's side.
7 votes -
CHVRCHES - Get Out (2018)
7 votes -
Milfred Graves Quartet (1973)
5 votes -
The marginalisation of Indonesia's LGBT community is fuelling an HIV "epidemic", with HIV rates among gay men increasing five-fold since 2007, according to a Human Rights Watch report
11 votes -
A mass colony of tent spiders have created a mesmerising display in a nature reserve on Australia's east coast, capturing the imagination of locals
15 votes -
Bruce Springsteen - I'm On Fire (2009)
5 votes -
A digital capitalism Karl Marx might enjoy
3 votes -
A spymaster steps out of the shadows
7 votes -
Interposers, chiplets and... butterdonuts?
4 votes -
Secret Hitler - story time
I've recently played really good game of Secret Hitler, so I wanted to let you know about it. If you don't know Secret Hitler, it's great game and I'll briefly describe it below. You can play it...
I've recently played really good game of Secret Hitler, so I wanted to let you know about it. If you don't know Secret Hitler, it's great game and I'll briefly describe it below. You can play it online, for free, without ads at secrethitler.io (opensource). You can as well buy it, or even just download pdf, print it and play with paper cards!
Secret Hitler summary
Game for 5-10 players, tabletop. Players are divided to Fascists and Liberals. One of fascists is Hitler. Fascists knows who is who, but Liberals don't know anything. There is chancellor and president, players vote them and they elect laws (president receives 3 laws, 1 discards, 2 passes to chancellor, which discards 1 law and the other one passed). Fascists win, as 6 F laws passed or Hitler was elected as chancellor with 3 or more F laws. Liberals win, if 5 L laws passed or Hitler was killed. If you want to know more, watch some gameplay at YouTube, it's really interesting game about lying to people and manipulating them. And if you will be interested in the game, we might play it together online :-)
I was a Fascist. Right on the first turn as president, I got 3 Fascists laws and I selected Hitler as chancellor - I had to because of order and it would be suspicious not to do so. So I passed him the laws and he of course had to pass Fascist law. But then, he peaked (because 3rd F law passed) at top three cards and lied about it (said FFL, was FLL). Because of this, everyone, after few turns which revealed he lied, started suspecting him. When the liberals had 4 laws passed, I tried as hard as I could to defend Hitler - he just missclicked (no, he would told us!), you know it. After about 10 minute discussion, my propose was rejected, someone else elected as Chancellor and Liberals won the game.
Leave your own stories in comments and be sure to tell, if you would like to play this with other people here, it's wonderful game. And if you would like to, I have other stories - for example when we (IRL) played Secret Hitler to 3 AM, and at the last but one turn, everyone went extremely suspicious and we played one turn almost hour and half (I don't lie about this, I started to measure it after 20 minutes of discussion).
20 votes -
Manhunt underway after notorious French gangster Rédoine Faïd breaks free from jail in dramatic helicopter escape
8 votes -
Deaf West - The Word of Your Body (reprise) (2016)
3 votes -
We're experiencing the biggest revolution in movie ticket prices in decades
8 votes -
Tesla hits Model 3 manufacturing milestone, hours after deadline
23 votes -
Sky-high deductibles broke the US health insurance system
13 votes -
Susan Collins, pivotal US moderate, says ‘hostility’ to Roe would sway her vote
13 votes -
Americans Seek to Escape News
19 votes -
What's your favourite Mountain Goats album?
I can't decide between All Hail West Texas and All Eternals Deck. Darnielle is so fantastic at his craft.
4 votes -
I am a bookkeeper and small business consultant, AMA
My background: I've run a small bookkeeping business in California for the past 6 years, and worked as a bookkeeper for another 6 years before that. Over the years I've been deep in the books of...
My background: I've run a small bookkeeping business in California for the past 6 years, and worked as a bookkeeper for another 6 years before that. Over the years I've been deep in the books of dozens of businesses, both successful and not. In the process of working closely with the owners of said businesses, I've learned a lot about what makes a small business work and what means I shouldn't get too attached. I'm a generalist, working with for and non-profit businesses as well as well to do individuals (who often have financial lives more complex than my business clients.)
I'm bored and it's a smoky Sunday trapping me indoors, so if you have a question about bookkeeping or running/starting a small business, fire away.
16 votes -
Really cool video of yesterday's Fortnite event
5 votes -
Ramses Rambles: Teenage Mutant Ninja Turtles
9 votes -
Russia wins over Spain in penalties to advance to quarter finals
9 votes -
Something Else: A 1970s youth programme from the BBC
6 votes -
Why does the theme change back to white every time I log in?
Kind of annoying having to change the theme back every time
9 votes -
It Is Happening Here, Trump Is Already Early-Stage Mussolini
23 votes -
European Central Bank president Mario Draghi warns risks from trade war may be understated
6 votes -
Drawn from life: Why have novelists stopped making things up?
6 votes