added the ability to return the offending word #21

Merged
Luberry merged 2 commits from master into master 2021-09-26 11:15:37 -04:00
Luberry commented 2021-09-24 20:05:53 -04:00 (Migrated from github.com)

I did not want to break the api, so i just updated the calls to wrap the old one, but i'm writing a discord bot that needs a filter like this, but wanted to list the word that was the offense in a log without re looping through.

I did not want to break the api, so i just updated the calls to wrap the old one, but i'm writing a discord bot that needs a filter like this, but wanted to list the word that was the offense in a log without re looping through.
TwiN (Migrated from github.com) requested changes 2021-09-25 12:45:53 -04:00
@ -77,11 +77,18 @@ func (g *ProfanityDetector) WithCustomDictionary(profanities, falsePositives, fa
// IsProfane takes in a string (word or sentence) and look for profanities.
TwiN (Migrated from github.com) commented 2021-09-25 12:45:50 -04:00

Would is be possible to rename this to ExtractProfanity or something similar?

Could also just return a string; if the len() of the string returned is > 0, then it pretty much means true already.

Would is be possible to rename this to `ExtractProfanity` or something similar? Could also just return a string; if the len() of the string returned is > 0, then it pretty much means `true` already.
Luberry (Migrated from github.com) reviewed 2021-09-25 13:12:55 -04:00
@ -77,11 +77,18 @@ func (g *ProfanityDetector) WithCustomDictionary(profanities, falsePositives, fa
// IsProfane takes in a string (word or sentence) and look for profanities.
Luberry (Migrated from github.com) commented 2021-09-25 13:12:55 -04:00
  • I'm fine with the rename, That was just a really quick name i came up with so i could get it implemented.
  • Its a little easier to use, in my opinion, if you aren't expected to check string length for profanity, and you could ignore the word. Though if you feel strongly about it only returning the string, i can make that implementation change, since at the end of the day its your project.
* I'm fine with the rename, That was just a really quick name i came up with so i could get it implemented. * Its a little easier to use, in my opinion, if you aren't expected to check string length for profanity, and you could ignore the word. Though if you feel strongly about it only returning the string, i can make that implementation change, since at the end of the day its your project.
TwiN (Migrated from github.com) reviewed 2021-09-25 14:42:13 -04:00
@ -77,11 +77,18 @@ func (g *ProfanityDetector) WithCustomDictionary(profanities, falsePositives, fa
// IsProfane takes in a string (word or sentence) and look for profanities.
TwiN (Migrated from github.com) commented 2021-09-25 14:42:13 -04:00

I'm fine with keeping the bool, so just the rename then :)

I'm fine with keeping the bool, so just the rename then :)
Luberry (Migrated from github.com) reviewed 2021-09-25 14:48:32 -04:00
@ -77,11 +77,18 @@ func (g *ProfanityDetector) WithCustomDictionary(profanities, falsePositives, fa
// IsProfane takes in a string (word or sentence) and look for profanities.
Luberry (Migrated from github.com) commented 2021-09-25 14:48:31 -04:00

already done

already done
TwiN (Migrated from github.com) approved these changes 2021-09-26 11:13:23 -04:00
codecov-commenter commented 2021-09-26 11:14:51 -04:00 (Migrated from github.com)

Codecov Report

Merging #21 (46ee798) into master (d66babb) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #21   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           73        76    +3     
=========================================
+ Hits            73        76    +3     
Impacted Files Coverage Δ
goaway.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d66babb...46ee798. Read the comment docs.

# [Codecov](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) Report > Merging [#21](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) (46ee798) into [master](https://codecov.io/gh/TwinProduction/go-away/commit/d66babb372f86e7cf0123a5c4dfde05310609690?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) (d66babb) will **not change** coverage. > The diff coverage is `100.00%`. [![Impacted file tree graph](https://codecov.io/gh/TwinProduction/go-away/pull/21/graphs/tree.svg?width=650&height=150&src=pr&token=25T9OQT9TM&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.)](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) ```diff @@ Coverage Diff @@ ## master #21 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 1 1 Lines 73 76 +3 ========================================= + Hits 73 76 +3 ``` | [Impacted Files](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) | Coverage Δ | | |---|---|---| | [goaway.go](https://codecov.io/gh/TwinProduction/go-away/pull/21/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.#diff-Z29hd2F5Lmdv) | `100.00% <100.00%> (ø)` | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.). Last update [d66babb...46ee798](https://codecov.io/gh/TwinProduction/go-away/pull/21?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chris+C.).
TwiN commented 2021-09-26 11:37:50 -04:00 (Migrated from github.com)

@Luberry Thank you for your contribution!

I'm sorry for going back on my word, but I ended up removing the boolean from ExtractProfanity - it just didn't make sense to me.
If somebody wants to have just the boolean, they can simply use IsProfane.

In any case, this has been released in v1.3.0

@Luberry Thank you for your contribution! I'm sorry for going back on my word, but I ended up removing the boolean from `ExtractProfanity` - it just didn't make sense to me. If somebody wants to have just the boolean, they can simply use `IsProfane`. In any case, this has been released in [v1.3.0](https://github.com/TwinProduction/go-away/releases/tag/v1.3.0)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
TwiN/go-away!21
No description provided.