|
Online Users
|
|
There are 6 guests browsing this site
|
|
|
Newest Members
|
|
Please welcome our newest members:
Atjohns50@gmail Registered 4 days ago AMERICAN DAWG Registered 21 days ago djdrummerFM Registered 25 days ago fulmertc@yahoo. Registered 33 days ago rekerhugh Registered 37 days ago
|
|
|
|
| I wrote a computer program that writes essays for you | | | |
|
|  mrhappycow
1,739 posts (1 today) 1 Awards
17 December 2008
| Yeah I know mike but Its better when you can print the thread without the ads and the blue lines just writing. Its just better that way. Matt the happy cow.
If this band was a person, it would be president. If this band was visual art, it would be the main attraction at Louvre. If this band was a book, it would be holier than the bible. -METALLICA
| | Message posted 1614 days ago | IP Logged |
| |
|  crash
3,085 posts (6 today) 1 Awards
17 December 2008
| | Electric toilet seats are better in the winter. But that's just the way it is. | | Message posted 1614 days ago | IP Logged |
| |
| | kyler228
1 posts (1 today) 0 Awards
20 June 2012
| Cool, very clever idea. I took it one step further, using python. It's still a prototype so it sounds like a the essay was written by an doplhin, but its a start.
Instructions: 1. Change the variable 'topic' to whatever topic you want (it goes off of the wikipedia article for reference so make sure the article exists)
2. Compile
3. Check the newly created .txt file, "text2.txt."
4. ???
5. profit
import re import random import urllib
topic = "Pineapple" maxSentenceLength = 30 totalSentences = 20
if topic == None: f = open("banana.txt") sample = f.read()+"\n\n\n" else: filehandle = urllib.urlopen("https://en.wikipedia.org/w/api...les="+topic+"&explaintext") sample = filehandle.read()
def getCommonAfter(a,s): m = re.findall("(?i)"+a+" (\w+)",s) try: if max(set(m), key=m.count) == max(m, key=len): return min(m, key=len) except: pass if(random.random()>.9): try: return max(m, key=len) except: pass if(random.random()>.7): try: return max(set(m), key=m.count) except: pass try: return random.choice(m) except: return None
final = "\t" print "Beginning" for s in range(totalSentences): print "\tSentence "+str(s)+"..." out = "" last = random.choice(re.findall("\n(\w+)",sample)) out += last for i in range(maxSentenceLength): last = getCommonAfter(last,sample) if(last==None): break out += " "+last out += "." if(random.random()>.85): out += "\n\t" if(i>5): final += out+" " print "Finished" f = open('c:\python27\\text2.txt', 'w') f.write(final) | | Message posted 333 days ago | IP Logged |
| |
|  devoted2gretsch
 13,280 posts (1 today) 3 Awards
23 June 2012
| | |
|
|

To post a reply, you need to login or register.
|