"""Dictionary of all words by category The categories should be paired and put into `primary` or `secondary` session config parameters: ```primary = ['male', 'female'], secondary = ['work', 'family']``` If a file stimuli.csv is present in app dir, it's content is loaded into the DICT the csv should contain (at least) two columns: category, stimulus """ from pathlib import Path import csv DICT = { "images:Vedente": [ "abled1.png", "abled2.png", "abled3.png", "abled4.png", "abled5.png", "abled6.png", ], "images:Non vedente": [ "disabled1.png", "disabled2.png", "disabled3.png", "disabled4.png", "disabled5.png", "disabled6.png", ], 'positivo': ['pace', 'tranquillità', 'successo', 'felicità', 'forza', 'socievole', 'ridere', 'gioia'], 'negativo': ['disagio', 'terribile', 'soffrire', 'tormento', 'debolezza', 'fallimento', 'depresso', 'agonia'], } csvfile = Path(__file__).parent / "stimuli.csv" if csvfile.exists(): with open(csvfile, encoding='utf-8-sig') as f: reader = csv.DictReader(f) for row in reader: cat = row['category'] word = row['stimulus'] if cat not in DICT: DICT[cat] = [] DICT[cat].append(word)