(require '[clojure.string :as str])

(defn fix-grammar [text]
    (str/replace text #"(\s)([\.\,\?\!])" "$2"))      ; Remove space before .,?!
    ; (str/replace text #"\(\s(\w+)\s\)" "\($1\)")      ; Remove extra spaces between parentheses
    ; (str/replace text #"\[\s(\w+)\s\]" "\($1\)")      ; Remove extra spaces between square brackets
    ; (str/replace text #"@(\d+)@" "$1")                ; Remove @ around digits
    ; (str/replace text #"@\s" "@")                     ; Remove space between @ and word


(def text "The experienced man , named Oz , representing the @416@ area code - and his ( principal ) assistant - are not in the suggested @ list [ production , development ] . is that actually the correct information ?")

(println (fix-grammar text))

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: