We recently released a new wordpress plugin. Tagbag, takes the thought out of selecting tags for your post, or at least that is how we see it. Take a look for yourself, and if you find no benefit in using the plugin, you may find some worthy code examples with in the plugin.
WordPress Plugin: http://wordpress.org/extend/plugins/tagbag/
Source Code: https://github.com/oneuplogic/Tagbag