Show HN: MrMarkov (Markov Text Generator as an API)

https://news.ycombinator.com/item?id=8565871
by binalpatel • 12 years ago
2 1 12 years ago

http://mrmarkov.herokuapp.com/text

Hi all, this is a personal project I've been working on for two weeks or so. I was interested in Markov Chains, and came across their use to generate text, and also wanted to learn how to create an API. So, I combined the two to make an API that generates random text based on text you submit to it.

To generate your own text with this, just submit a POST request to the above URL with the original text you want to use as the base text to generate new text. For example (using Requests from Python):

import requests

payload = {'original_text':'''This is a test. This is only a test. This is my test.'''}

requests.post("http://mrmarkov.herokuapp.com/text",data=payload)

Longer pieces of text, such as paragraphs from Shakespeare or Wikipedia generate more realistic sentences.

The response will have a field called "sentence", which will contain the generated text. Try it out! Let me know what you think!

Related Stories

Loading related stories...

Source preview

news.ycombinator.com