@@ 47-67 (lines=21) @@ | ||
44 | judgments[col] = judgments[col].apply(lambda x: str(x).lower()) |
|
45 | return judgments |
|
46 | ||
47 | class TutorialCustomizedConfig(DefaultConfig): |
|
48 | inputColumns = ["term1", "b1", "e1", "term2", "b2", "e2", "sentence"] |
|
49 | outputColumns = ["relations"] |
|
50 | customColumns = ["_id", "_unit_id", "_worker_id", "started_at", "created_at"] |
|
51 | ||
52 | # processing of a closed task |
|
53 | open_ended_task = False |
|
54 | annotation_separator = " " |
|
55 | annotation_vector = [ |
|
56 | "causes", "manifestation", "treats", "prevents", "symptom", "diagnose_by_test_or_drug", |
|
57 | "location", "side_effect", "contraindicates", "associated_with", "is_a", "part_of", |
|
58 | "other", "none"] |
|
59 | ||
60 | def processJudgments(self, judgments): |
|
61 | # any pre-processing of the input data goes here |
|
62 | for col in self.outputColumns: |
|
63 | # remove square brackets from annotations |
|
64 | judgments[col] = judgments[col].apply(lambda x: str(x).replace('[', '')) |
|
65 | judgments[col] = judgments[col].apply(lambda x: str(x).replace(']', '')) |
|
66 | judgments[col] = judgments[col].apply(lambda x: str(x).lower()) |
|
67 | return judgments |
|
68 | ||
69 | # test_conf_const = TutorialConfig() |
|
70 | # test_config = test_conf_const.__class__ |
|
@@ 26-45 (lines=20) @@ | ||
23 | def processJudgments(self, judgments): |
|
24 | return judgments |
|
25 | ||
26 | class TutorialConfig(DefaultConfig): |
|
27 | inputColumns = ["term1", "b1", "e1", "term2", "b2", "e2", "sentence"] |
|
28 | outputColumns = ["relations"] |
|
29 | ||
30 | # processing of a closed task |
|
31 | open_ended_task = False |
|
32 | annotation_separator = " " |
|
33 | annotation_vector = [ |
|
34 | "causes", "manifestation", "treats", "prevents", "symptom", "diagnose_by_test_or_drug", |
|
35 | "location", "side_effect", "contraindicates", "associated_with", "is_a", "part_of", |
|
36 | "other", "none"] |
|
37 | ||
38 | def processJudgments(self, judgments): |
|
39 | # any pre-processing of the input data goes here |
|
40 | for col in self.outputColumns: |
|
41 | # remove square brackets from annotations |
|
42 | judgments[col] = judgments[col].apply(lambda x: str(x).replace('[', '')) |
|
43 | judgments[col] = judgments[col].apply(lambda x: str(x).replace(']', '')) |
|
44 | judgments[col] = judgments[col].apply(lambda x: str(x).lower()) |
|
45 | return judgments |
|
46 | ||
47 | class TutorialCustomizedConfig(DefaultConfig): |
|
48 | inputColumns = ["term1", "b1", "e1", "term2", "b2", "e2", "sentence"] |