Python 2, score: 2*(407+56574) + 579001562262 = 692963676224
Searches for words matching the previous characters from a list of all most words used in the text, sorted by the number of their occurrences.
Code:
import zlib
f=open("d","rb")
l=zlib.decompress(f.read()).split()
w=""
def f(c):
global w
if c.isalpha():
w+=c
try:n=next(x for x in l if x.startswith(w))
except StopIteration:return" "
if len(n)>len(w):
return list(n)[len(w)]
return" "
w="";
n=ord(c)
if n>31:
return list("t \n 2 sS \n - 08........ huaoRooe oioaoheu thpih eEA \n neo enueee neue hteht e")[n-32]
return"\n"
Data: https://www.dropbox.com/s/etmzi6i26lso8xj/d?dl=0
Test suite:
incorrect = 0
with open("whale"whale2.txt") as file:
p_ch = ch = file.read(1)
while True:
ch = file.read(1)
if not ch:
break
f_ch = f(p_ch)
if f_ch != ch:
incorrect += 1
#print f_ch, ch
p_ch = ch
print incorrect
Edit: Using whale2.txt
gives a better score.