|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article

Introduction
I first learned about Hugo Liu's research around three years ago when I was looking into NLP, commonsense data, artifical intelligence code and theory. His work, and others at MIT, is debatably the latest and greatest in today's research and very useful, at least informative, for any program designer. Most of the projects available from MIT are not written in Microsoft Visual Studio .Net and I am attempting to make use of ConceptNet for educational, research purposes, and just to have fun with the technology involved.
What is ConceptNet?
ConceptNet¹ is a commonsense knowledgebase, composed mainly from the Open Mind Project, written and put together by Hugo Liu and Push Singh (Media Laboratory Massachusetts Institute of Technology). ConceptNet 2.1 (current version at the time of this composition) also includes MontyLingua, a natural-language-processing package. ConceptNet is written in Python but it's commonsense knowledgebase is stored in text files. To read more specific details about the complete overview of ConceptNet, read Liu and Singh's outstanding paper (pdf).
What is so Unique about ConceptNet?
Unlike other projects like WordNet or Cyc, ConceptNet is based more on Context. ConceptNet makes it possible, within the limit's of it's knowledgebase, to allow a computer to understand new concepts or even unknown concepts by using conceptual correlations called Knowledge-Lines (K-Lines: a term introduced by Minsky, cf. The Society of Mind (1987)). K-Lines may be thought of a list of previous knowledge about a subject or task. ConceptNet actually puts these K-Lines together using it's twenty relationship types that fall into eight categories (including K-Lines)to form a network of data to simulate conceptual reasoning. What really makes all this possible is ConceptNet's Relational Ontology (the eight categories and twenty relationship types).
ConceptNet is structured around MIT's Open Mind Common Sense Project knowledge base. ConceptNet uses it's data in two processes: The Normalization Process and the Relaxation Process. The Normalization Process involves all the predicate to get filtered and undergo lexical distillation (Verbs and Nouns are reduced to their basic baseforms). Also ConceptNet removes determiners("a", "the", etc.) and modals("may", "could", "will", etc) in this stage. It also uses Parts Of Speech Tagging to validate well structured word orders. (The Normalization Process is not demonstrated in this demo. Please feel free to use your own POS Taggers with this Class Library) The Relaxation Process raises or "Lifts" heavily weighted common sense predicate nodes (one line from the predicate file(s)) and duplicate nodes are merged. This is reflected in each predicate's "f" and "i" metadata tags. Where f equals the number of utterances and i equals the number of of times inferred.
ConceptNet's Relational Ontology
ConceptNet's power of linking subjects together is attributed to twenty relationship types defined by it's Relational Ontology. Here is 2.1's twenty relationship types and eight categories:
 (Courtesy Hugo Liu and Push Singh, ConceptNet: A Practical Commonsense Reasoning Toolkit) |
• K-Lines: ConceptuallyRelatedTo, ThematicKLine, SuperThematicKLine
• Things: IsA, PartOf, PropertyOf, De.nedAs, MadeOf
• Spatial: LocationOf
• Events: SubeventOf, PrerequisiteEventOf, First-SubeventOf, LastSubeventOf
• Causal: EffectOf, DesirousEffectOf
• Affective: MotivationOf, DesireOf
• Functional: CapableOfReceivingAction, UsedFor
• Agents: CapableOf
Example lines from ConceptNet's 2.1 predicate files:
(UsedFor "ball" "throw" "f=4;i=0;")
(LocationOf "popcorn" "at movie" "f=7;i=0;")
(CapableOfReceivingAction "film" "place on reel" "f=2;i=0;")
(IsA "guitar" "musical instrument with string" "f=2;i=0;")
(SubeventOf "talk" "debate" "f=2;i=0;")
(CapableOf "person" "write book" "f=11;i=1;")
(MotivationOf "audition for part" "act in play" "f=2;i=0;")
(PropertyOf "bacteria" "small" "f=2;i=0;")
| Let's get started and get the fun rolling!
What is Needed and Where to download it...
Again, please remember that ConceptNet 2.1 is written in the Python programming language and not C# but it's commonsense knowledgebase data is in text file format totalling around 96mb when uncompressed. You must download the ConceptNet text files by agreeing to it's user agreement (this of course goes for all of the projects listed below for download) and then downloading the entire ConceptNet Python Project.
My VS.Net C# ConceptNet Class Library
This is a very simple No-Fills Class Library written in MS VS.Net. I have quickly thrown it together mostly because I just downloaded ConceptNet for the first time yesterday and noticed a shortage of VS.Net friendly code. For some reason, I don't remember there being a public download of ConceptNet before, which I may be mistaken, however I have known about this project for some time. It's papers have been available via MIT. There are two projects in the solution ConceptNet Demo App and ConceptNetUtils. ConceptNetUtils is the ConceptNet Class Library and consists of three Classes: FoundList, Misc, Search.
ConceptNetUtils.FoundList
Holds search result data in an index format.
Access: Public
Base Classes: Object
Members Description
protected string[] LineFound
static public int size = 999;
public string this[]
Count()
Reset()
public int get_f(int index)
public int get_i(int index)
|
ConceptNetUtils.Misc
Created for Misc Methods
Access: Public
Base Classes: Object
Members Description
public string RemoveCategoryString(string R_TYPE)
public string XMLGetNode(string path_xmlfilename,
string elementname)
public string XMLGetAttribute(string path_xmlfilename,
string elementname, string attributename)
|
ConceptNetUtils.Search
Takes care of Searching ConceptNet text files.
Access: Public
Base Classes: Object
Members Description
public bool CreateTextFile(string fullfilename)
public string GetFoundListLine(int index)
public int GetTotalLineCount()
public void SearchFor(string fullpathfilename,
string SubjectWord,
string R_Type,
int MAX_RESULTS,
bool CreateOutputFile,
string fullpathTextFilename)
public static string Predicatefile1;
public static string Predicatefile2;
public static string Predicatefile3;
public static string Predicatefile4;
public static string Predicatefile5;
public void SearchFor(int index,
string SubjectWord,
string R_Type,
int MAX_RESULTS,
bool CreateOutputFile,
string fullpathTextFilename)
public void XMLSearchForChecked(string path_xmlfilename,
string SubjectWord,
string R_Type,
int MAX_RESULTS,
bool CreateOutputFile,
string fullpathTextFilename)
public static string GetPredicatePathtoFilename(int index)
public void XMLLoadFilePaths(string settingsxmlfile)
public static int getnode_f(string node)
public static int getnode_i(string node)
public void Sort_f(ArrayList inList, out ArrayList rankedList)
public void Sort_i(ArrayList inList, out ArrayList rankedList)
public class Compare_f : IComparer
public class Compare_i : IComparer |
How to Run the Demo
1.) Make sure you have downloaded and installed ConceptNet 2.1. (I installed it into path ...\My Documents\Python Projects\conceptnet2.1\) 2.) Download and unzip this article's .Net Solution and project files. 3.) Navigate to the location "...\ConceptNet Demo App\bin\Release" and run the ConceptNet Demo App.exe. It will automaticly open the "Set Location of Knowledgebase Files" dialogbox and, on it's first run, you must click the browse button to a predicate file (ConceptNet or other) then click ok. Following runs will remember the location of checked predicate files you wish to search. 4.) You are now ready to a)Enter a word, b)Choose a relationship (ConceptNet looks at IsA, then PropertyOf), c)Click the Search button to display found nodes. You may then sort them by clicking the "Sort by f" or "Sort by i".
To Do- Automate the demo's process of locating the concept2.1 files.- Add combobox to choose which predicate files to search.- Add MSBNx COM (or some other BN) for creating, assessing, and evaluating Bayesian Networks, and to easily output to XML format. - Add more methods to the class library. - Create some more Lifting methods.
Conclusion
ConceptNet 2.1 can be a tool to create personalized commonsense knowledgebase networks. Hopefully this MS VS.Net Class Library project can be informational, useful, and fun.
New Version
The 0.x version posted on this article will no longer be under development. I am working on an updated version using Microsoft Visual C# Express 2005 with .Net 2.0 framework and will serve as the latest version of the ConceptNet Class Library in C# that I am working on. It will probably make use of the IronPython library. If you are interested, here is a small peek into getting ConceptNet Mini-Browser (written in Natural Python code) to execute using IronPython: My wdevs blog post with some code. I am just working on it whenever I have free time.
References
¹ Liu, H. & Singh, P. (2004) ConceptNet: A Practical Commonsense Reasoning Toolkit. BT Technology Journal, To Appear. Volume 22, forthcoming issue. Kluwer Academic Publishers. ConceptNet: A Practical Commonsense Reasoning Toolkit, Hugo Liu and Push Singh Media Laboratory Massachusetts Institute of Technology Investigating ConceptNet, Dustin Smith; Advisor: Stan Thomas, Ph.D. December 2004 Open Mind Common Sense Project Hugo Liu website WordNet Cyc
Updates1/3/06
- Added Method in Form1.cs to change the word to lowercase on leaving the textbox. Searches must be performed in lowercase.
- ConceptNetUtils.Search.SearchFor automatically changes incoming SubjectWord to lowercase.
- Fixed minor drawing problem with Combobox. (Please email me if you experience this bug.)
- Added To Do section.
- Uploaded ConceptNet Demo App version 0.01032006.2rc1 - Uploaded ConceptNetUtils binary version 0.01032006.2b1
1/9/06
- For the Demo, the loading of the predicate files are now xml stored and automated. They are no longer hardcoded. I added FileOptionsForm.cs to take care of this. I also added an ImageList.
- For the ConceptNetUtils Class Library, I added XML capability. The demo creates a Settings.xml file to hold the locations of the predicate files and now the class library can read xml files.
- Search.cs: Added SearchFor() overload, XMLSearchForChecked(), GetPredicatePathtoFilename(), XMLLoadFilePaths().
- Misc.cs: Added XMLGetNode(), XMLGetAttribute()
- Uploaded ConceptNet Demo App version 0.01092006.0rc2 - Uploaded ConceptNetUtils binary version 0.01092006.0b2
1/14/06
- Added some details about ConceptNet's Normalization and Relaxation Processes in the "What is so Unique about ConceptNet?" section.
- For the Demo, I added two new buttons "Sort by f" and "Sort by i", this demonstrates "The Relaxation Process" of the ConceptNet project.
- For the ConceptNetUtils Class Library, I added some methods needed to accomplish the "The Relaxation Process" of ConceptNet. I also fixed some problems when it had to search more than one predicate file.
- Search.cs: Added getnode_f(), getnode_i(), Sort_f(), Sort_i(). Two IComparer Classes were also added to assist with the sorting/Lifting of the knowledge, Compare_f : IComparer, Compare_i : IComparer.
- FoundList.cs: Added get_f(), get_i().
- Notified MIT's ConceptNet team of this article via email.
- Emptied \doc folder with VS generated documentation from project.
- Uploaded ConceptNet Demo App version 0.01142006.0rc4 - Uploaded ConceptNetUtils binary version 0.01142006.0b3
1/15/06
- Edited Introduction section.
- Edited Search.cs XMLSearchForChecked method documentation.
- Modified ConceptNetUtils.Search.SearchFor() to only return word only results. For example, a search for "eat" was also returning "theater" etc.
- Uploaded ConceptNet Demo App version 0.01152006.0rc5 (build 2206.41738) - Uploaded ConceptNetUtils binary version 0.01152006.0b4 (build 2206.41736)
1/16/06
- Edited the "How to Run the Demo" section to reflect the new version of the demo and class library.
2/22/06
- Edited the link to IronPython-1.0-Beta3 in the "What is Needed and Where to download it..." section (was Beta 1).
- Added "New Version" section. 0.x is no longer under development and a new ConceptNetUtils class library (that is .Net 2.0 / IronPython based) is being developed.
| You must Sign In to use this message board. |
|
| | Msgs 1 to 24 of 24 (Total in Forum: 24) (Refresh) | FirstPrevNext |
|
|
 |
|
|
Could you please tell me how to run this demo project? I downloaded all what you mentioned and executed ConceptNet Demo App.exe. But didn't work. There was an application error. I don't know what's wrong
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
zin_zin wrote: Could you please tell me how to run this demo project? I downloaded all what you mentioned and executed ConceptNet Demo App.exe. But didn't work. There was an application error. I don't know what's wrong
It sounds like you may not have Browsed to the correct location of ConceptNet's text files. In the article's section "How to Run the Demo" it states that on your first running the Release build, you should be prompted to browse to the files. "It will automaticly open the "Set Location of Knowledgebase Files" dialogbox and, on it's first run, you must click the browse button to a predicate file (ConceptNet or other) then click ok. Following runs will remember the location of checked predicate files you wish to search."
Also, perhaps you only choose one file, in which case, you need to uncheck the rest in the "Set Location of Knowledgebase Files" dialogbox.
I downloaded this article's src file and it ran ok for me after browsing to the files (which sets the paths for the exe).
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for replying! Still didn't work. I can't even open ConceptNet Demo App. There was an error saying "Application cannot be initialized"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
zin_zin wrote: Still didn't work. I can't even open ConceptNet Demo App. There was an error saying "Application cannot be initialized"
I can not duplicate this error on my system. Perhaps you don't have .NET installed or you are on a different Operating System?
Have you tried the newer library's demo? http://www.codeproject.com/useritems/cnu2.asp[^]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Dear JowSwammi,
I am glad to have C# version of ConceptNet. It's a very useful resource and now available for those who don't know Python! Thanks.
I've downloaded the code and am in the process of creating simplified library file which I'll include in my project (which builds a context around a word). I need to understand the dependancies of the project with other _dll's or projects. Can you please spare few minutes to guide me through? If I want to create my own .dll file for finding only "IsA" relationships, what other resources should my project include?
Awaiting your reply, Thanks in advance, Mansi.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Mansi,
I have posted an updated version of this library. http://www.codeproject.com/useritems/cnu2.asp[^] http://www.codeproject.com/useritems/cnu2/conceptnetutils2_dll.zip[^]
It is very easy to retrieve the context for a word using ConceptNetUtils2.dll. Everything you need is explained in the CNU2 article. Explore the demo, and remember to follow "How to Run the Demo" section for everything that is needed.
One way to achieve getting the context for a word would be:
using IronPython.Runtime; using ConceptNetUtils;
private void Form1_Load(object sender, EventArgs e) { //Display the form this.Show(); this.Update();
//Must set & override the paths to ConceptNet install. //They are found in CNUDB and CNUMontylingua.py ConceptNetUtils.CNDB.ConceptNet21path = ConceptNetUtils.Paths.MiscDirs.ConceptNet; //Load predicate files and create semantic network ConceptNetUtils.CNDB.Initialize(); }
private void Method1() { IronPython.Runtime.List myList = new IronPython.Runtime.List(); myList = ConceptNetUtils.CNDB.get_context("apple"); }
All of the results are stored in the IronPython.Runtime.List myList. Hope that helps you.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Thanks Joe, I am really happy to see the functionalities close to those of conceptnet2.1. It's now very straight forward to find the context of a word. I got OutOfMemory exception for Projection though, on my 1 GB RAM. I'll shoot more questions if I come across any difficulty. Thanks again, keep the good work up!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
hi there...just wondering whether you've tried to use ConceptNetXMLRPCServer.py in order to access ConceptNet from .NET platform. I am using XML-RPC.NET as the client. I have no problems accessing some of the "easier" methods like chunk(text), but i dont seem to be able to access methods like get_analogous_concepts(textnode, simple_results_p=0). I am not sure what the parameter and result type should be in c#. Do you think you can help me with this? thanks kos
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
kzachos wrote: just wondering whether you've tried to use ConceptNetXMLRPCServer.py in order to access ConceptNet from .NET platform.
I have not had enough spare time to explore this way of using ConceptNet with .NET. I have ran the ConceptNet server service before but not to any depth.
kzachos wrote: I am using XML-RPC.NET as the client. I have no problems accessing some of the "easier" methods like chunk(text), but i dont seem to be able to access methods like get_analogous_concepts(textnode, simple_results_p=0).
I have no previous experience using XML-RPC.NET so I may not be of great help, but I do have an understanding of ConceptNet. The first thing that ConceptNet does is create the semantic map of the predicated files. I am not sure, mostly because I can't remember, if the server service does this or not. If it doesn't you need to call methods like load_predicates_file(self,filename) before calling get_analogous_concepts().
kzachos wrote: I am not sure what the parameter and result type should be in c#.
If I remember correctly for get_analogous_concepts(textnode, simple_results_p=0) textnode is the text value of what is written in the ConceptNet GUI demo mini-browser and simple_results_p is set to 0 if no incoming arg is set.
Remember that Python objects are insanely different that .Net objects. I have come to the conclusion the my next C# library of ConceptNet will certainly be tied into IronPython. You may need to reference IronPython in your XML-RPC.NET.
Anyway, the result type of scored_candidates is an instance of a builtin python list. This is why it will probably be easier if you use IronPython with your project.
Interesting stuff. I'd like to see any of your code in email or in an article when you wish to share. Hope that help you.
Later, JoeSox "Football is a game of cliches, and I believe in every one of them." -Vincent Lombardi CPMCv1.0 ↔ humanaiproject.org ↔ Last.fm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for your quick reply. I am happy to publish some code once i get this up and running What you mentioned with regards to IronPython sounds interesting. Have you tried to call methods like get_analogous_concepts using IronPython? if yes, i would be very interested to know how you did it kos
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
kzachos wrote: Have you tried to call methods like get_analogous_concepts using IronPython?
Yes. I have a project in development. I want to post another codeproject article but I haven't had enough time to finish it. Between university, work, family, and my Navy Reserve time it is tough.
I've basicly been modifying ConceptNet .py files to be used with IronPython. The major hurdle is the speed time of IronPython. In the speed tests that I have conducted Python is still three times faster loading the predicate files [creating the semantic map].
Later, JoeSox "Football is a game of cliches, and I believe in every one of them." -Vincent Lombardi CPMCv1.0 ↔ humanaiproject.org ↔ Last.fm
-- modified at 13:42 Thursday 22nd June, 2006
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
shrik`st wrote: what about making a web service out of it?
That's a great idea. I haven't used ASP.NET but if it is kept as a C# based library then people interested can do whatever they wish with it. I would love to see other projects using ConceptNet or similar designs. I only can alot a certain amount of time to this library project. Stepping though the Python code and learning how IronPython works is a slow process for me but very interesting. Right now I am trying to figure out how and if I can get Tkinker[^] to work with IronPython. If not then I will start to develop code from there.
Later, JoeSox "Football is a game of cliches, and I believe in every one of them." -Vincent Lombardi CPMCv1.0 ↔ humanaiproject.org ↔ Last.fm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Maybe i'm just slow, but what does this do? I'm actually looking for a good NLP engine, but nothing in this article screams NLP to me.
Can you give more information on its uses?
John Conwell
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
jconwell wrote: Maybe i'm just slow, but what does this do?
It is more of a resource than an application.
jconwell wrote: I'm actually looking for a good NLP engine, but nothing in this article screams NLP to me.
ConceptNet is not an NLP engine. I have some contacts at Cogilex http://www.cogilex.com/quicktag.htm[^] and use their Quicktag for NLP parsing.
ConceptNet knowledge is a semantic network that encompasses the spatial, physical, social, temporal, and psychological aspects of everyday life. For example, it may be used, as ConceptNet's developers have described, topic-jisting. Topic-jisting for perhaps a search engine so when the search results are displayed they stay with in the concept, thus providing more relevant results or new words or concepts that the user would not have thought of before.
Later, JoeSox "If you always do what interests you, at least one person is pleased."- Katharine Hepburn CPMCv1.0 ↔ humanaiproject.org ↔ Last.fm
-- modified at 12:33 Tuesday 10th January, 2006
|
| Sign In·View Thread·PermaLink | 3.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
computerguru92382 wrote: Neat article. Found it very interest
Thanks. If everything goes right, it may get even better. ConceptNet can be used for a lot of useful applications and can be easily customizable. It looks as though the Iron Python needs .Net 2.0 which I am having trouble installing, so I am curious as to how that works in relation to ConceptNet.
Later, JoeSox "If you always do what interests you, at least one person is pleased."- Katharine Hepburn CPMCv1.0 ↔ humanaiproject.org ↔ Last.fm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
There is lots of information on the internet that can explain in more detail then I can here. Please take a look at some of the following...
http://graphics.csie.ntu.edu.tw/~edwards/2005/01/beyond-textual-concepts-commonsense-in.html[^]
"A cell phone that, although silenced, would know to ring if your mother were to call from the hospital. A search engine that, when you entered “a gift for my baby brother,”would displays a list of children’stoys. A personal digital assistantthat would know to cancel a hiking trip with a friend who had broken their leg.A camerathat knew, on its own, to take a photo of your sister crossing the finish line at a marathon. Push Singh 2/22 MIT Media Lab Commonsense-based Applications-People who are badly hurt may go to the hospital.-We want those we care about to be healthy.-A gift should be something the recipient would like.-Children like to play with toys.-Hiking can be a relaxing activity.-People with broken legs have difficulty walking.-Cameras are for recording events people find significant.-Crossing the finish line is an significant event." http://ocw.mit.edu/NR/rdonlyres/Media-Arts-and-Sciences/MAS-961Spring-2005/1C56D87B-931E-4879-8C8B-6A4137F8AB98/0/week4_push_singh.pdf[^]
[I am also writing a second article to complement this one, hopefully that may be more insightful]
Later, JoeSox "If you always do what interests you, at least one person is pleased."- Katharine Hepburn CPMCv1.0 ↔ | | | | | |