Create Bluemix account and Alchemy API.
Login to Bluemix at https://console.ng.bluemix.net. ( Create a new one if you do not have it )
Set up for the Alchemy service. Once created – note down the credentials and the API_KEY for further use.
Interpret the news.
Let's say the user wants to know if he wants to invest in bullion, or metals ( in this case we pick Copper ). I would want to know if it is a good thing to buy, sell or hold.
Here I will give various examples on how to get this data and read the sentiments and other data.
A simple API call would be to get all information about a particular industry sector i.e metals. ( e.g: Copper ) and return the data.
Create an URL including the API_KEY and mention the query ( referenced by the letter q below ) and mention how the return has to be, in this case return a JSON of title and url and post it in the browser.
Note : The return = url and title and watch the output, “return = enriched.url.url¬† and enriched.url.title”
The query in the URL is “q.enriched.url.url”
Watch for daily query limits - or else you can encounter an error as shown.
Sometimes you might run out of number of queries for a day. There is a certain limit per day for 'unlicensed' users – then we can expect to see such an error. To resolve one has to purchase a licensed version of the API.
A snapshot of transactions exceeded message :
Query for news having "Trump" as the keyword in the title and in the Government and Politics section.
Here, I want to query for News that has the “trump” in it's title, Start and End Date, and look in the “Govt and Politics” section.
The same API in text here:
The resulting JSON output would be something like :
Note the “return” in the API where we specify the different types of information we need to see.
We can also see the “document sentiment” along with a score to help us make some business decisions.
The inputs are mentioned by the “q -query “parameter in the API.
More such keys can be found at this URL : http://www.ibm.com/watson/developercloud/alchemydata-news/api/v1/
Various Input and Output possibilities
User can provide different inputs to the API like
– Start and End date.
– Subject we are interested in ( like name of a person, city etc )
– Sentiment – where we can specify to query for 'positive' or negative sentiments ( or both )
– Location of the key word we are searching for like is it in the Text /body or Title
– Taxonomy ( or different categories ) that we would like to query the data from . e.g: search for 'Trump' in the Govt and Politics section.
Please refer to http://www.ibm.com/watson/developercloud/alchemy-language/api/v1/ for more information on various parameters that can be fed to the API.