A Quick Peek at Three Content Analysis Services
A long, long time ago, I tinkered with a hack called Serendipitwitterous (long since rotted, I suspect), that would look through a Twitter stream (personal feed, or hashtagged tweets), use the Yahoo term extraction service to try to identify concepts or key words/phrases in each tweet, and then use these as a search term on Slideshare, Youtube and so on to find content that may or may not be loosely related to each tweet.
The Yahoo Term Extraction is still hanging in there – just – but I think it finally gets deprecated early next year. From my feeds today, however, it seems there may be a replacement in the form of a new content analysis service via YQL – Yahoo! Opens Content Analysis Technology to all Developers:
[The Y! COntent Analysis service will] extract key terms from the content, and, more importantly, rank them based on their overall importance to the content. The output you receive contains the keywords and their ranks along with other actionable metadata.
On top of entity extraction and ranking, developers need to know whether key terms correspond to objects with existing rich metadata. Having this entity/object connection allows for the creation of highly engaging user experiences. The Y! Content Analysis output provides related Wikipedia IDs for key terms when they can be confidently identified. This enables interoperability with linked data on the semantic Web.
What this means is that you can push a content feed through the service, and get an annotated version out that includes identifier based hooks into other domains (i.e. little-l, little-d linked data). You can find the documentation here: Content Analysis Documentation for Yahoo! Search
So how does it fare? As I’ve previously explored using the Reuters Open Calais service to annotate OU/BBC programme listings (e.g. Augmenting OU/BBC Co-Pro Programme Data With Semantic Tags), I thought I’d use a programme feed from The Bottom Line again…
To start, we need to open the YQL developer console: http://developer.yahoo.com/yql/console/
We can then pull in an example programme description from the BBC using a YQL query of the form:
select long_synopsis from xml where url='http://www.bbc.co.uk/programmes/b00vy3l1.xml'
For reference, the text looks like this:
The view from the top of business. Presented by Evan Davis, The Bottom Line cuts through confusion, statistics and spin to present a clearer view of the business world, through discussion with people running leading and emerging companies.
In the week that Facebook launched its own new messaging service, Evan and his panel of top business guests discuss the role of email at work, amid the many different ways of messaging and communicating.
And location, location, location. It’s a cliche that location can make or break a business, but how true is it really? And what are the advantages of being next door to the competition?
Evan is joined in the studio by Chris Grigg, chief executive of property company British Land; Andrew Horton, chief executive of insurance company Beazley; Raghav Bahl, founder of Indian television news group Network 18.
Producer: Ben Crighton
Last in the series. The Bottom Line returns in January 2011.
The content analysis query example provided looks like this:
select * from contentanalysis.analyze where text="Italian sculptors and painters of the renaissance favored the Virgin Mary for inspiration"
but we can nest queries in order to pass the long_synposis from the BBC programme feed through the service:
select * from contentanalysis.analyze where text in (select long_synopsis from xml where url='http://www.bbc.co.uk/programmes/b00vy3l1.xml')
<?xml version="1.0" encoding="UTF-8"?> <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="2" yahoo:created="2011-12-22T11:03:51Z" yahoo:lang="en-US"> <diagnostics> <publiclyCallable>true</publiclyCallable> <url execution-start-time="2" execution-stop-time="370" execution-time="368" proxy="DEFAULT"><![CDATA[http://www.bbc.co.uk/programmes/b00vy3l1.xml]]></url> <user-time>572</user-time> <service-time>565</service-time> <build-version>24402</build-version> </diagnostics> <results> <categories xmlns="urn:yahoo:cap"> <yct_categories> <yct_category score="0.536">Business & Economy</yct_category> <yct_category score="0.421652">Finance</yct_category> <yct_category score="0.418182">Finance/Investment & Company Information</yct_category> </yct_categories> </categories> <entities xmlns="urn:yahoo:cap"> <entity score="0.979564"> <text end="57" endchar="57" start="48" startchar="48">Evan Davis</text> <wiki_url>http://en.wikipedia.com/wiki/Evan_Davis</wiki_url> <types> <type region="us">/person</type> <type region="us">/place/place_of_interest</type> <type region="us">/place/us/town</type> </types> <related_entities> <wikipedia> <wiki_url>http://en.wikipedia.com/wiki/Don%27t_Tell_Mama</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Lenny_Dykstra</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Los_Angeles_Police_Department</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Today_%28BBC_Radio_4%29</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Chrisman,_Illinois</wiki_url> </wikipedia> </related_entities> </entity> <entity score="0.734099"> <text end="265" endchar="265" start="258" startchar="258">Facebook</text> <wiki_url>http://en.wikipedia.com/wiki/Facebook</wiki_url> <types> <type region="us">/organization</type> <type region="us">/organization/domain</type> </types> <related_entities> <wikipedia> <wiki_url>http://en.wikipedia.com/wiki/Mark_Zuckerberg</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Social_network_service</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Twitter</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Social_network</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Digital_Sky_Technologies</wiki_url> </wikipedia> </related_entities> </entity> <entity score="0.674621"> <text end="477" endchar="477" start="450" startchar="450">location, location, location</text> </entity> <entity score="0.651227"> <text end="79" endchar="79" start="60" startchar="60">The Bottom Line cuts</text> <types> <type region="us">/other/movie/movie_name</type> </types> </entity> <entity score="0.646818"> <text end="799" endchar="799" start="789" startchar="789">Raghav Bahl</text> <wiki_url>http://en.wikipedia.com/wiki/Raghav_Bahl</wiki_url> <types> <type region="us">/person</type> </types> <related_entities> <wikipedia> <wiki_url>http://en.wikipedia.com/wiki/Network_18</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Superpower</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Deng_Xiaoping</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/The_Amazing_Race</wiki_url> <wiki_url>http://en.wikipedia.com/wiki/Hare</wiki_url> </wikipedia> </related_entities> </entity> <entity score="0.644349"> <text end="144" endchar="144" start="133" startchar="133">clearer view</text> </entity> <entity score="0.54609"> <text end="675" endchar="675" start="665" startchar="665">Chris Grigg</text> <types> <type region="us">/person</type> </types> </entity> </entities> </results> </query>
So, some success in pulling out person names, and limited success on company names. The subject categories look reasonably appropriate too.
[UPDATE: I should have run the desc contentanalysis.analyze query before publishing this post to pull up the docs/examples… As well as the where text= argument, there is a where url= argument that will pul back semantic information about a URL. Running the query over the OU homepage, for example, using select * from contentanalysis.analyze where url=”http://www.open.ac.uk” identifies the OU as an organisation, with links out to Wikipedia, as well as geo-information and a Yahoo woe_id.]
Here’s how it copes with the same programme synposis:
Pretty good… and links in to dbpedia (better for machine readability) compared to the Wikipedia links that the Yahoo service offers.
For completeness, here’s what the Reuters Open Calais service comes up with:
The best of the bunch on this sample of one, I think, albeit admittedly in the domain the Reuters focus on?
But so what…? What are these services good for? Automatic metadata generation/extraction is one thing, as I’ve demonstrated in Visualising OU Academic Participation with the BBC’s “In Our Time”, where I generated a quick visualisation that showed the sorts of topics that OU academics had talked about as guests on Melvyn Bragg’s In Our Time, along with the topics that other universities had been engaged with on that programme.