I want to replace some characters in a vector of maps with a text in it.
This should be a part of a bigger program wich counts all the words in a list of texts.
The input-vector looks like this:
[{:text "bla. Bla! Blabla, foo"}
{:text "hello foo? bla Foo, blabla"}
{:text "bla blub Foo Bla blub"}]
The output should looks like this and should be sorted on the values:
{:bla 3 :Bla 2 :blub 2 :foo 2 :Foo 2 ... }
But first I want too clean the strings from some characters.
I tried it with map but I don't understand why this code is not working right:
(defn clean-texts []
(map (fn [x] (clojure.string/replace x #"[.,]" "")) (:text texts)))
The whole code looks like this:
(ns keyword-finder.core
(:gen-class))
(def texts
[{:text "bla. Bla! Blabla, foo"}
{:text "hello foo? bla Foo, blabla"}
{:text "bla blub Foo Bla blub"}])
(defn clean-texts []
(map (fn [x] (clojure.string/replace x #"[.,]" "")) (:text texts))
)
clean-textsand why are they incorrect?