commonsense / conceptnet5

Code for building ConceptNet from raw data.
Other
2.78k stars 355 forks source link

How can I establish a concept path ? #15

Closed zegildo closed 12 years ago

zegildo commented 12 years ago

Hi guys, I would like to know how can I do to establish each path of a concept until the most generic concept that graph has. Example: to "/c/en/jaguar" : IsA automobile, IsA organization, IsA automobile_machine, IsA product... I need something like this - first path - [automobile_machine-> autombile ->product...]. I am currently build this path through analysing all "IsA" relations by means of backtracking algorithm which is too expensive. Is this correct? Please, can you indicate me another more simple way ?

Thank you so much guys :)

rspeer commented 12 years ago

If you want to perform the transitive closure of the IsA relation, yes, it is going to be a bit of an expensive operation. You can save some computation time by memoizing where you've already been.

I recommend downloading the data (not making repeated API queries) and building a directed graph of IsA statements, then searching it breadth first instead of backtracking.

Keep in mind that you'll want to be skeptical of results that require too long of a chain of IsA relations, because IsA relations are not logically consistent and they are going to become incoherent very quickly. (Even Cyc, with all its hand-tuned precision, has to break up logical deductions into different "microtheories" to protect them from degenerating into nonsense.) I once ran a system that chained IsA relations over all of ConceptNet 3, and (partially due to a mis-parsed statement) found it asserting "x IsA bathtub" for every x that was any sort of tangible object. So you probably want your results to have diminishing value as you chain more IsA statements.