Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def bad-word-lists ["english" "dutch" "french"])
- (defn load-bad-word-list [name]
- (read-lines (io/resource (str "badwords/" name ".txt"))))
- (def bad-words (apply concat (map load-bad-word-list bad-word-lists)))
- (def bad-words-re (re-pattern (string/join "|" bad-words)))
- (defn sanitize [text]
- (println text bad-words-re)
- (string/replace
- text bad-words-re
- (fn [badword]
- (apply str (map (fn [[i l]]
- (if (= (mod i 3) 0)
- "-"
- l))
- (indexed badword))))))
Add Comment
Please, Sign In to add comment