One of the biggest task while writing article or blog is to have right set of keywords on which your article or blog can rank high on search results. There are two ways to have right set of keywords in your article:
- People search for right keywords, and write content based on them. Basically fill those keywords in the article or blog.
- People write article or blog, and then put keywords, either as meta keywords, or having a tag field. So that it will help users to find right content.
I will focus on 2nd approach here.
I use to write articles on a veriety of things. And, one of the field in my article form is Tags. I like to fill Tags field, as it is great for SEO purpose too, and users findthis useful.
I used to write articles first, and then look for keywords out of that article. And, later on, I found this process lengthy. This is actually a time consuming.
I always wanted some kind of automation here, that I give my text, and please let me know the tags.
OpenCalais - The Solution
I found this service OpenCalais the perfect match to my problem. And the good thing is that it is absolutely free. They call it as their Tag service, where you provide your text, and they will tell you the tags. They have some serious intelligence in fetching the tags based on some Machine learning, and analytics.
There are two ways you can use it:
1. From OpenCalais viewer
Goto OpenCalais Viewer, and you have the option of copy-paste your text, and upload your document. And, then click on “Tag it” You put some text in their textarea, and click on Tag button, and you will get nice tags.
And, the results will look like:
All english words under SocialTags are your ready to made tags, just copy them, and use it in your Tags field.
2. Via Rest APIs
They also provides you to use their rest apis. You need to get an API key from their page here. You will need to register, and you will get an api key. Something like a big random alphanumeric string.
They have provided some sample codes in following languages:
And, you can see their sample code here.
Ready to use Code for your purpose
I have made a sample code for you so that you don’t need to parse the results. The code is shared at github.
Below are the steps to use:
- Put your text content in a file, say file.txt (It can have html too)
- Open your console
- From github, run fileopencalais.py as:
pythonopencalais.py file.txt "Your secret api key"
- You will get output on console. Each tag separated by a new line.
The code is shared at:https://github.com/GyanBlog/TaggingFactory