]> code.communitydata.science - ml_measurement_error_public.git/blob - civil_comments/perspective_json_to_csv.sh
Add exploratory data analysis to come up with a real-data example.
[ml_measurement_error_public.git] / civil_comments / perspective_json_to_csv.sh
1 #!/usr/bin/bash
2 header=id,identity_attack_prob,insult_prob,profanity_prob,severe_toxicity_prob,threat_prob,toxicity_prob
3 echo "$header" > $2
4 cat $1 | jq -r '[.id, .attributeScores.IDENTITY_ATTACK.summaryScore.value, .attributeScores.INSULT.summaryScore.value, .attributeScores.PROFANITY.summaryScore.value,.attributeScores.SEVERE_TOXICITY.summaryScore.value, .attributeScores.THREAT.summaryScore.value, .attributeScores.TOXICITY.summaryScore.value] | @csv' >>  $2

Community Data Science Collective || Want to submit a patch?