Use lingpipe to do sentiment analysis
How to run and configure the sentiment analysis on aspect-level.
- Run on eclipse:
- You need a plugin called "egit" to clone the repository from here to your local machine.
- After the cloning, import the project into your workspace
- You need to add junit-4.8.2.jar into your project java build path. Then Compile the project.
- Run the Extrator class under package xinghuangxu.lingpipe.snipeet.extractor
Run configurations-> Program Arguments -> Input the Command:- l + r
l and r are the left and right size of the snipeet. For example: if [ - 5 + 5 ] is input, snipeet will look like [w1 w2 w3 w4 w5 target w1 w2 w3 w4 w5] - After that you can run the main class in Extractor.class and you will be able to find the results inside the .../xinghuangxu.lingpipe/Sentiment_DB/Log_DB folder.
-
Run in JVM:
- Download the project from the repository, install java 7(JVM)
- open your terminal, navigate to the project directory ../xinghuangxu.lingpipe/
- input command:
java -jar kdd-lingpipe-sentiment.jar - l - r
- After that you can run the extractor and you will be able to find the results inside the .../xinghuangxu.lingpipe/Sentiment_DB/Log_DB folder.
Folder Structure: Sentiment_DB Training_DB Review_DB Log_DB - If you want to run a new group of data.
Put your data into the Review_DB folder which will be created under .../xinghuangxu.lingpipe/Sentiment_DB/ the first time you run the program. For example, if you want to get the sentiment of camera. You can create a folder named Camera and put all the xml review files inside that folder. After that you also need to add a aspect file inside this folder.An example of aspect file(the name of the aspect file must include an "aspect" string):
<Camera><Screen>Screen|LED</Screen><Images>Image|Quality|Prints|Color|Clarity|Pictures|Photos|Snapshots|Indoor shots|Outdoor shots </Images><Battery>Batter</Battery><Zoom>Zoom|Digital zoom</Zoom><Features>Feature|Setting|Auto</Features><Price>Price</Price></Camera>