webtagger
Webtagger is a simple ruby gem that uses the web intelligence to extract important terms in texts, suitable for tagging them, finding the main subject or automatically building queries.
-
Tag-the-net (Needs and API key!)
-
Alchemy API (Needs an API key!)
And it’s written to support any API in the future.
Installation
gem install webtagger
Usage
require 'webtagger'
text = "Hi, I'm text"
#you simply call the appropriate method:
= WebTagger.tag_with_tagthe(text)
#some APIs might need an api key, pass that as the second parameter
= WebTagger.tag_with_yahoo(text, "YOUR-API-KEY")
#you can also "OR" results together: the first service that responds will be the overall result
= WebTagger.tag_with_yahoo_or_tagthe_or_alchemy text, {:yahoo=>"YOUR_YAHOO_KEY", :alchemy=>"ALCHEMY_KEY"}
#and you can of course "AND" results together: call all of the services:
= WebTagger.tag_with_yahoo_and_tagthe_and_alchemy text, {:yahoo=>"YOUR_YAHOO_KEY", :alchemy=>"ALCHEMY_KEY"}
#however, you can't combine them: this is EXACTLY THE SAME as above :(
= WebTagger.tag_with_yahoo_and_tagthe_or_alchemy text, {:yahoo=>"YOUR_YAHOO_KEY", :alchemy=>"ALCHEMY_KEY"}
WebTagger uses caching so rest assured you won’t be throttled by the API providers.
If something funny happens (a 4XX or 5XX response is returned), nil will be returned.
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2010 lfborjas. See LICENSE for details.