X-Git-Url: https://code.communitydata.science/ml_measurement_error_public.git/blobdiff_plain/c42b94110b18264fdd66ada100ee05232b7b81bb..3d1964b806106d76f13301f0cf6dccf35cd7d66c:/civil_comments/perspective_json_to_csv.sh diff --git a/civil_comments/perspective_json_to_csv.sh b/civil_comments/perspective_json_to_csv.sh new file mode 100755 index 0000000..8e2aa13 --- /dev/null +++ b/civil_comments/perspective_json_to_csv.sh @@ -0,0 +1,4 @@ +#!/usr/bin/bash +header=id,identity_attack_prob,insult_prob,profanity_prob,severe_toxicity_prob,threat_prob,toxicity_prob +echo "$header" > $2 +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