The Find Related Concepts API from IDOL OnDemand returns the most relevant terms and concepts from related documents. Here's represented as a D3 Bubble Chart. Thanks to incredibly good work by Mike Bostock. For a description of the API go here https://www.idolondemand.com/developer/apis/findrelatedconcepts#overview
For D3 Data-Driven Documents go here: http://d3js.org
<script src="http://d3js.org/d3.v3.min.js"></script>
<b>Code example - IDOL OnDemand Find Related Concepts in the News.</b><br>
<br>
To see those concepts in the news (in index news_eng) that most relate to the Guardian article below, press the Find Related Concepts button.<br>
<br>
<input type="button" value="Find Related Concepts in the News" id="button1">
<div id="output"></div>
<input type="button" value="Create Bubble Chart" id="button2" style="visibility:hidden;"><div id="output2"></div>
<div id="chart"></div>
<div id="output3"></div>
<br>
<br>
<h2>Text from Guardian article:</h2>
<br>
<div><pre id="guardian_text">
The Guardian home
Computer simulating 13-year-old boy becomes first to pass Turing test<br>
'Eugene Goostman' fools 33% of interrogators into thinking it is human, in what is seen as a milestone in artificial intelligence
- In 'his own' words: how Eugene fooled the Turing judges
- What is the Turing test? And are we all doomed now?
Press Association
theguardian.com, Monday 9 June 2014 07.09 EDT
turing test
Codebreaker Alan Turing devised a test in 1950, saying that if a machine was indistinguishable from a human, then it was 'thinking'. Photograph: Sherborne School/AFP/Getty Images
A "super computer" has duped humans into thinking it was a 13-year-old boy to become the first machine to pass the Turing test, experts have said. Five machines were tested at the Royal Society in central London to see if they could fool people into thinking they were humans during text-based conversations.
The test was devised in 1950 by computer science pioneer and second world war codebreaker Alan Turing, who said that if a machine was indistinguishable from a human, then it was "thinking".
No computer had ever previously passed the Turing test, which requires 30% of human interrogators to be duped during a series of five-minute keyboard conversations, organisers from the University of Reading said.
But "Eugene Goostman", a computer programme...
var iod_apikey = "your-apikey-here";// get an apikey from IDOL OnDemand
var iod_findrelatedconcepts_url = "https://api.idolondemand.com/1/api/sync/findrelatedconcepts/v1";
// Note this is the article, but the webUrl has a lot of 'noise' from advertisements, links, menus, etc, so this test takes the clean text of the article instead of the guardian_webUrl.
var guardian_webUrl = "http://www.theguardian.com/technology/2014/jun/09/what-is-the-alan-turing-test";
var findRelatedConceptsForURL = guardian_webUrl;
var out = document.getElementById("output");
$('#button1').click( function() {
fnFindRelatedConcepts();
});
function fnFindRelatedConcepts(){
xhr = new XMLHttpRequest();
xhr.open('POST', iod_findrelatedconcepts_url, true);
var fd = new FormData();
fd.append("apikey", iod_apikey);
var guardian_text = document.getElementById('guardian_text');
// Note the URL option contains a lot of noise currently
//fd.append("url", findRelatedConceptsForURL);
fd.append("text", guardian_text.innerHTML);
// only search in English news sources
// To see which newssites are used go here:
// https://www.idolondemand.com/developer/docs/PublicDatasets.html
fd.append("indexes", "news_eng");
// return only news articles younger than 2014-01-01
fd.append("min_date", "2014-01-01");
xhr.onreadystatechange = function(){
out.innerHTML = "onreadystatechange...";
var r = fnReady();
};
xhr.onload = function(){ };
out.innerHTML = "Waiting for response...<br><br>";
xhr.send(fd);
}
function fnReady() {
if (xhr.readyState === 4)
{
out.innerHTML += "<br>status: "+xhr.status+": "+xhr.statusText+"<br>";
var r = xhr.responseText;
if(r){
//out.innerHTML += "responseText:<br>"+r+"<br><br>";
json = JSON.parse(r);
var entities = json.entities;
if(entities){
var relatedConcepts = "";
$(entities).each(function(i) {
var txt =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.