import pickle

try:
	markovDictionary = pickle.load(open("MarkovDump", "rb")) 
except IOError:
	markovDictionary = {"": []}
	
sentence = raw_input("Input a sentence:\n")
words = sentence.split(" ")
print(words)

markovDictionary[""].append(words[0])
for index, word in enumerate(words):
	if not index == 0:
		markovDictionary[words[index-1]].append(word)
	if not markovDictionary.has_key(word):
		markovDictionary[word] = []
markovDictionary[words[-1]].append("")

pickle.dump(markovDictionary, open("MarkovDump", "wb"))
	
print(markovDictionary.items())
@@ -6,16 +6,42 @@
 t pickle
+%0Afrom random import choice
 %0A%0Atry:%0A%09
@@ -217,16 +217,17 @@
 it(%22 %22)%0A
+#
 print(wo
@@ -231,16 +231,16 @@
 (words)%0A
-
 %0AmarkovD
@@ -541,18 +541,311 @@
  %22wb%22))%0A
-%09
 %0A
+generatedSentence = %22%22%0AselectedWord = choice(markovDictionary%5B%22%22%5D)%0AgeneratedSentence = generatedSentence + %22 %22 + selectedWord%0Awhile selectedWord != %22%22:%0A%09selectedWord = choice(markovDictionary%5BselectedWord%5D)%0A%09generatedSentence = generatedSentence + %22 %22 + selectedWord%0A%0Aprint(generatedSentence)%0A#
 print(ma

Will now output a sentence using it's dictionary, the larger the dictionary the more and more accurate sentences that can be made