Upload kokorochat.py
Browse files- kokorochat.py +92 -0
kokorochat.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Value, Sequence
|
| 3 |
+
|
| 4 |
+
class KokoroChat(GeneratorBasedBuilder):
|
| 5 |
+
def _info(self):
|
| 6 |
+
return DatasetInfo(
|
| 7 |
+
description="KokoroChat: A Japanese psychological counseling dialogue dataset.",
|
| 8 |
+
features={
|
| 9 |
+
"dialogue": Sequence({
|
| 10 |
+
"role": Value("string"),
|
| 11 |
+
"time": Value("string"),
|
| 12 |
+
"utterance": Value("string")
|
| 13 |
+
}),
|
| 14 |
+
"topic": {
|
| 15 |
+
"main_jp": Value("string"),
|
| 16 |
+
"main_en": Value("string"),
|
| 17 |
+
"sub": Value("string")
|
| 18 |
+
},
|
| 19 |
+
"review_by_client_jp": {
|
| 20 |
+
"評価ID": Value("int32"),
|
| 21 |
+
"評価作成日時": Value("string"),
|
| 22 |
+
"クライアント役ID": Value("int32"),
|
| 23 |
+
"カウンセラー役ID": Value("int32"),
|
| 24 |
+
"点数": Value("int32"),
|
| 25 |
+
"聴いてもらえた、わかってもらえたと感じた": Value("int32"),
|
| 26 |
+
"尊重されたと感じた": Value("int32"),
|
| 27 |
+
"新しい気づきや体験があった": Value("int32"),
|
| 28 |
+
"希望や期待を感じられた": Value("int32"),
|
| 29 |
+
"取り組みたかったことを扱えた": Value("int32"),
|
| 30 |
+
"一緒に考えながら取り組めた": Value("int32"),
|
| 31 |
+
"やりとりのリズムがあっていた": Value("int32"),
|
| 32 |
+
"居心地のよいやりとりだった": Value("int32"),
|
| 33 |
+
"全体として適切でよかった": Value("int32"),
|
| 34 |
+
"今回の相談は価値があった": Value("int32"),
|
| 35 |
+
"相談開始の円滑さ": Value("int32"),
|
| 36 |
+
"相談終了のタイミング(不必要に聴きすぎていないか)、円滑さ": Value("int32"),
|
| 37 |
+
"受容・共感": Value("int32"),
|
| 38 |
+
"肯定・承認": Value("int32"),
|
| 39 |
+
"的確な質問による会話の促進": Value("int32"),
|
| 40 |
+
"要約": Value("int32"),
|
| 41 |
+
"問題の明確化": Value("int32"),
|
| 42 |
+
"この相談での目標の明確化": Value("int32"),
|
| 43 |
+
"次の行動につながる提案": Value("int32"),
|
| 44 |
+
"勇気づけ・希望の喚起": Value("int32"),
|
| 45 |
+
"無理解と軽率さによる傷つけ発言": Value("string"),
|
| 46 |
+
"その他の倫理違反が疑われる発言": Value("string"),
|
| 47 |
+
"離脱": Value("string")
|
| 48 |
+
},
|
| 49 |
+
"review_by_client_en": {
|
| 50 |
+
"evaluation_id": Value("int32"),
|
| 51 |
+
"evaluation_created_at": Value("string"),
|
| 52 |
+
"client_id": Value("int32"),
|
| 53 |
+
"counselor_id": Value("int32"),
|
| 54 |
+
"score": Value("int32"),
|
| 55 |
+
"felt_heard_and_understood": Value("int32"),
|
| 56 |
+
"felt_respected": Value("int32"),
|
| 57 |
+
"gained_new_insights": Value("int32"),
|
| 58 |
+
"felt_hopeful_or_expectant": Value("int32"),
|
| 59 |
+
"concerns_were_addressed": Value("int32"),
|
| 60 |
+
"thought_through_concerns_together": Value("int32"),
|
| 61 |
+
"conversation_had_good_rhythm": Value("int32"),
|
| 62 |
+
"conversation_felt_comfortable": Value("int32"),
|
| 63 |
+
"felt_appropriate_and_satisfying": Value("int32"),
|
| 64 |
+
"conversation_was_valuable": Value("int32"),
|
| 65 |
+
"conversation_started_smoothly": Value("int32"),
|
| 66 |
+
"conversation_ended_well": Value("int32"),
|
| 67 |
+
"showed_acceptance_and_empathy": Value("int32"),
|
| 68 |
+
"provided_acknowledgment_and_affirmation": Value("int32"),
|
| 69 |
+
"asked_effective_questions": Value("int32"),
|
| 70 |
+
"summarized_key_points_effectively": Value("int32"),
|
| 71 |
+
"clarified_issues_cleraly": Value("int32"),
|
| 72 |
+
"helped_identify_goals": Value("int32"),
|
| 73 |
+
"offered_actionable_suggestions": Value("int32"),
|
| 74 |
+
"encouraged_and_instilled_hope": Value("int32"),
|
| 75 |
+
"harmful_due_to_ignorance": Value("string"),
|
| 76 |
+
"other_potentially_unethical": Value("string"),
|
| 77 |
+
"unwilling_to_continue": Value("string")
|
| 78 |
+
}
|
| 79 |
+
},
|
| 80 |
+
supervised_keys=None
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
def _split_generators(self, dl_manager):
|
| 84 |
+
data_path = dl_manager.download_and_extract("Kokorochat_dialogues.jsonl")
|
| 85 |
+
return [
|
| 86 |
+
SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": data_path})
|
| 87 |
+
]
|
| 88 |
+
|
| 89 |
+
def _generate_examples(self, filepath):
|
| 90 |
+
with open(filepath, encoding="utf-8") as f:
|
| 91 |
+
for i, line in enumerate(f):
|
| 92 |
+
yield i, json.loads(line)
|