Exemplo n.º 1
0
# Driver for profanity filter

import profanity

if __name__ == '__main__':
    #text = 'hello f****r this. is a shitty test.'
    #text = 'transpose fcuk asshloe'
    #text = 'all good here'
    #text = 'f u c k'
    text = 'john is an a s s h o l e'
    score = profanity.profanityScore(text)
    print(score)
Exemplo n.º 2
0
 def process_request(self, request):
     rpd = request.body.lower()
     if profanityScore(rpd) >= 10:
         messages.error(request, 'Please remove any obscenities in your message and re-submit. Thank you!')
         return HttpResponseRedirect(request.META['HTTP_REFERER'])