From 86f3696d595c5dd4e747bccd6399ba4c7fe4b934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20N=C3=BCsse?= Date: Sun, 28 Apr 2024 10:36:16 +0200 Subject: [PATCH] verify profanities --- .github/workflows/translations.yml | 2 +- scripts/checkProfanity.py | 3 ++- scripts/generateFilelist.sh | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index 91c395fd..af571dd1 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -64,7 +64,7 @@ jobs: - name: Print the result run: | echo "Translations are: '${{ steps.google-translate.outputs.text }}'" - echo "${{ steps.google-translate.outputs.text }}" | sed 's/; /\n/g' > translated_texts.txt + echo "${{ steps.google-translate.outputs.text }}" | sed 's/ ; /\n/g' > translated_texts.txt cat translated_texts.txt > ./scripts/checkProfanity.sh shell: sh - name: Upload Raw Translations diff --git a/scripts/checkProfanity.py b/scripts/checkProfanity.py index a5e53279..d83d5c41 100755 --- a/scripts/checkProfanity.py +++ b/scripts/checkProfanity.py @@ -7,9 +7,10 @@ file = open("suspicious_texts.txt", "a") for line in sys.stdin: + print("Checking: "+str(line.rstrip())) prediction = predict_prob([line.rstrip()]) if prediction[0] > 0.5: file.write(str(line.rstrip())+"\n") - print(str(line.rstrip())) + print("Offending line: "+str(line.rstrip())) file.close() \ No newline at end of file diff --git a/scripts/generateFilelist.sh b/scripts/generateFilelist.sh index 97237df0..89dae609 100755 --- a/scripts/generateFilelist.sh +++ b/scripts/generateFilelist.sh @@ -8,6 +8,7 @@ fi DIFF=$(git diff -U0 HEAD~$1 ${@:2} | grep -E "^\+" | grep -v +++ | cut -c 2- | sed 's/^[ \t]*\(.*$\)/\1/') echo "$DIFF" | xmlstarlet sel -t -m '//string' -v . -n > changed_texts.txt TRANSLATIONS=$(cat changed_texts.txt) -TRANSLATIONS="${TRANSLATIONS//$'\n'/';'}" -TRANSLATIONS="${TRANSLATIONS//$'\r'/';'}" +TRANSLATIONS="${TRANSLATIONS//'%'/' ; '}" +TRANSLATIONS="${TRANSLATIONS//$'\n'/' ; '}" +TRANSLATIONS="${TRANSLATIONS//$'\r'/' ; '}" echo $TRANSLATIONS \ No newline at end of file