Пример #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))
Пример #2
0
import os
path = os.path.join(os.path.dirname(__file__), "./datatest2.txt")
from marker import Marker

mark = Marker()
mark.load()
with open("learningData.txt") as f:
    line = f.readline()  # skip header
    line = f.readline()
    i = 0
    x1 = []
    x2 = []
    y = []
    while line:
        word = line.split('\t')
        print([float(word[0]), float(word[1])])
        x1.append([float(word[1])])
        x2.append([float(word[2])])
        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