TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

2 pointsby binalpatelover 10 years ago
http:&#x2F;&#x2F;mrmarkov.herokuapp.com&#x2F;text<p>Hi all, this is a personal project I&#x27;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.<p>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):<p>import requests<p>payload = {&#x27;original_text&#x27;:&#x27;&#x27;&#x27;This is a test. This is only a test. This is my test.&#x27;&#x27;&#x27;}<p>requests.post(&quot;http:&#x2F;&#x2F;mrmarkov.herokuapp.com&#x2F;text&quot;,data=payload)<p>Longer pieces of text, such as paragraphs from Shakespeare or Wikipedia generate more realistic sentences.<p>The response will have a field called &quot;sentence&quot;, which will contain the generated text. Try it out! Let me know what you think!

1 comment

binalpatelover 10 years ago
Hi all! I changed the return field&#x27;s name to &#x27;generated_text&#x27; for clarity! I can&#x27;t edit the original post, sorry for the confusion.