Skip to content

Instantly share code, notes, and snippets.

Avatar
🗿
.

Bob Poekert bobpoekert

🗿
.
View GitHub Profile
View sentiments.clj
(def nlp
(let [props (new java.util.Properties)]
(.setProperty props "annotators" "tokenize,ssplit,parse,sentiment")
(new edu.stanford.nlp.pipeline.StanfordCoreNLP props)))
(defn find-sentiment
"Determines the sentiment of each sentence in a given glob of text. Results in a collection of integers ranging from [0-4]: where 0 is 'Very negative', 2 is 'neutral', and 4 is 'Very positive'"
[^String glob]
(let [main-sentiment 0
longest 0]