OPAL is a Drupal plugin that analyses comments posted by users and detects whether they are positive, negative or neutral. In addition, it calculates the joint polarity of all comments attached to a content type and deliveries an overall rank for the post.
The goal of the application is to show how opinion mining can aid in assessment of content such as ideas in Idea Management Systems.
By default OPAL will add snippets to all content types and comments.
For content types it will display:
- An image that visualises balance between emotions expressed in all comments
- Overall polarity score together with percentage of positive/negative/neutral posts
- Amount of positive, negative and neutral posts
For each comment:
- An image that visualises the sentiments in the comment (positive, negative or neutral)
- Polarity score
In each case the amount of information that is shown can be customized in module settings (Site Configuration/Opinion Analyser). All the information can be themed with CSS (see module directory) but is also passed in $node and $comment objects for more advanced theming. In addition, OPAL is supported by RDFme so its possible to export the opinion mining data along with other information into RDF/XML.
Images:
Screenshot
Snippets
Demo Website:
OPAL at www.fernandotapiarico.com
Project Sandbox: http://drupal.org/sandbox/FernandoTapiaRico/1085144
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | opal-greatsuccess.png | 60.73 KB | coderintherye |
Comments
Comment #1
heine commentedIf did a partial review and posted some critical issues on the sandbox issue queue.
Comment #2
coderintherye commentedBased on the issues that Heine filed I think this is currently a "needs work". Looking forward to seeing it move forward though, got my eye on this one.
Comment #3
FernandoTapiaRico commentedFixed the issues
Thanks guys for the reviews
Comment #4
rfayHow can your opal.info not have a core = 6.x or core = 7.x in it?
We don't use $Id$ any more, so you can remove those.
What is the source and license of the sentiwordnet database?
Could you just use variable_set() instead of having an opal_config database?
Overall, it looks like this one is pretty close. Thanks for playing, and sorry for the long wait between reviews.
BTW: I see that your reponses to those three issues were all contained in a single commit. It would be better practice to use one commit per issue, so that someone could see what you did to fix their exact issue. (And as I said over there, quote the hash or a link to the commitlog so somebody could see what you actually did. Or include a patch.)
Comment #5
FernandoTapiaRico commentedHi rfay,
I just added 'core= "6.x"' to opal.info. I also remove the $Id$ tags. The SentiWordNet license is free for non-commercial use (link). It was a good idea to use variable_set instead of opal_config database.
Here is my commit.
Thank you all for the reviews.
Comment #6
rfayIf SentiWordnet is not GPL it will have to be removed and you'll have to have instructions on how to load it.
http://drupal.org/licensing/faq
Comment #7
FernandoTapiaRico commentedOk,
I updated the OPAL info and removed the SentiWordNet database from the sources. I don't really like this solution and I'm trying to create an external service or use APIs like this one.
Here is the link to the last commit.
I added the following lines to the module description:
Initial setup
Before installing the module, you must copy the SentiWordNet database in your OPAL directory. You can download it from: here
IMPORTANT: SentiWordnet License
Comment #8
FernandoTapiaRico commentedComment #9
coderintherye commentedAdmittedly, the hard position on keeping non-GPL content off of d.o. does make for difficulties sometimes, but I think you'll see it prevents a lot of problems and is worth it in the long run.
I'm still really excited about this, especially after this post on Hacker News today:
So a couple things:
1) Create a README.txt - This file should contain info on how to obtain and use the SentiWordnet database along with any other information that would make it easier for a user to install your module.
2) Use the coder module to perform code reviews http://drupal.org/project/coder - This will help you clean up your code to better meet d.o. standards
3) It seems like you are using SQL queries as your hammer to solve all problems. This isn't too bad in and of itself, but where possible see if there are places where a Drupal function is already in place to give you the data you need rather than
4) For your log file (line 630 or so), you shouldn't hardcode sites/default/files, but rather use the file handling functions - http://api.drupal.org/api/drupal/includes--file.inc/group/file/6
5) I'm concerned about the Google Translation API usage because it's being deprecated. Is there an alternative way to handle this functionality? (See http://code.google.com/apis/language/translate/overview.html )
Keep up the good work, it's getting there.
Comment #10
FernandoTapiaRico commentedHi nowarninglabel,
thanks for the tips. I just updated the module, here is the commit:
http://drupalcode.org/sandbox/FernandoTapiaRico/1085144.git/commit/f2d4ca2751c73238d62e6a6c2f90593a7dc8e984
1) Done
2) I used the latest version of Coder module. I only got this error:
Line -1: Include the CVS keyword $Id$ in each file. This should be in the format // $Id$ or // $Id$ (Drupal Docs)But that's not valid after GIT adoption
3) I noticed that, but I didn't find any Drupal function to get a comment from its ID, or all the Drupal nodes. if you can give me some light on this, I would appreciate it.
4) I removed log file (used for development)
5) I change Google Translator API for Microsoft Translator API
Regards
Comment #11
coderintherye commentedOk, I just ran the updated version on a fresh D6 site and it's working great. I'm attaching a screenshot of how it analyzed a comment and node.
Honestly, this looks like a great success, at least worthy of a dev release so others can get involved. I'll offer to help co-maintain a bit if needed. I'm sure others who have a more detailed eye might pick up on some things, but you've responded timely with updates and look like you understand how to do everything a project maintainer should do so I'm +1 on giving you commit access and a project page.
Comment #12
FernandoTapiaRico commentedHi nowarninglabel,
thanks for your support. Any help on the project would be appreciated, so feel free to "come on board". At this moment, it's more a proof of concept than a solid module, but that's the nice thing: there is a lot of stuff to improve.
Cheers
Comment #13
sreynen commentedSorry, I don't think this is quite ready yet. I opened a few issues in your project queue. Please move this back to "needs review" when those are addressed.
Comment #14
FernandoTapiaRico commentedI'm currently on vacations. I will take a look to those issues when I come back. Thanks for debugging my app. Cheers
Comment #15
FernandoTapiaRico commentedHi sreynen,
sorry for the late reply, but I've been busy with my projects related to RDFLib and Apache Mahout. I've fixed all the issues that you pointed out:
http://drupal.org/node/1205916
http://drupal.org/node/1205908
http://drupal.org/node/1205906
http://drupal.org/node/1205904
Thanks for your time.
Best regards
Comment #16
sreynen commentedLooks good to me.
Comment #17
tim.plunkettPlease read through CSS Cleanup, there are a lot of functional styles mixed in with arbitrary coloring.
Also, the definition for
hook_init()says "To add CSS or JS that should be present on all pages, modules should not implement this hook, but declare these files in their .info file."When writing CSS, 0 (zero) is unitless. Therefore,
left: 0px;should beleft: 0;.In the .info file, there are no quotes around any of the values, and you are missing the description.
Remember to not end lines with extra whitespace.
Finally, remove the author and version information from each file.
Comment #18
FernandoTapiaRico commentedHi Tim,
thanks for your help, it's always good to learn things. I fixed everything except the hook_init() thing. This is a Drupal 6.x module, not a 7.x module (or, at least, I didn't check if it works on the new version of Drupal). So, I'm following this:
hook_init() [Drupal 6]
instead of this:
hook_init() [Drupal 7]
In case of I submit a Drupal 7.x version, I will add to opal.info these lines:
and remove these ones:
Here are the commits:
Issues: http://drupalcode.org/sandbox/FernandoTapiaRico/1085144.git/commit/f82675d
Some CSS refactoring: http://drupalcode.org/sandbox/FernandoTapiaRico/1085144.git/commit/8b11e3a
Cheers
Comment #19
FernandoTapiaRico commentedComment #20
tim.plunkettYou are completely right, that is a D7-only feature (see #328357: Allow module .info files to add CSS/JS). Thanks for pointing that out and not just blindly following my suggestions!
I've granted you full project creation rights. Use this ability carefully!
Thank you for your patience.
Comment #21
coderintherye commentedWell done, welcome to the community. Look forward to seeing more of your work.
Comment #22
FernandoTapiaRico commentedThank you nowarninglabel
I will do my best.
Best regards