(Note: cnapinet.dll has Newtonsoft.Json.dll dependency for json handling.)
ConceptNet¹ is a commonsense knowledgebase, composed mainly from the Open Mind Project, written and maintained by Massachusetts Institute of Technology (MIT).
ConceptNet 4 (current version at the time of this composition) is natively written in Python.
ConceptNet, for example, could be useful in an application to link certain ideas together for organizational purposes. My selfish reason for developing this library is because I can quickly throw my coding ideas in C# and I didn't see anyone develop a .NET library for
ConceptNet API yet. Also, I haven't really used
ConceptNet since version 2.1 so I decided to spend some time and hammer something out.
The .NET C# ConceptNet API Class Library (cnapinet)
cnapinet can provide an interface to ConceptNet REST API. It is based on the Python client API rest_client.py. Use the API to receive back Lists and objects of a
The demo app has two sections: Relationship/Text and the Output box. To make it easy, I listed all of the possible Relational Ontologies in the dropdown box [
HasSubevent, etc.]. I also kept the domain grouping found in the previous version of
ConceptNet. Next to the dropdown box, there is a textbox to place a word or phrase. Lastly, clicking the 'lookup' button will run through the several API calls and display the objects returned.
- Add cnapinet.dll to your project 'References' via Solution Explorer. (For cnapinet.dll v1.3.x.x, make sure that Newtonsoft.Json.dll resides in the same folder as cnapinet.dll) .
- Add '
using cnapinet;', etc. to your source code to use the namespace.
- Create the main API engine with '
ConceptNetAPI CNClient = new ConceptNetAPI();', etc.
- Below are the methods in
I didn't see any .NET libraries for the ConceptNet REST API so I decided to create one based on the Python client API rest_client.py. I plan to use it with some applications I have in mind to help group information together in a meaningful way instead of alphabetical or chronological. Some of my previous articles with older versions were more embedded with Python and IronPython; with
ConceptNet still being in active development (soon version 5 will be released), it is becoming easier to access its data.
- The ConceptNet Web API, Massachusetts Institute of Technology [^]
- Newtonsoft.Json.dll, Json.NET Copyright (c) 2007 James Newton-King [^]
- Open Mind Common Sense Project [^]
CNAPINetDemo v220.127.116.11 Microsoft Visual C# Express 2010 project files
- Uploaded cnapinet.dll v18.104.22.168 and necessary files