# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # TODO: Address all TODOs and remove all explanatory comments """TODO: Add a description here.""" import csv import json import os import datasets _CITATION = """\ @inproceedings{milintsevich-etal-2024-model, title = "Your Model Is Not Predicting Depression Well And That Is Why: A Case Study of {PRIMATE} Dataset", author = {Milintsevich, Kirill and Sirts, Kairit and Dias, Ga{\"e}l}, booktitle = "Proceedings of the 9th Workshop on Computational Linguistics and Clinical Psychology (CLPsych 2024)", month = mar, year = "2024", address = "St. Julians, Malta", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2024.clpsych-1.13", pages = "166--171", } """ _DESCRIPTION = """\ Focusing on the PRIMATE dataset, our study reveals concerns regarding annotation validity, particularly for the lack of interest or pleasure symptom. Through re-annotation by a mental health professional, we introduce finer labels and textual spans as evidence, identifying a notable number of false positives. Our refined annotations offer a higher-quality test set for anhedonia detection. This study underscores the necessity of addressing annotation quality issues in mental health datasets, advocating for improved methodologies to enhance NLP model reliability in mental health assessments. """ # TODO: Add a link to an official homepage for the dataset here _HOMEPAGE = "" # TODO: Add the licence for the dataset here if you can find it _LICENSE = "" _URL = "reddit-anhedonia.json" # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case class RedditAnhedonia(datasets.GeneratorBasedBuilder): """Reddit posts annotated for presence or absence of anhedonia.""" VERSION = datasets.Version("1.1.0") def _info(self): features = datasets.Features( { "primate_id": datasets.Value("int64"), "answerable": datasets.ClassLabel(num_classes=2, names=["not answerable", "answerable"]), "mentioned": datasets.ClassLabel(num_classes=2, names=["not mentioned", "mentioned"]), "writer_symptom": datasets.ClassLabel(num_classes=2, names=["writer's symptom", "not writer's symptom"]), "quote": datasets.Sequence(feature=datasets.Sequence(datasets.Value(dtype='int64', id=None), length=-1, id=None), length=-1, id=None) } ) return datasets.DatasetInfo( description=_DESCRIPTION, features=features, homepage=_HOMEPAGE, license=_LICENSE, citation=_CITATION, ) def _split_generators(self, dl_manager): data_dir = dl_manager.download(_URL) return [ datasets.SplitGenerator( name=datasets.Split.TEST, # These kwargs will be passed to _generate_examples gen_kwargs={ "filepath": data_dir, }, ), ] # method parameters are unpacked from `gen_kwargs` as given in `_split_generators` def _generate_examples(self, filepath): with open(filepath, encoding="utf-8") as f: data = json.load(f) for idx, sample in enumerate(data): yield idx, { "primate_id": sample["primate_id"], "answerable": sample["answerable"], "mentioned": sample["mentioned"], "writer_symptom": sample["writer_symptom"], "quote": sample["quote"], }