-
Notifications
You must be signed in to change notification settings - Fork 358
API
##ConceptNet5's Web API written by Christopher Fry and Yen-Ling Kuo ###Beginning The beginning of these url's is: http://conceptnet5.media.mit.edu. This url will show an "about" page for ConceptNet5. ###Format Following the beginning is the word "web" or "data". "web" provides a human readable page, whereas "data" provides teh information in JSON format for programs to make easier use of. The below just shows a "hello world" page.
Example : http://conceptnet5.media.mit.edu/web/ ###Nodes Conceptnet5 stores its information in "nodes". The types of node are:
- concept
- frame
- relation
- assertion
- sense
Use one of the above words in the url to indicate which type of node you want information about. Note that the above URL does not work. It is included because it is the beginning of some useful urls.
Example : http://conceptnet5.media.mit.edu/data/concept/
Nodes are connected by "edges" in the knowledge base. An edge has a start node, an end node, a type and some other fields. Each node also has the following properties:
- license
- url
- uri
- dataset
- normalized (true or false)
- type (i.e the node_type of concept)
Some node types have additional properties. For example, concepts have the additional properites: language and name. Score is also a common attribute, although as of this writing not all nodes have a score. ###Language If the node type is concept or frame, it is followed by a natural language designator. Nodes of type relation are in just one language (usually English) but the point is, there's no need for a language designator. Assertions don't have an overall language designator but the individual concepts within the relation will (see below).
- English - "en",
- Traditional Chinese - "zh_TW",
- Japanese - "ja".
- Spanish - "es"
- Hebrew - "he"
There are other language designators. These designators are taken from ISO 639-1 or ISO 639-2/3 when shorter codes are inapplicable.
Example : http://conceptnet5.media.mit.edu/data/frame/en/
Note: the above URL does not work. It is included because it is the beginning of some useful urls. ###Node Identifiers The format for the identifier for a given node depends on its node type.
-
Concept Identifier - The concept identifier is the word or phrase that refers to the concept in the designated language. All characters in the concept identifier are lower case. Spaces are represented as underscores. Each concept has a property indicating whether it is normalized or not. Non-normalized concepts have an associated normalized concept. Normalized concepts can have several "senses". A sense is not a concept, but rather a different node type.
Example : http://conceptnet5.media.mit.edu/data/concept/en/book
-
Relation Identifier - A relation identifier is an english word or phrase that has upper and lower case letters with spaces represented as underscores. Unlike ConceptNet4, relations are not limited to just the set of 20 or so.
Example: http://conceptnet5.media.mit.edu/data/relation/AtLocation
-
Frame Identifier - A frame is represented as the text of a sentence with placeholders for each concept like so: {1} is a sort of {2}
Example: http://conceptnet5.media.mit.edu/data/frame/en/{1}_is_a_sort_of_{2}
-
Assertion Identifier - An assertion identifier is the concatenation of a relation identifier and two concept identifiers boundd by square brackets. The assertion "computer AtLocation office" is represented as:
The above is for a normalized assertion. But we can also represent assertions in non-normalized fashion using a frame. The sentence [A golden retriever] is a sort of [dog] is represented as a frame plus two concepts like so:
Note that spaces in the sentence are replaced by underscores.
-
Sense Identifier - Words (and their associated concepts) may have more than one meaning. Each meaning is called a "sense". Though sense is a node type, you get information about it using the node type of "concept", followed by the word, plus a part of speech identifier and a definition (with spaces replaced by underscores) of the sense. Below, we are referring to the sense of the word: "computer" that is a noun and has a definition of "a machine for performing calculations automatically". We can retrieve all the senses for the word "computer" via: returns json of word senses for "computer'.
###URL Attributes After the above URL's you can further refine your request by adding a question mark and one of three attributues:
getper_pagemax_score
If we do NOT add one of those attributes, we will effectively 'get' lots of information about the node. The 'get' call allows you to select which information about the identified node to retrieve, limiting the amount of information that comes back.
Example : http://conceptnet5.media.mit.edu/data/concept/en/book ###Get Following 'get' you may have 1 or more of the following parameters:
-
properties- Only the properties of the Node that is being queried (i.e its name, uri, score etc.) are returned.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=properties
-
incoming_edges- The incoming edges to the node that is being queried, ordered by score.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=incoming_edges
-
outgoing_edges- The outgoing edges from the node that is being queried, ordered by score.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=outgoing_edges
-
incoming_assertions- The incoming assertions to the node being queried, ordered by score.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=incoming_assertions
-
word_senses- The word senses of the node being queried, unordered.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=word_senses
-
is_word_sense_of- The nodes that refer to the node being queried as a word sense, unordered.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=is_word_sense_of.
-
normalized- The normalized node of the node being queried. There can be only one normalized concept for an un-normalized concept.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=normalized
-
is_normalized_of- The nodes that refer to the node being queried as a normalized node, unordered.Example : http://conceptnet5.media.mit.edu/data/concept/en/book?get=is_normalized_of
-
contexts– The nodes that are designated ‘contexts’ of the node being queried, unordered.Example : http://conceptnet5.media.mit.edu/data/concept/en/book/?get=contexts.
-
is_context_of– The nodes that refer to the node being queried as one of their contexts.Example : http://conceptnet5.media.mit.edu/data/concept/en/book/?get=is_context_of
-
<more than one parameter>- separate parameters with +. This return all of those values, categorized under their get tag, in a single json file.Example : http://conceptnet5.media.mit.edu/data/concept/en/dog?get=properties+normalized_of
###Per-Page The number of results returned per page (results per page). This value will apply to all categories (if you request multiple categories in your 'get' parameter). This can be used if less than 50 results are wanted, and it will reduce response time. This value is an integer, and is limited to between 0 and 100. The default value is 50.
Example: http://conceptnet5.media.mit.edu/data/concept/en/dog?get=incoming_assertions&per_page=10 ###Max-Score The maximum score of any node that should be returned by a given query. Most queries are sorted in descending order by score. This value is a float, and is limited between 0 and None (meaning no upper bound). The default value is None. The value of max_score will be ignored when more than 1 category of information is being returned.
Example: http://conceptnet5.media.mit.edu/data/concept/en/dog?get=incoming_edges&max_score=1000
Starting points
Reproducibility
Details