Calais.NET - generating metadata using the Calais web service

by chris.fulstow 3/11/2008 2:47:00 PM

Calais.NET is a .NET 3.5 project that provides a friendly API to the Calais web service.

What is Calais?

Here's the official description of the service from the opencalais.com website:

The Calais web service automatically attaches rich semantic metadata to the content you submit – in well under a second. Using natural language processing, machine learning and other methods, Calais categorizes and links your document with entities (people, places, organizations, etc.), facts (person ‘x’ works for company ‘y’), and events (person ‘z’ was appointed chairman of company ‘y’ on date ‘x’).

So, in short, Calais extracts metadata from content you supply.  It takes input as HTML, XML or plain text, then tries to identify various types of metadata, such as companies, people, countries and quotations.  For a full list of supported metadata types, see Calais Semantic Metadata.

A good demo of the the service is the Calais Document Viewer Java application from the OpenCalais website.  Simply paste in some content, click 'Submit', and your original content will be returned with highlighted metadata.

The goal of Calais.NET is to provide the kind of functionality to .NET applications.

How to use Calais in your .NET project

The Calais.NET API wrapper makes Calais very simple to use from .NET.  It exposes a straightforward .NET interface that abstracts away web service details like complex XML input parameters and verbose RDF output data by processing the data with LINQ to XML.

Calais.NET code example

string content = (new WebClient()).DownloadString("http://news.bbc.co.uk/");
 
CalaisDotNet calais = new CalaisDotNet(ApiKey, CalaisContentType.Html, content);
calais.Call();
 
IEnumerable<string> entities = calais.ExtractMetadata(CalaisMetadata.Country);
foreach (string entity in entities)
{
    Console.WriteLine(entity);
}

Example output

Venezuela
Malta
United States
Canada
Sudan
Tibet
Spain
Serbia
China
Mozambique
United Kingdom
Sri Lanka 

Download

Download Calais.NET from Codeplex and give it a try.  C# .NET 3.5 source code included.

Related posts

Comments

3/14/2008 1:13:15 AM

Tom Tague

Chris:

Sweet! I love it when people take the effort to build tools that make Calais more accessible. Thanks for making the effort!

We'll be updating our gallery and creating a fresh blog entry highlighting what people are building with Calais - this will absolutely be near the top of the list.

Thanks,

Tom Tague

Tom Tague us

5/20/2008 12:54:29 AM

Andre

Thanks, didn´t heard about Calais before. Sounds interesting.

Andre de

9/23/2008 1:40:39 AM

Tim

trying to run your demo app I consistently get a "The request failed with HTTP status 403: Forbidden." whenever I hit the line

string responseRdf =
this._webServiceProxy.Enlighten(.....

Any ideas would be greatly appreciated

Tim gb

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

11/21/2008 12:56:09 AM

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen

About the author

Name of author Chris Fulstow
ASP.NET Contractor, Sydney

E-mail me Send mail

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Pages

    Recent comments

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in