Skip to content

Commit 93c91c3

Browse files
Cleanup
1 parent 3887829 commit 93c91c3

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

backend/problem/management/commands/import_snli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def add_arguments(self, parser):
1919
)
2020

2121
def handle(self, *args, **options):
22-
snli_paths = [("development", "problem/data/snli_1.0_dev.txt")]
22+
snli_paths = [("dev", "problem/data/snli_1.0_dev.txt")]
2323
if options["full"]:
2424
snli_paths.extend(
2525
[

backend/problem/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def serialize(self) -> dict:
5050

5151
@dataclass(frozen=True)
5252
class SNLIProblem:
53-
pair_id: str
53+
pair_id: int
5454
subset: Literal["train", "dev", "test"]
5555
sentence_one: str
5656
sentence_two: str

frontend/src/app/annotate/annotation-input/annotation-input.component.ts

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -75,37 +75,38 @@ export class AnnotationInputComponent {
7575
if (!response.problem) {
7676
return Judgement.UNKNOWN;
7777
}
78-
if (response.type === "sick") {
79-
switch (response.problem.entailmentLabel) {
80-
case "ENTAILMENT":
81-
return Judgement.ENTAILMENT;
82-
case "CONTRADICTION":
83-
return Judgement.CONTRADICTION;
84-
case "NEUTRAL":
85-
return Judgement.NEUTRAL;
86-
}
87-
} else if (response.type === "fracas") {
88-
switch (response.problem.fracasAnswer) {
89-
case "yes":
90-
return Judgement.ENTAILMENT;
91-
case "no":
92-
return Judgement.CONTRADICTION;
93-
case "unknown":
94-
return Judgement.NEUTRAL;
95-
case "undefined":
96-
return Judgement.UNKNOWN;
97-
}
98-
}
99-
// SNLI
100-
switch (response.problem.goldLabel) {
101-
case "entailment":
102-
return Judgement.ENTAILMENT;
103-
case "contradiction":
104-
return Judgement.CONTRADICTION;
105-
case "neutral":
106-
return Judgement.NEUTRAL;
107-
case "none":
108-
return Judgement.UNKNOWN;
78+
switch (response.type) {
79+
case Dataset.SICK:
80+
switch (response.problem.entailmentLabel) {
81+
case "ENTAILMENT":
82+
return Judgement.ENTAILMENT;
83+
case "CONTRADICTION":
84+
return Judgement.CONTRADICTION;
85+
case "NEUTRAL":
86+
return Judgement.NEUTRAL;
87+
}
88+
case Dataset.FRACAS:
89+
switch (response.problem.fracasAnswer) {
90+
case "yes":
91+
return Judgement.ENTAILMENT;
92+
case "no":
93+
return Judgement.CONTRADICTION;
94+
case "unknown":
95+
return Judgement.NEUTRAL;
96+
case "undefined":
97+
return Judgement.UNKNOWN;
98+
}
99+
case Dataset.SNLI:
100+
switch (response.problem.goldLabel) {
101+
case "entailment":
102+
return Judgement.ENTAILMENT;
103+
case "contradiction":
104+
return Judgement.CONTRADICTION;
105+
case "neutral":
106+
return Judgement.NEUTRAL;
107+
case "none":
108+
return Judgement.UNKNOWN;
109+
}
109110
}
110111
}
111112

frontend/src/app/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ type SNLILabel = "neutral" | "contradiction" | "entailment" | "none";
2323

2424
export interface SNLIProblem {
2525
pairId: number;
26-
subset: 'development' | 'test' | 'train';
26+
subset: 'dev' | 'test' | 'train';
2727
sentenceOne: string;
2828
sentenceTwo: string;
2929
goldLabel: SNLILabel;
3030
labels: SNLILabel[];
3131
}
3232

3333
interface ProblemResponseBase {
34-
id: string;
35-
index: string | null;
34+
id: number;
35+
index: number | null;
3636
error: string | null;
3737
next: string | null;
3838
previous: string | null;

0 commit comments

Comments
 (0)