Skip to content

Commit

Permalink
Make gold standards plural in config
Browse files Browse the repository at this point in the history
  • Loading branch information
agitter committed Aug 23, 2024
1 parent c30e7ed commit 522e66c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ datasets:
# Relative path from the spras directory
data_dir: "input"

gold_standard:
gold_standards:
-
# Labels can only contain letters, numbers, or underscores
label: gs0
Expand Down
2 changes: 1 addition & 1 deletion spras/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def process_config(self, raw_config):

# parse gold standard information
try:
self.gold_standards = {gold_standard["label"]: dict(gold_standard) for gold_standard in raw_config["gold_standard"]}
self.gold_standards = {gold_standard["label"]: dict(gold_standard) for gold_standard in raw_config["gold_standards"]}
except:
self.gold_standards = {}

Expand Down
7 changes: 3 additions & 4 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_test_config():
}
},
"datasets": [{"label": "alg1"}, {"label": "alg2"}],
"gold_standard": [{"label": "gs1", "dataset_labels": []}],
"gold_standards": [{"label": "gs1", "dataset_labels": []}],
"algorithms": [{"params": ["param2", "param2"]}],
"analysis": {
"summary": {
Expand Down Expand Up @@ -120,7 +120,6 @@ def test_error_dataset_label(self):

def test_correct_dataset_label(self):
test_config = get_test_config()
print(test_config)
correct_test_dicts = [{"label": "test"}, {"label": "123"}, {"label": "test123"}, {"label": "123test"}, {"label": "_"},
{"label": "test_test"}, {"label": "_test"}, {"label": "test_"}]

Expand All @@ -133,13 +132,13 @@ def test_error_gs_label(self):
error_labels = ["test$", "@test'"]

for test_label in error_labels:
test_config["gold_standard"][0]["label"] = test_label
test_config["gold_standards"][0]["label"] = test_label
with pytest.raises(ValueError): # raises error if any chars other than letters, numbers, or underscores are in gs label
config.init_global(test_config)

def test_error_gs_dataset_mismatch(self):
test_config = get_test_config()
test_config["gold_standard"] = [{"label": "gs1", "dataset_labels": ["mismatch"]}]
test_config["gold_standards"] = [{"label": "gs1", "dataset_labels": ["mismatch"]}]

with pytest.raises(ValueError):
config.init_global(test_config)

0 comments on commit 522e66c

Please sign in to comment.