Skip to content

Commit

Permalink
verify profanities
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Apr 28, 2024
1 parent bfa4d81 commit 0d0f337
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,13 @@ jobs:
name: Translations
path: |
changed_texts.txt
translated_texts.txt
translated_texts.txt
suspicious_texts.txt
- name: Fail if there are suspected profanities
run: |
if [ -s "suspicious_texts.txt" ]; then
echo "We found suspicious translations. Please check!"
exit 1
fi
shell: sh

2 changes: 2 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,6 @@
<string name="breadcrumb_home_description">Remote-Startpunkt</string>
<string name="breadcrumb_next_description">Nächster Breadcrumb-Pfeil-Indikator</string>
<string name="remote_creation_next_step">Nächster Schritt</string>
<string name="bad_translation">Du Dummkopf</string>
<string name="bad_translation2">Ficken!</string>
</resources>
7 changes: 5 additions & 2 deletions scripts/checkProfanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import joblib


file = open("suspicious_texts.txt", "a")
for line in sys.stdin:
prediction = predict_prob([line.rstrip()])
if prediction[0] < 0.5:
if prediction[0] > 0.5:
file.write(str(line.rstrip())+"\n")
print(str(line.rstrip()))
exit(1)

file.close()

0 comments on commit 0d0f337

Please sign in to comment.