-
-
Save shayanjm/469a8f0484753f777672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn update-sentiments | |
"Updates the given atom's sentiments & average-sentiments fields with the sentiment-analyzed body text of each article." | |
[atomstore] | |
(let [sentiments (apply list (doall (pmap #(find-sentiment (get-nyt-article-contents %)) (:urls @atomstore))))] | |
(dosync | |
(swap! atomstore assoc-in [:sentiments] (identity sentiments)) | |
(swap! atomstore assoc-in [:average-sentiments] (map mean sentiments))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment