Python

warning: Creating default object from empty value in /var/www/drupal/modules/taxonomy/taxonomy.pages.inc on line 33.
Non-django python stuff

It's time to Django Bingo!

I finally got around to putting a version of Django Bingo online:

Django Bingo at Github

For an example dashboard, see my network monitor.

Note that it is very rough, I hope to improve the code over the next few
weeks. But at least you have something to play with!

Give it a try and let me know what you think (both good and bad).

Python OpenAmplify class

Today I've been fooling around with OpenAmplify, a web service that aims to transform natural language into 'meaning'. With it you can derive the topics, polarity (postive/neutral/negative) and demographics from a text.

I was (naturally) skeptical at first, but it does a pretty good job. I've also written a quick Python class to easily use the API and the returned data. An example for using the OpenAmplify class to determine the topics from the main CNN website:

>>> import openamplify
>>> key = "(fill in your OpenAmplify key here)"
>>> oa = openamplify.OpenAmplify(key)
>>> data = oa.submit_url('http://www.cnn.com')
>>> oa.get_topics()
[('Obama', 25.0, 'Positive', 0.78453700000000004, 'Not At All', 1.0, 
'Not At All', 1.0), 
('news', 22.0, 'Negative', -0.55709600000000004, 
'To Some Extent', 2.0, 'Not At All', 1.0), 
('bomber', 21.0, 'Positive', 0.123623, 'To Some Extent', 
2.0, 'A Lot', 3.0), 
('CNN', 18.0, 'Neutral', 0.0, 'To Some Extent', 2.0, 
'Not At All', 1.0), 
('Lockerbie', 18.0, 'Negative', -0.26864700000000002, 
'To Some Extent', 2.0, 'A Lot', 3.0), ...]

get_topics() returns a list of tuples, with each tuple containing the name, prominence of the name, polarity, polarity value etc.

What we see here is that, at the time of parsing, CNN is quite postive about Obama and negative about Lockerbie.

Note that not all topics are relevant, but that's because I asked OpenAmplify to parse the whole webpage (which includes navigation, footers and the like). A better way is to use oa.submit_text(string) with only the text you want to process.

For fun, lets try Fox:

>>> data = oa.submit_url('http://www.foxnews.com')
>>> oa.get_topics()
[('Obama', 56.0, 'Positive', 0.158717, 'To Some Extent', 2.0, 
'Not At All', 1.0), 
('Fox', 42.0, 'Positive', 0.094161999999999996, 
'To Some Extent', 2.0, 'Not At All', 1.0), 
('Renee Zellweger', 18.0, 'Negative', -0.93333299999999997, 
'Not At All', 1.0, 'Not At All', 1.0),
 ('Lockerbie', 15.0, 'Negative', -0.45216499999999998, 
'To Some Extent', 2.0, 'Not At All', 1.0) ...]
>>> oa.get_demographics_data()
{'Gender': {'Name': 'Female', 'Value': 1.0}, 
'Age': {'Name': 'Adult', 'Value': -0.0095429999999999994}, 
'Education': {'Name': 'Pre-Secondary', 'Value': 1.0}, 'Language': 
{'Name': 'English', 'Value': 21.747212000000001}}

How's about that, Fox is actually positive about Obama. Not as much as CNN though. And clearly Renee Zellweger has done something naughty. The text was also most likely written by an adult female with pre-secondary education, but I suspect you shouldn't take the demographics-data too seriously.

Other things OpenAmplify returns: domains, guidance, decisiveness, style, locations and intentions. Their API is free to use for up to 1k requests a day.

OpenAmplify is one of many steps via which Natural Language Processing is advancing, and although it might not be very academic it seems to be a useful service for easily processing large amounts of text.

Pervidet launched and bday!

After a few weeks of work on-the-side, today Pervidet sees the light! Aperte Pervidet (to survey openly) is a free web survey/questionnaire service that has grown out of a number of different Aperte projects. I'm still tweaking it in various ways and working out the kinks but if you are interested give it a try and let me know how it goes!

Technically I've dived into various technologies to make Pervidet tick. jQuery is something I've dabbled in for quite some time and I've made decent use of it in Pervidet (it makes Javascript nearly useful!). Also I've taken an interest in the design of dashboards, which I'm fleshing out in the survey-building interface of Pervidet. Naturally PostgreSQL and Django purr along happily in the backend.

Pervidet has an about-page for the full story, but it came about mostly due to being annoyed about all the existing web survey platforms. Over the next few months I plan to look into setting up other kinds of web services, hopefully a few where my AI-background comes into play too. Nothing in your portfolio beats a couple of real-world tools that are actually useful.

In other news, I turned 27 today. Getting grayer by the day! :)

N95: Contact birthdays to calendar application

Although my current N95 mobile phone isn't bad compared to the competition (hell, you can even call people with it), there are a few quirks that annoy me.

One of these is rather simple: For every contact you can assign a birthday. However, these birthdays don't automatically show up in your calendar (and thus don't show up as an anniversary on the main display). Adding birthdays to your contacts doesn't do snap. Even though adding birthdays to your contacts seems to be the logical thing to do.

There are a few workarounds, but they didn't work for me. Instead, I wrote a small N95 Python application to send all the birthdays in the contact list to the calendar as anniversaries. Here it is: Contact-to-calendar.py.

In order to run this script, you need to install PyS60 and place the script in the /Python directory on your phone. Then start the Python shell, select Run Script and select contact-to-calendar.py to run the application.

I was hoping to make a .sis file (native Symbian package) in order to simplify the process, unfortunately Symbian has S60 locked down for non-commercial or open source developers for certain types of usage (see Why Symbian Signed must die).

Pity, I was seriously considering developing stuff for my phone, but if I'm the only one that can use my code it becomes rather pointless.

Happy bday to me!

Forgot all about posting last tuesday that I'm really getting old (26). Had a nice relaxed day with lots of presents and a dinner at a nice Thai restaurant thanks to the misses. This weekend I'll have a dinner with the family, and we'll have a bbq/party next weekend.
These last few weeks have been rather quiet, compared to other years where you have the end-of-the-year course deadlines. I've been spreading my wings a bit into other areas: doing research into Google/Yahoo APIs, playing around with Arduino (example, 6MB uncompressed mpeg2 warning), working on learning python-ogre (and writing/converting tutorials) and fooling around with the gc-linux wii proof-of-concept (but I'm not much of a kernel hacker). Aperte does R&D too, you know! :)
I also got a load of books via Amazon. "Don't make me think" was on the top of my list thanks to Jure, and I must admit being rather ashamed of my website "designs" even after only reading the first few chapters. Definitely on the required reading list for anyone calling themselves a web developer...
Oh, and yes: I'm getting gray already.

Syndicate content