File size: 978 Bytes
e083390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import re
wrong=0
right=0
wrongcount=0
rightcount=0
judgesent=re.compile(r"ChatCompletionMessage")
with open("eval.log") as f:
    lines=f.readlines()
    for line in lines:
        lowline=line.lower()
        if line.startswith("-----**"):
            if wrong>0:
                wrongcount+=1
            elif right>0:
                rightcount+=1
            else:
                print("error")
            wrong=0
            right=0
        elif judgesent.match(line):
            if lowline.find("wrong")!=-1 or lowline.find("incorrect")!=-1 or lowline.find("not completed")!=-1:
                wrong+=1
            elif lowline.find("right")!=-1 or lowline.find("correct")!=-1:
                right+=1
            elif lowline.find("content=''")!=-1:
                pass
            else:
                print("error")
    if wrong>0:
        wrongcount+=1
    else:
        rightcount+=1
acc=float(rightcount)/100
print(acc,"right",rightcount,"wrong",wrongcount)