Exemple #1
0
from marker import Marker
import random

learn=Marker()
learn.load()
x={"speed":0,"sentenceSpeed":0}
i=0
while i<10:
    x["speed"]=random.random()*5+3
    x["sentenceSpeed"]=random.random()*3/15
    i+=1
    y0,y1=learn.cal_score(x)
    print (str(x["speed"])+"word/s : score"+str(y0*100))
    print (str(x["sentenceSpeed"])+"space/s : score"+str(y1*100))
Exemple #2
0
        y.append(float(word[0]))
        #x1.append([float(word[0])])
        #x2.append([float(word[1])])
        #y.append(i%2.0)  # good and bud presents alternately
        line = f.readline()
        i += 1

store_keys = ["x1", "calculate_x1", "x1", "y", "x2", "calculate_x2", "x2", "y"]

with open(path, "wb") as outfile:
    line = "\t".join([str(v) for v in store_keys])
    outfile.write(line.encode("utf-8"))
    j = 0
    analyzed = {}
    while (j <= 100):
        print(i)
        speed = j * 1 / 10
        sentenceSpeed = j * 2 / 1000
        analyzed["speed"] = float(speed)
        analyzed["sentenceSpeed"] = float(sentenceSpeed)
        cal_x1, cal_x2 = mark.cal_score(analyzed)
        line = "\n" + str(speed) + "\t" + str(cal_x1)
        if (j < i):
            line = line + "\t" + str(x1[j][0]) + "\t" + str(y[j])
        else:
            line = line + "\t" + "" + "\t" + ""
        line = line + "\t" + str(sentenceSpeed) + "\t" + str(cal_x2)
        if (j < i):
            line = line + "\t" + str(x2[j][0]) + "\t" + str(y[j])
        outfile.write(line.encode("utf-8"))
        j += 1