@hackage banwords0.2.0.1

Generalized word blacklister

Intro

A few tools for checking if a word is a close match against a blacklist.

Example

{-# LANGUAGE OverloadedStrings #-}

module Main where

import Data.Monoid
import Data.Text (Text)
import Data.Vector (Vector)
import qualified Data.Vector as V
import Heuristics.BanWords

main :: IO ()
main =
  case passBlacklist banAlmostExact blacklist "acme " of
    Nothing -> putStrLn "Blocked 'acme '"
    Just _  -> error "This shouldn't happen!"

blacklist :: Vector Text
blacklist = exampleReserved -- Includes "admin", "security", and a few others.
         <> V.fromList ["gosh", "darn"] -- Supply your own profanity list.
         <> V.fromList ["acme"] -- Prevent users from impersonating your company.