| import json | |
| from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Value, Sequence | |
| class KokoroChat(GeneratorBasedBuilder): | |
| def _info(self): | |
| return DatasetInfo( | |
| description="KokoroChat: A Japanese psychological counseling dialogue dataset.", | |
| features={ | |
| "dialogue": Sequence({ | |
| "role": Value("string"), | |
| "time": Value("string"), | |
| "utterance": Value("string") | |
| }), | |
| "topic": { | |
| "main_jp": Value("string"), | |
| "main_en": Value("string"), | |
| "sub": Value("string") | |
| }, | |
| "review_by_client_jp": { | |
| "評価ID": Value("int32"), | |
| "評価作成日時": Value("string"), | |
| "クライアント役ID": Value("int32"), | |
| "カウンセラー役ID": Value("int32"), | |
| "点数": Value("int32"), | |
| "聴いてもらえた、わかってもらえたと感じた": Value("int32"), | |
| "尊重されたと感じた": Value("int32"), | |
| "新しい気づきや体験があった": Value("int32"), | |
| "希望や期待を感じられた": Value("int32"), | |
| "取り組みたかったことを扱えた": Value("int32"), | |
| "一緒に考えながら取り組めた": Value("int32"), | |
| "やりとりのリズムがあっていた": Value("int32"), | |
| "居心地のよいやりとりだった": Value("int32"), | |
| "全体として適切でよかった": Value("int32"), | |
| "今回の相談は価値があった": Value("int32"), | |
| "相談開始の円滑さ": Value("int32"), | |
| "相談終了のタイミング(不必要に聴きすぎていないか)、円滑さ": Value("int32"), | |
| "受容・共感": Value("int32"), | |
| "肯定・承認": Value("int32"), | |
| "的確な質問による会話の促進": Value("int32"), | |
| "要約": Value("int32"), | |
| "問題の明確化": Value("int32"), | |
| "この相談での目標の明確化": Value("int32"), | |
| "次の行動につながる提案": Value("int32"), | |
| "勇気づけ・希望の喚起": Value("int32"), | |
| "無理解と軽率さによる傷つけ発言": Value("string"), | |
| "その他の倫理違反が疑われる発言": Value("string"), | |
| "離脱": Value("string") | |
| }, | |
| "review_by_client_en": { | |
| "evaluation_id": Value("int32"), | |
| "evaluation_created_at": Value("string"), | |
| "client_id": Value("int32"), | |
| "counselor_id": Value("int32"), | |
| "score": Value("int32"), | |
| "felt_heard_and_understood": Value("int32"), | |
| "felt_respected": Value("int32"), | |
| "gained_new_insights": Value("int32"), | |
| "felt_hopeful_or_expectant": Value("int32"), | |
| "concerns_were_addressed": Value("int32"), | |
| "thought_through_concerns_together": Value("int32"), | |
| "conversation_had_good_rhythm": Value("int32"), | |
| "conversation_felt_comfortable": Value("int32"), | |
| "felt_appropriate_and_satisfying": Value("int32"), | |
| "conversation_was_valuable": Value("int32"), | |
| "conversation_started_smoothly": Value("int32"), | |
| "conversation_ended_well": Value("int32"), | |
| "showed_acceptance_and_empathy": Value("int32"), | |
| "provided_acknowledgment_and_affirmation": Value("int32"), | |
| "asked_effective_questions": Value("int32"), | |
| "summarized_key_points_effectively": Value("int32"), | |
| "clarified_issues_cleraly": Value("int32"), | |
| "helped_identify_goals": Value("int32"), | |
| "offered_actionable_suggestions": Value("int32"), | |
| "encouraged_and_instilled_hope": Value("int32"), | |
| "harmful_due_to_ignorance": Value("string"), | |
| "other_potentially_unethical": Value("string"), | |
| "unwilling_to_continue": Value("string") | |
| } | |
| }, | |
| supervised_keys=None | |
| ) | |
| def _split_generators(self, dl_manager): | |
| data_path = dl_manager.download_and_extract("Kokorochat_dialogues.jsonl") | |
| return [ | |
| SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": data_path}) | |
| ] | |
| def _generate_examples(self, filepath): | |
| with open(filepath, encoding="utf-8") as f: | |
| for i, line in enumerate(f): | |
| yield i, json.loads(line) | |