expletive alternatives and similar packages
Based on the "Text and Numbers" category.
Alternatively, view expletive alternatives based on common mentions on social networks and blogs.
-
money
Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. -
nanoid
Elixir port of NanoID, a secure and URL-friendly unique ID generator. https://hex.pm/packages/nanoid -
secure_random
Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom -
chinese_translation
An elixir module to translate simplified Chinese to traditional Chinese, and vice versa, based on wikipedia data -
inet_cidr
CIDR library for Elixir that is compatible with Erlang's :inet and supports both IPv4 and IPv6 -
Ex_Cldr_Units
Unit formatting (volume, area, length, ...) functions for the Common Locale Data Repository (CLDR) -
minigen
Pure random data generation library, appropriate for realistic simulations in the Erlang ecosystem
CodeRabbit: AI Code Reviews for Developers
Do you think we are missing an alternative of expletive or a related project?
README
Expletive
An obscenity detection and filtering library for Elixir, freely inspired by the obscenity gem.
Installation
Add Expletive as a dependency to your project mix.exs
:
def deps do
[{:expletive, "~> 0.1.0"}]
end
Usage
All Expletive functions expect a configuration to be passed:
config = Expletive.configure(blacklist: ~w[very bad words])
Expletive.profane?("this is bad!", config)
# => true
Expletive.profane?("perfectly safe", config)
# => false
Expletive.profanities("this is bad, so BAD!", config)
# => ["bad", "BAD"]
Sanitization
The library offers a fairly wide variety of profanity replacement strategies which can be defined at configuration time or passed explicitly.
Expletive.sanitize("this is bad, so BAD!", config)
# => "This is $#!@%, so %$@!#!"
Expletive.sanitize("this is bad, so BAD!", config, :stars)
# => "This is ***, so ***!"
Expletive.sanitize("this is bad, so BAD!", config, :vowels)
# => "This is b*d, so B*D!
Expletive.sanitize("this is bad, so BAD!", config, ":poop:")
# => "This is :poop:, so :poop:!
Expletive.sanitize("this is bad, so BAD!", config, {:repeat, "-"})
# => "This is ---, so ---!
Expletive.sanitize("this is bad, so BAD!", config, :keep_first_letter)
# => "This is b**, so B**!
Expletive.sanitize("this is bad, so BAD!", config, {:keep_first_letter, "-"})
# => "This is b--, so B--!
Whitelisting
If you wish to allow some words present in the blacklist, you can add exceptions to a whitelist at configuration time:
config = Expletive.configure(blacklist: ~w[very bad words], whitelist: ~w[words])
Expletive.profane?("words", config)
# => false
Built-in blacklists
The library comes with a couple of word lists ready to use:
config = Expletive.configure(blacklist: Expletive.Blacklist.english)
Expletive.profane?("this is batshit crazy!", config)
# => true
config = Expletive.configure(blacklist: Expletive.Blacklist.international)
Expletive.profanities("ceci n'est pas une pipe", config)
# => ["pipe"]
Known Limitations
I18n concerns
A couple of replacement strategies (:vowels
and :nonconsonants
) are currently limited to the english language.