Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns retriever.core
- (:require [clojure.string :as str]
- [clojure.pprint :refer [pprint]]))
- (def text
- (-> (slurp "resources/article.txt")
- (str/replace #"[\.,();]" "")
- (str/split #"\s+|—")
- frequencies))
- (def cities (next (str/split-lines (slurp "resources/city.txt"))))
- (def countries (next (str/split-lines (slurp "resources/countries.txt"))))
- (defn match [text file]
- (remove (fn [v] (let [[_ b] v] (nil? b)))
- (pmap (juxt (fn [a] a) text) file)))
- (defn -main []
- (pprint (match text cities))
- (pprint (match text countries))
- (pprint "The End"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement