Nuget package for DBPedia Spotlight


I have developed a small .NET wrapper for DBPedia Spotlight in order to facilitate the consumption of their web service. Once you’ve downloaded the package in your solution, you can easily use it the following way:

  static void Main(string[] args)
            SpotlightRequestConfig cfg = new SpotlightRequestConfig(
                "Somme text", "");
        static void ShowCandidates(SpotlightRequestConfig cfg)
            SpotlightCandidateRequest req = new SpotlightCandidateRequest(cfg);
            SpotlightCandidateResponse resp = req.GetResponse();
            foreach (SurfaceForm resource in resp.annotation.surfaceForm)
                if (resource.resource != null)
                    foreach (SurfaceFormResource sr in resource.resource)
        static void ShowAnnotation(SpotlightRequestConfig cfg)
            SpotlightAnnotateRequest req = new SpotlightAnnotateRequest(cfg);
            SpotlightAnnotateResponse resp = req.GetResponse();
            if (resp.Resources != null)
                foreach (SpotlightResource resource in resp.Resources)
                    Console.WriteLine(resource.uri+" "+resource.types);

The wrapper handles the annotate REST operation which performs disambiguation and NER. It also handles the candidates REST operation to get a ranked list of candidates. The wrapper converts the returned JSON into .NET objects that are easily exploitable in a .NET application. You can optionally filter NER on types, supportability and confidence.

I’ve also created a Github repository that is available

Happy Coding

About Stephane Eyskens

Office 365, Azure PaaS and SharePoint platform expert
This entry was posted in Open Source and tagged , , , . Bookmark the permalink.

1 Response to Nuget package for DBPedia Spotlight

  1. Pingback: IBM Watson’s Conversation Service vs LUIS+Bot framework to build chatbots | Welcome to my blog! Stéphane Eyskens, Office 365 and Azure PaaS Architect

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s