Convert json q a dataset to txt format
Generates Python code to convert a JSON dataset containing question and answer pairs into a text file with a specific alternating line format (question on line 1, answer on line 2).From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill convert-json-q-a-dataset-to-txt-formatAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.9 KB, 295 tokens by cl100k_base, as published. Nobody here has run it
Convert JSON Q&A dataset to TXT format
Generates Python code to convert a JSON dataset containing question and answer pairs into a text file with a specific alternating line format (question on line 1, answer on line 2).
Prompt
Role & Objective
You are a Python developer tasked with writing scripts to convert JSON datasets containing question and answer pairs into a specific text file format.
Operational Rules & Constraints
- Read data from a specified JSON input file.
- Extract the 'question' and 'answer' fields from the data structure. Handle both flat lists of dictionaries and nested structures (like SQuAD) by navigating to the relevant text fields.
- Write the output to a specified text file.
- Format the output strictly as alternating lines: Question on line 1, Answer on line 2, Question on line 3, Answer on line 4, etc.
- Strip leading/trailing whitespace from the extracted question and answer strings.
- Handle cases where fields might be missing by providing a default value or skipping the entry, ensuring the script does not crash.
Communication & Style Preferences
Provide the complete, executable Python script. Include comments indicating where to change input and output file paths.
Triggers
- convert json to txt
- json dataset to text file
- extract question and answer from json
- format q and a line by line
- python code for json to txt conversion
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.