Alchemy API Integration

Posted in API Tagged , ,

Alchemy API is used to analyze content of URLs which are targeted for ads. It returns certain keywords that are relevant to the specified URL. For each keyword a relevance parameter and a sentiment score is returned.

Data is requested in XML format, via a CURL call to their API. The obtained response is processed as per the analysis algorithm. The entire functionality runs in background. Alchemy has limit of 1000 API calls within a 24 hour period. The limit is tracked and URLs are not reprocessed multiple times if they have been recently processed.

XML output from Alchemy API is in the below format.

<results>
<status>REQUEST_STATUS</status>
<url>REQUESTED_URL</url>
<language>DOCUMENT_LANGUAGE</language>
<text>DOCUMENT_TEXT</text>
<keywords>
<keyword>
<text>DETECTED_KEYWORD</text>
<relevance>DETECTED_RELEVANCE</relevance>
<sentiment>
<type>SENTIMENT_LABEL</type>
<score>SENTIMENT_SCORE</score>
</sentiment>
</keyword>
</keywords>
</results>

OpenAmplify API

Posted in API Tagged , ,

Open Amplify is used for analyzing the content of targeted URLs.

Top topics and results are analyzed using polarity output from the API. Using specific algorithm, weight is assigned for the each result. Positive, Negative and Neutral mean polarity values are taken into consideration for analysis.

The analysis output is used by adserver for targeting ads for specific keywords.

XML API respsonse is as below:

<ns1:AmplifyResponse xmlns:ns1=”http://amplify.hapax.com”>
<AmplifyReturn>
<Topics>
<Domains>
<DomainResult>
<Domain>
<Name>Sports</Name>
<Value>10.000000</Value>
</Domain>
<Subdomains>
<DomainResult>
<Domain>
<Name>Baseball</Name>
<Value>10.000000</Value>
</Domain>
<Subdomains>
<DomainResult>
<Domain>
<Name>baseball</Name>
<Value>10.000000</Value>
</Domain>
<Subdomains xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:nil=”1″/>
</DomainResult>
</Subdomains>
</DomainResult>
</Subdomains>
</DomainResult>
</Domains>
<TopTopics>
<TopicResult>
<Topic>
<Name>baseball</Name>
<Value>10.000000</Value>
</Topic>
<NamedEntityTypexmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:nil=”1″/>
<Polarity>
<Min>
<Name>Neutral</Name>
<Value>0.000000</Value>
</Min>
<Mean>
<Name>Positive</Name>
<Value>0.600000</Value>
</Mean>
<Max>
<Name>Positive</Name>
<Value>0.600000</Value>
</Max>
</Polarity>
</TopicResult>
.
.
.
</AmplifyReturn>
</ns1:AmplifyResponse>

Yahoo Content Analysis API

Posted in API Tagged , , ,

Pretargeting requires analyzing the list of URLs to find the most relevant keyword for a URL. Yahoo Content Analysis is one of the APIs used for analysis.

Keyword is extracted from Yahoo API, and the corresponding weightage (score) for that keyword is analysed. In the API, enable_categorizer is set, to find the category of the URL, with the relevant score.

Below is the sample XML output, extracted and processed:

<?xmlversion=”1.0″encoding=”UTF-8″?>
<queryxmlns:yahoo=”http://www.yahooapis.com/v1/base.rng”
yahoo:count=”2″yahoo:created=”2012-03-11T15:30:34Z”yahoo:lang=”en-US”>
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<user-time>116</user-time>
<service-time>90</service-time>
<build-version>25587</build-version>
</diagnostics>
<results>
<yctCategoriesxmlns=”urn:yahoo:cap”>
<yctCategoryscore=”0.999337″>Politics &amp; Government</yctCategory>
<yctCategoryscore=”0.721854″>Government</yctCategory>
</yctCategories>
<entitiesxmlns=”urn:yahoo:cap”>
<entityscore=”0.993251″>
<textend=”6656″endchar=”6656″start=”6642″startchar=”6642″>Lucas Papademos</text>
<wiki_url>http://en.wikipedia.com/wiki/Lucas_Papademos</wiki_url>
<related_entities>
<wikipedia>
<wiki_url>http://en.wikipedia.com/wiki/George_Papandreou</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Debt_restructuring</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/European_Central_Bank</wiki_url>
</wikipedia>
</related_entities>
</entity>
<entityscore=”0.938968″>
<textend=”2735″endchar=”2735″start=”2720″startchar=”2720″>unity government</text>
</entity>
<entityscore=”0.927013″>
<textend=”2707″endchar=”2707″start=”2699″startchar=”2699″>Papademos</text>
<types>
<typeregion=”us”>/person</type>
</types>
</entity>
<entityscore=”0.914795″>
<textend=”7148″endchar=”7148″start=”7128″startchar=”7128″>European Central Bank</text>
<wiki_url>http://en.wikipedia.com/wiki/European_Central_Bank</wiki_url>
<types>
<typeregion=”us”>/organization</type>
<typeregion=”us”>/organization/company/other</type>
</types>
<related_entities>
<wikipedia>
<wiki_url>http://en.wikipedia.com/wiki/Jean-Claude_Trichet</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Eurozone</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Axel_Weber</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Euro</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Currency_sign</wiki_url>
</wikipedia>
</related_entities>
</entity>
<entityscore=”0.843647″>
<textend=”10362″endchar=”10362″start=”10338″startchar=”10338″>national unity government</text>
<wiki_url>http://en.wikipedia.com/wiki/Zimbabwe_Government_of_National_Unity_of_2009</wiki_url>
</entity>
<entityscore=”0.794965″>
<textend=”7461″endchar=”7461″start=”7452″startchar=”7452″>government</text>
</entity>
<entityscore=”0.748128″>
<textend=”11218″endchar=”11218″start=”11187″startchar=”11187″>Prime Minister George Papandreou</text>
</entity>
<entityscore=”0.680339″>
<textend=”7417″endchar=”7417″start=”7399″startchar=”7399″>Evangelos Venizelos</text>
<wiki_url>http://en.wikipedia.com/wiki/Evangelos_Venizelos</wiki_url>
<types>
<typeregion=”us”>/person</type>
</types>
<related_entities>
<wikipedia>
<wiki_url>http://en.wikipedia.com/wiki/Dimitrios_Droutsas</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Virginia_Mayo</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/United_States_Secretary_of_Defense</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Greek_language</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/ThyssenKrupp</wiki_url>
</wikipedia>
</related_entities>
</entity>
<entityscore=”0.648517″>
<textend=”10053″endchar=”10053″start=”10036″startchar=”10036″>austerity measures</text>
</entity>
<entityscore=”0.613155″>
<textend=”6001″endchar=”6001″start=”5994″startchar=”5994″>CNN Wire</text>
<types>
<typeregion=”us”>/organization</type>
</types>
</entity>
<entityscore=”0.609287″>
<textend=”7061″endchar=”7061″start=”7043″startchar=”7043″>financial stability</text>
</entity>
<entityscore=”0.609287″>
<textend=”11102″endchar=”11102″start=”11084″startchar=”11084″>financial stability</text>
</entity>
<entityscore=”0.593508″>
<textend=”9820″endchar=”9820″start=”9805″startchar=”9805″>Greek Parliament</text>
<types>
<typeregion=”us”>/organization</type>
</types>
</entity>
<entityscore=”0.590604″>
<textend=”9701″endchar=”9701″start=”9681″startchar=”9681″>DimitrisAvramopoulos</text>
<wiki_url>http://en.wikipedia.com/wiki/Dimitris_Avramopoulos</wiki_url>
<types>
<typeregion=”us”>/person</type>
</types>
</entity>
</entities>
</results>
</query>