Skip to content

Commit 3da47b8

Browse files
committed
add annotation
1 parent 2ccba96 commit 3da47b8

11 files changed

+4153
-148
lines changed

dataset/annotation/coxql_test_annotation1.json

+567
Large diffs are not rendered by default.

dataset/annotation/coxql_test_annotation.json renamed to dataset/annotation/coxql_test_annotation2.json

+114-114
Large diffs are not rendered by default.

dataset/annotation/remove_golden_parse.py

-27
This file was deleted.

dataset/annotation/utils.py

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import json
2+
import random
3+
from nltk import agreement
4+
5+
6+
def remove_labeled_annotations():
7+
f = open(f"../coxql_test.json")
8+
data = json.load(f)
9+
10+
texts = []
11+
sqls = []
12+
13+
for i in data:
14+
texts.append(i["text"])
15+
sqls.append(i["sql"])
16+
17+
output = []
18+
for i in range(len(texts)):
19+
output.append({
20+
"idx": i,
21+
"text": texts[i],
22+
"sql": ""
23+
})
24+
25+
random.shuffle(output)
26+
27+
jsonFile = open("./coxql_test_annotation.json", "w")
28+
jsonString = json.dumps(output, indent=2)
29+
jsonFile.write(jsonString)
30+
jsonFile.close()
31+
32+
33+
def get_annotation_with_order(data):
34+
label = []
35+
for i in range(len(data)):
36+
for j in data:
37+
if j["idx"] == i:
38+
label.append(j['sql'])
39+
break
40+
return label
41+
42+
43+
def calculate_IAA():
44+
45+
f = open("./coxql_test_annotation1.json.json")
46+
data = json.load(f)
47+
rater1 = [i["sql"] for i in data]
48+
49+
f1 = open("./coxql_test_annotation2.json")
50+
data1 = json.load(f1)
51+
52+
f2 = open("./coxql_test_annotation3.json")
53+
data2 = json.load(f2)
54+
55+
rater2 = get_annotation_with_order(data1)
56+
rater3 = get_annotation_with_order(data2)
57+
58+
task_data = ([[0, str(i), str(rater1[i])] for i in range(0, len(rater1))] +
59+
[[1, str(i), str(rater2[i])] for i in range(0, len(rater2))] +
60+
[[2, str(i), str(rater3[i])] for i in range(0, len(rater3))])
61+
62+
rating_task = agreement.AnnotationTask(data=task_data)
63+
64+
print("Kappa " + str(rating_task.kappa()))
65+
print("Fleiss " + str(rating_task.multi_kappa()))
66+
print("Alpha " + str(rating_task.alpha()))
67+
print("Scotts " + str(rating_task.pi()))

parsing/guided_decoding/results/pythia-2.8b-v0-20shots.json

+567-1
Large diffs are not rendered by default.

parsing/multi_prompt/results/CodeQwen1.5-7B-Chat.json

+567-1
Large diffs are not rendered by default.

parsing/multi_prompt/results/Meta-Llama-3-70B.json

+567-1
Large diffs are not rendered by default.

parsing/multi_prompt/results/Mistral-7B-v0.1.json

+567-1
Large diffs are not rendered by default.

parsing/multi_prompt/results/falcon-rw-1b.json

+567-1
Large diffs are not rendered by default.

parsing/multi_prompt/results/sqlcoder-7b-2.json

+567-1
Large diffs are not rendered by default.

requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ accelerate==0.29.3
22
auto_gptq==0.7.1
33
bitsandbytes==0.41.1
44
lark==1.1.2
5+
nltk==3.7.0
56
numpy==1.22.4
67
optimum==1.13.2
78
pandas==1.4.3
@@ -10,4 +11,5 @@ scikit-learn==1.0.2
1011
sentence_transformers==2.2.2
1112
torch==2.1.0+cu121
1213
tqdm==4.66.1
13-
transformers==4.36.0
14+
transformers==4.36.0
15+
word2number==1.1

0 commit comments

Comments
 (0)