diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0c899ff5659a17094f7674f6ff6daacf1119b739..2c64d047b7614b5e797f1565fd1edf5465ef5c13 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -51,8 +51,8 @@ <file leaf-file-name="README.md" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/README.md"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="480"> - <caret line="32" column="63" selection-start-line="32" selection-start-column="63" selection-end-line="32" selection-end-column="63" /> + <state relative-caret-position="360"> + <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" /> <folding /> </state> </provider> @@ -489,12 +489,12 @@ <workItem from="1480638593636" duration="502000" /> <workItem from="1480639104215" duration="1864000" /> <workItem from="1480641007400" duration="133000" /> - <workItem from="1480641193493" duration="238000" /> + <workItem from="1480641193493" duration="435000" /> </task> <servers /> </component> <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="3188000" /> + <option name="totallyTimeSpent" value="3385000" /> </component> <component name="ToolWindowManager"> <frame x="0" y="22" width="1906" height="970" extended-state="0" /> @@ -688,8 +688,8 @@ </entry> <entry file="file://$PROJECT_DIR$/README.md"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="480"> - <caret line="32" column="63" selection-start-line="32" selection-start-column="63" selection-end-line="32" selection-end-column="63" /> + <state relative-caret-position="360"> + <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" /> <folding /> </state> </provider> diff --git a/README.md b/README.md index fbbeab5c5287af972f67de94e02eac6c85fc0ab5..4f0bf5f4e80c3da42b17ad6e352eca007f168a0c 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,28 @@ This class takes a sentence as input and outputs its 'happiness'. Happiness is a categorical variables that takes values: + 1 when the overall sentiment of the sentence is positive + -1 when the overall sentiment of the sentence is negative + 0 when the overall sentiment of the sentence is neutral The code uses two lexicons for sentiment computation: 1) BingLiu's lexicon at http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html + Please cite one of the following two papers: - Minqing Hu and Bing Liu. "Mining and Summarizing Customer Reviews." - Proceedings of the ACM SIGKDD International Conference on Knowledge - Discovery and Data Mining (KDD-2004), Aug 22-25, 2004, Seattle, - Washington, USA, - Bing Liu, Minqing Hu and Junsheng Cheng. "Opinion Observer: Analyzing - and Comparing Opinions on the Web." Proceedings of the 14th - International World Wide Web conference (WWW-2005), May 10-14, - 2005, Chiba, Japan. + Minqing Hu and Bing Liu(2004). Mining and Summarizing Customer Reviews. Proceedings of + the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining + (KDD-2004), Aug 22-25, 2004, Seattle, Washington, USA. + + Bing Liu, Minqing Hu and Junsheng Cheng (2005). Opinion Observer: Analyzing and Comparing Opinions on the Web. + Proceedings of the 14th International World Wide Web conference (WWW-2005), May 10-14, 2005, Chiba, Japan. 2) MPQA lexicon + Please cite: Theresa Wilson, Janyce Wiebe and Paul Hoffmann (2005). Recognizing Contextual @@ -30,11 +33,17 @@ Please cite: Example of how to use this class public void demo() throws Exception{ + SentimentHandler sentimentHandler = new SentimentHandler(); + String sent = "She thought she was not happy."; + Pair<Integer, Integer> happ = sentimentHandler.getHappiness(sent); + System.out.println("Happiness according to BingLiu Lexicon: "+happ.getFirst()); + System.out.println("Happiness according to MPQA Lexicon: "+happ.getSecond()); + }