This commit is contained in:
Daniella / Tove 2024-05-29 14:49:43 +02:00
parent 02f5016243
commit a6709ce84e

View file

@ -41,6 +41,9 @@ public class ChatFilter extends Feature {
@Config("Filter possibly ableist")
public boolean lesserAbleist = false;
@Config("Filter -oid")
public boolean oid = false;
@Override
public String toString() {
return "ChatFilter";
@ -55,7 +58,7 @@ public class ChatFilter extends Feature {
if(ethnic) {
for (String slur : ETHNIC_SLURS) {
if(containsWord(message, slur)) {
message = filter(message, slur, "ethnic");
message = filter(message, slur, "ethnic slur");
changed = true;
}
}
@ -63,7 +66,7 @@ public class ChatFilter extends Feature {
if(queerphobic) {
for (String slur : QUEERPHOBIC_SLURS) {
if(containsWord(message, slur)) {
message = filter(message, slur, "qphob");
message = filter(message, slur, "qphob slur");
changed = true;
}
}
@ -71,7 +74,7 @@ public class ChatFilter extends Feature {
if(lesserQueerphobic) {
for (String slur : LESSER_QUEERPHOBIC_SLURS) {
if(containsWord(message, slur)) {
message = filter(message, slur, "Pqphob");
message = filter(message, slur, "Pqphob slur");
changed = true;
}
}
@ -79,7 +82,7 @@ public class ChatFilter extends Feature {
if(ableist) {
for (String slur : ABLEIST_SLURS) {
if(containsWord(message, slur)) {
message = filter(message, slur, "ableist");
message = filter(message, slur, "ableist slur");
changed = true;
}
}
@ -87,7 +90,15 @@ public class ChatFilter extends Feature {
if(lesserAbleist) {
for (String slur : LESSER_ABLEIST_SLURS) {
if(containsWord(message, slur)) {
message = filter(message, slur, "Pableist");
message = filter(message, slur, "Pableist slur");
changed = true;
}
}
}
if(oid) {
for (String oid : OID) {
if(containsWord(message, oid)) {
message = filter(message, oid, "oid");
changed = true;
}
}
@ -128,7 +139,7 @@ public class ChatFilter extends Feature {
result.append(matcher.group().replaceFirst("[aeiou]", "*"));
break;
case Replace:
result.append("[").append(type).append(" slur removed]");
result.append("[").append(type).append(" removed]");
break;
}
last = matcher.end();
@ -144,6 +155,7 @@ public class ChatFilter extends Feature {
public static final String[] ETHNIC_SLURS = new String[] {
"nig+a?e?h?r*",
"negr+o(id)?",
};
public static final String[] QUEERPHOBIC_SLURS = new String[] {
@ -172,5 +184,9 @@ public class ChatFilter extends Feature {
"delusional",
};
public static final String[] OID = new String[] {
"\\w*oid",
};
// THE HORROR END
}