Moodle

Word Censorship with a white list as well as a black list

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.6, 1.9, 1.9.1, 1.9.2
  • Fix Version/s: None
  • Component/s: Administration
  • Labels:
    None
  • Environment:
    All
  • Database:
    Any
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

A new filter 'Censorship (with overrides)' provides both the blacking out words on a default or custom badword list, and the skipping over words on a custom white list that would otherwise be blacked out.
This to be considered as a replacement for the Word Censorship filter in the Core.
Tasks to do for this to succeed:
1. Three language strings to be added to all translations of lang/xx/admin.php: 'goodwordsconfig', 'goodwordsdefault', 'goodwordslist'
2. Two language strings to be added to all translations of lang/xx/censorship.php; 'censorshipfiltererror', 'filtername' [amended to 'Censorship (with overrides)']

  • this file to otherwise a copy of censor.php

Please note: http://moodle.org/mod/forum/discuss.php?d=101484 gives current install details.

Activity

Hide
John White added a comment -

I would also like to mention that it would be a trivial matter to make the whitelist case-sensitive if that were to be preferred - though it would plainly be disadvantageous to have a case-sensitive blacklist!

I would also have liked to have provided a setting for which character would be used to blank the badwords, such as offering Arial's U+2588 Full Block in place to the asterisk,
but at the time I left this because of unicode concerns. - JW

Show
John White added a comment - I would also like to mention that it would be a trivial matter to make the whitelist case-sensitive if that were to be preferred - though it would plainly be disadvantageous to have a case-sensitive blacklist! I would also have liked to have provided a setting for which character would be used to blank the badwords, such as offering Arial's U+2588 Full Block in place to the asterisk, but at the time I left this because of unicode concerns. - JW
Hide
Gary Anderson added a comment -

An alternate approach is to use a regular expression that checks for word boundaries (\b). It seems like the false positives that people are concerned about are because the naughty string is part of an acceptable word.

In terms of replacement strings, one might want to use @!#$%*& as substitution as that is generally understood as a stand-in for foul language.

I would note that, given that only authenticated users who have been authorized to be a part of a course can write in Moodle, and hence all they do is logged under their username, I can't see too many times that one should turn this on, especially when we try to teach kids that penis is not normally swear word – it is all about context, and any filter like this will have a hard time with context.

Still, since this might be a concern that would affect adoption in some environments, it seems like the filter should be made as good as possible.

Show
Gary Anderson added a comment - An alternate approach is to use a regular expression that checks for word boundaries (\b). It seems like the false positives that people are concerned about are because the naughty string is part of an acceptable word. In terms of replacement strings, one might want to use @!#$%*& as substitution as that is generally understood as a stand-in for foul language. I would note that, given that only authenticated users who have been authorized to be a part of a course can write in Moodle, and hence all they do is logged under their username, I can't see too many times that one should turn this on, especially when we try to teach kids that penis is not normally swear word – it is all about context, and any filter like this will have a hard time with context. Still, since this might be a concern that would affect adoption in some environments, it seems like the filter should be made as good as possible.
Hide
John White added a comment - - edited

Gary,

I know that Ray Lawrence commented extensively on the "efficacy of this approach to moderation" (in the cited discussion), which I misunderstood at first, but by which he made the same point: this is not a good substitute for respect!
I'm not here advocating censorship as a substitute for achieving an agreed standard of behaviour; that plainly doesn't work. It is more simple than that: the current version blots out words it should not and I wanted to fix it.

As for what goes in place of the expletive I would think your 'squiggles' approach might actually be counter-productive, with some taking delight in the best patterns they could make!
Which is why I would rather replace the asterisks, if with anything at all, with a solid block.

Additionally, we need to be clear why the original programmer (and I in suit) did not use word boundaries in the filter. To do so means having to put every derivative of any expletive in the blacklist, and still opens up an amusing game of 'bury the swear word'. So, frankly, that's a non-starter.

Best regards,

John

Show
John White added a comment - - edited Gary, I know that Ray Lawrence commented extensively on the "efficacy of this approach to moderation" (in the cited discussion), which I misunderstood at first, but by which he made the same point: this is not a good substitute for respect! I'm not here advocating censorship as a substitute for achieving an agreed standard of behaviour; that plainly doesn't work. It is more simple than that: the current version blots out words it should not and I wanted to fix it. As for what goes in place of the expletive I would think your 'squiggles' approach might actually be counter-productive, with some taking delight in the best patterns they could make! Which is why I would rather replace the asterisks, if with anything at all, with a solid block. Additionally, we need to be clear why the original programmer (and I in suit) did not use word boundaries in the filter. To do so means having to put every derivative of any expletive in the blacklist, and still opens up an amusing game of 'bury the swear word'. So, frankly, that's a non-starter. Best regards, John
Hide
Ray Lawrence added a comment -

I don't think this will ever be perfect. However, as it exists in core a white list option (even if it is equally simplistic) will be a significant improvement.

Show
Ray Lawrence added a comment - I don't think this will ever be perfect. However, as it exists in core a white list option (even if it is equally simplistic) will be a significant improvement.
Hide
Gary Anderson added a comment -

Thanks for sharing the code and the thought that has gone into it.

I think there is full agreement that this change makes the filter better do its intended job.

--Gary

Show
Gary Anderson added a comment - Thanks for sharing the code and the thought that has gone into it. I think there is full agreement that this change makes the filter better do its intended job. --Gary
Hide
Steve Bilton added a comment -

I have tested this on a 1.8.8 moodle and it does not work

Show
Steve Bilton added a comment - I have tested this on a 1.8.8 moodle and it does not work
Hide
John White added a comment -

Steve,

Can you give a bit more detail about what goes wrong?
White screen?
Doesn't censor words?
Doesn't leave words uncensored?

Did you follow the instructions under 'description'?

Regards,
John

Show
John White added a comment - Steve, Can you give a bit more detail about what goes wrong? White screen? Doesn't censor words? Doesn't leave words uncensored? Did you follow the instructions under 'description'? Regards, John

People

Dates

  • Created:
    Updated: