I am looking to create a function that will take a text and parameter strings "neg","pos", and "sum" and calculate a sentiment value for the text. I want to use ReplaceAll and/or "If' for this. I have two lists, one with negative (negativeWords) and one with positive words (positiveWords), and I want the function to assign the value of +1 to words in the text that are also in the positive words list, -1 to words in the text that are also in the negative words list, and 0 for words that are in neither list, and then calculate the sum of those numbers.
This is what I have so far but I am stumped :/
ToLowerCase@TextWords@text_ /. {negativeWords -> -1, positiveWords -> 1, ! negativeWords && ! positiveWords -> 0}