forked from umerfar123/Answer_Paper_Evaluation_System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnswerLength.py
More file actions
45 lines (31 loc) · 742 Bytes
/
AnswerLength.py
File metadata and controls
45 lines (31 loc) · 742 Bytes
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
36
37
38
39
40
41
42
43
44
45
from importsfile import *
#Checking Length of Student Answer
def answerlength_mark(st_ans,q_mark,w1,w2,w3):
length=st_ans.split()
length_sa=len(length)
#Checking Expected Number Of Words According To Question Mark
i=q_mark
if i==3:
exp_nwords=50
elif i==4:
exp_nwords=75
elif i==5:
exp_nwords=100
elif i==6:
exp_nwords=150
elif i==7:
exp_nwords=200
elif i==8:
exp_nwords=250
elif i==9:
exp_nwords=300
elif i==2:
exp_nwords=15
wmark=q_mark * w2/(w1+w2+w3)
if length_sa >= exp_nwords:
wmark=wmark
else:
penalty=wmark/exp_nwords
wmark=penalty*length_sa
fwmark=format(wmark, ".2f")
return fwmark