kaikalii / censor

Rust profanity filtering library
10 stars 3 forks source link

Add support for grawlixes and offsets #2

Closed adamsoutar closed 3 years ago

adamsoutar commented 3 years ago

(Intended to be read after PR #1)

This PR adds support for "grawlixes" - the #$!?@ strings you see replace swears in comics, and for offsets, so you can leave the first/last letters uncensored if you wish.

It allows you to write the following (actual swears left out):

censor.censor("f..k you");
// Returns: "**** you" - API here remains unchanged

censor.censor_with_grawlix_and_offsets("f..k you", "@#$%&!", 1, 1);
// Returns: "f#$k you" - New, extra function

If you feel this complicates the API too much & don't want to merge, I totally understand and I can keep this to my own fork - but I thought I may as well create a PR.

kaikalii commented 3 years ago

This looks great! There are just a few API changes I would like to make. Will you you give me edit permission so I can make them?

adamsoutar commented 3 years ago

Sure!

image

As far as I can see, that option was already ticked? Is there something else I need to change?

kaikalii commented 3 years ago

Hmm, when I clone your fork, I don't get this commit. I'll just merge this for now, and then make the changes on main. Should have it updated on crates.io later today.

adamsoutar commented 3 years ago

That's weird. Sounds good, anyway 👍