From bf72da0264e1a5cdeaa9fde17e7474a515fe00c8 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 3 Oct 2024 12:32:25 +0100 Subject: [PATCH 1/3] feat: Add new word to DefaultProfanities slice Add new word to the DefaultProfanities slice in profanities.go: "gyat". Update one comment in falsenegatives.go to add missing word "matter". --- falsenegatives.go | 2 +- profanities.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/falsenegatives.go b/falsenegatives.go index 7331a27..dc4bfb0 100644 --- a/falsenegatives.go +++ b/falsenegatives.go @@ -4,7 +4,7 @@ package goaway // // This is reserved for words that may be incorrectly filtered as false positives. // -// Alternatively, words that are long, or that should mark a string as profane no what the context is +// Alternatively, words that are long, or that should mark a string as profane no matter what the context is // or whether the word is part of another word can also be included. // // Note that there is a test that prevents words from being in both DefaultProfanities and DefaultFalseNegatives, diff --git a/profanities.go b/profanities.go index 11a304c..b008938 100644 --- a/profanities.go +++ b/profanities.go @@ -86,4 +86,5 @@ var DefaultProfanities = []string{ "vagina", "wank", "whore", + "gyat", } From 8484406c67e5ebbfb332b0c4441885c7c93d15f2 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 3 Oct 2024 13:49:04 +0100 Subject: [PATCH 2/3] chore: Add test case for filtering the new word in input strings. --- goaway_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/goaway_test.go b/goaway_test.go index 5d4c0eb..210cd8a 100644 --- a/goaway_test.go +++ b/goaway_test.go @@ -150,6 +150,11 @@ func TestProfanityDetector_Censor(t *testing.T) { expectedOutput: "document **** document ****", expectedOutputWithoutSpaceSanitization: "document **** document ****", }, + { + input: "Everyone was staring, and someone muttered ‘gyat’ under their breath.", + expectedOutput: "Everyone was staring, and someone muttered ‘****’ under their breath.", + expectedOutputWithoutSpaceSanitization: "Everyone was staring, and someone muttered ‘****’ under their breath.", + }, } for _, tt := range tests { t.Run("default_"+tt.input, func(t *testing.T) { From 704362e0d5dfae8f156060f918d60e51468cfd58 Mon Sep 17 00:00:00 2001 From: Jason <85848469+jasonuc@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:39:10 +0000 Subject: [PATCH 3/3] chore: puts new word in alphabetical order --- profanities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanities.go b/profanities.go index b008938..7bf8ac4 100644 --- a/profanities.go +++ b/profanities.go @@ -41,6 +41,7 @@ var DefaultProfanities = []string{ "fudgepacker", "flange", "gtfo", + "gyat", "hoe", // while that's also a tool, I doubt somebody would be checking for profanities if that tool was relevant "horny", "incest", @@ -86,5 +87,4 @@ var DefaultProfanities = []string{ "vagina", "wank", "whore", - "gyat", }