add fancy data crunching function and help menu

This commit is contained in:
randomuser 2022-02-08 19:58:27 +00:00
parent 2d58cb1cac
commit e23268edfa
3 changed files with 41 additions and 15 deletions

Binary file not shown.

39
prob.py
View File

@ -1,8 +1,3 @@
import pickle
fd = open("wordlist", "r")
words = [i.rstrip() for i in fd.readlines()]
print(words)
def generateOutput(inputword, correct):
res = [0, 0, 0, 0, 0]
for i in range(len(inputword)):
@ -22,15 +17,29 @@ def probs(dataset):
res[i] = 1
return res
data = {}
def dist(dataset):
buf = []
for i in dataset:
tot = 0
nums = 0
for j in dataset[i]:
tot += dataset[i][j]
nums += 1
buf.append([i, tot / nums])
buf.sort(key = lambda x: x[1])
for i in words:
data[i] = None
cache = []
for j in words:
cache.append(generateOutput(i, j))
print("cached {} {}".format(i, j))
data[i] = probs(cache)
return buf
fdtwo = open("dataoutput", "wb")
pickle.dump(data, fdtwo)
def runtime(dataset):
return len(dataset) * len(dataset)
def main(words):
data = {}
for i in words:
cache = []
for j in words:
cache.append(generateOutput(i, j))
data[i] = probs(cache)
return dist(data)

View File

@ -1,5 +1,7 @@
#!/usr/bin/python3
import prob
words = [i.rstrip() for i in open("wordlist", "r").readlines()]
nocontain = []
@ -58,6 +60,21 @@ while True:
words = buf
elif line.split(' ')[0] == "listbuffers":
print(nocontain, contains, defcontains)
elif line.split(' ')[0] == "probmodel":
tmp = prob.main(words)
tmp.reverse()
print(tmp)
elif line.split(' ')[0] == "probruntime":
print(prob.runtime(words))
elif line.split(' ')[0] == "words":
print(words)
elif line.split(' ')[0] == "help":
print("welcome to wordlefish, a 'engine' for wordle")
print("add - add pattern")
print("reduce - apply pattern filter")
print("listbuffers - list filters in buffers")
print("probmodel - output ordered arr based on expensive dist model")
print("probruntime - return iterations of probmodel")
print("words - list words in consideration")
print("help - this")