-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataManipulation
More file actions
117 lines (85 loc) · 2.65 KB
/
dataManipulation
File metadata and controls
117 lines (85 loc) · 2.65 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from pymongo import MongoClient
client = MongoClient('mongodb+srv://mbillahmim:[email protected]/')
db = client.sample_mflix
javaTestWithComments = db.javaTestWithComments
avgBleu = 0
avgRouge = 0
highBleu = 0
highRouge = 0
avgBleuAsap = 0
avgRougeAsap = 0
highBleuAsap= 0
highRougeAsap = 0
avgBleucodet5 = 0
avgRougecodet5 = 0
highBleucodet5= 0
highRougecodet5 = 0
def read_functions_from_file(file_path):
functions = []
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if line:
index, description = line.split('\t', 1)
functions.append(description.strip())
return functions
file_path = '/student/mjr175/commentGeneration/ASAP_DATASET/Java_result/Java_result/final_1_codet5.output' # Specify the path to your text file
# functions = read_functions_from_file(file_path)
# Example usage:
cnt = 0
winBlue = 0
winRouge = 0
winBlueT5 = 0
winRouget5 = 0
repo = set()
for item in javaTestWithComments.find():
bleu = item.get('bleu')
avgBleu += bleu
rouge = item.get('rougeL')
avgRouge += rouge
highBleu = max(highBleu,bleu)
highRouge = max(highRouge, rouge)
bleuAsap = item.get('bleuAsap')
avgBleuAsap += bleuAsap
rougeAsap = item.get('rougeLAsap')
avgRougeAsap += rougeAsap
highBleuAsap = max(highBleuAsap,bleuAsap)
highRougeAsap = max(highRougeAsap, rougeAsap)
bleucodet5 = item.get('bleucodet5')
avgBleucodet5 += bleucodet5
rougecodet5 = item.get('rougeLcodet5')
avgRougecodet5 += rougecodet5
highBleucodet5 = max(highBleucodet5,bleucodet5)
highRougecodet5 = max(highRougecodet5, rougecodet5)
# codet5 = functions[cnt]
# javaTestWithComments.update_one(
# {'_id': item['_id']},
# {'$set': {'codet5': codet5}}
# )
if(bleu>bleuAsap):
winBlue+=1
if(rouge>rougeAsap):
winRouge+=1
if(bleu>bleucodet5):
winBlueT5+=1
if(rouge>rougecodet5):
winRouget5+=1
cnt+=1
if(cnt==250) :
break
print("avgBleu : ", avgBleu/250)
print("avgRouge : ", avgRouge/250)
print("highBleu : ", highBleu)
print("highRouge : ", highRouge)
print("avgBleuAsap : ", avgBleuAsap/250)
print("avgRougeAsap : ", avgRougeAsap/250)
print("highBleuAsap : ", highBleuAsap)
print("highRougeAsap : ", highRougeAsap)
print("avgBleucodet5 : ", avgBleucodet5/250)
print("avgRougecodet5 : ", avgRougecodet5/250)
print("highBleucodet5 : ", highBleucodet5)
print("highRougecodet5 : ", highRougecodet5)
print("winRouge : ", winRouge)
print ("winBleu : ", winBlue)
print("winRougeT5 : ", winRouget5)
print ("winBleuT5 : ", winBlueT5)