{"_id":"55a8f048cf45e1390093f248","parentDoc":null,"project":"55a7aee84a33f92b00b7a150","version":{"_id":"55a7aee84a33f92b00b7a153","__v":6,"project":"55a7aee84a33f92b00b7a150","createdAt":"2015-07-16T13:17:28.411Z","releaseDate":"2015-07-16T13:17:28.411Z","categories":["55a7aee94a33f92b00b7a154","55a7fefa3efe0c2f0074cbdf","55a8fb10c8bd450d000dd130","55a936b1cf45e1390093f362","55abddeaa36ccd0d00fdebe1","5624db675a86b423009462e1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"editedParams":true,"category":{"_id":"55a7aee94a33f92b00b7a154","__v":21,"project":"55a7aee84a33f92b00b7a150","version":"55a7aee84a33f92b00b7a153","pages":["55a7aee94a33f92b00b7a156","55a7ea403efe0c2f0074cb75","55a80eb23ec2ec0d00bd66ea","55a811fc6e61e619004f703e","55a8c513cf45e1390093f18c","55a8d9fa27a17d210052516d","55a8f048cf45e1390093f248","55aba4ba63a6b60d006616e1","55abab0a0685ce0d0049fb8d","55abb04da36ccd0d00fdebc1","55abc1cc63a6b60d006616f4","55abcdbd63a6b60d006616fa","55abd36763a6b60d00661700","55abd50ea36ccd0d00fdebdb","55abd8c3a36ccd0d00fdebdf","55abd9cc0685ce0d0049fbb5","55abdb6b63a6b60d00661706","55abdc9b0685ce0d0049fbb8","55c1f5fca131980d005be95b","55fac407bc972f0d0005f644","569f68e766a5640d00efa52d"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-16T13:17:29.102Z","from_sync":false,"order":2,"slug":"endpoints","title":"Endpoints"},"editedParams2":true,"user":"55a7ae50bf1be93100d89df1","__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-17T12:08:40.994Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl https://api.aylien.com/api/v1/concepts \\\n   -H \"X-AYLIEN-TextAPI-Application-Key: [[app:key]]\" \\\n   -H \"X-AYLIEN-TextAPI-Application-ID: [[app:id]]\" \\\n   -d text=\"Apple+was+founded+by+Steve+Jobs,+Steve+Wozniak+and+Ronald+Wayne.\"","language":"curl"},{"code":"textapi.concepts({\n  text: 'Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.'\n}, function(error, response) {\n  if (error === null) {\n    Object.keys(response.concepts).forEach(function(concept) {\n      var surfaceForms = response.concepts[concept].surfaceForms.map(function(sf) {\n        return sf['string'];\n      });\n      console.log(concept + \": \" + surfaceForms.join(\",\"));\n    });\n  }\n});","language":"javascript"},{"code":"text = \"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\"\nconcepts = client.Concepts({\"text\": text})\nfor uri, value in concepts['concepts'].iteritems():\n  sfs = map(lambda c: c['string'], value['surfaceForms'])\n  print uri,', '.join(sfs)","language":"python"},{"code":"<?php\n$text = 'Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.';\n$concepts = $textapi->Concepts(array('text' => $text));\nforeach ($concepts->concepts as $uri => $value) {\n  $surfaceForms = array_map(function($sf) {\n    return $sf->string;\n  }, $value->surfaceForms);\n  printf(\"$uri\\t\" . implode(\",\", $surfaceForms) . \"\\n\");\n}\n?>","language":"php"},{"code":"ConceptsParams.Builder builder = ConceptsParams.newBuilder();\nString text = \"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\";\nbuilder.setText(text);\nConcepts concepts = client.concepts(builder.build());\nfor (Concept concept: concepts.getConcepts()) {\n\tSystem.out.println(concept);\n}","language":"java"},{"code":"text = \"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\"\n\nresponse = client.concepts(text: text)\n\nresponse[:concepts].each do |concept, value|\n  surface_forms = value[:surfaceForms].map { |c| c[:string] }.join(', ')\n  puts \"#{concept}:#{surface_forms}\"\nend","language":"ruby"},{"code":"text := \"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\"\nconceptsParams := &textapi.ConceptsParams{Text: text}\nconcepts, err := client.Concepts(conceptsParams)\nif err != nil {\n\t\tpanic(err)\n}\nfor k, v := range concepts.Concepts {\n\t\tfmt.Printf(\"%s\\t%v\\n\", k, v.SurfaceForms)\n}","language":"go"},{"code":"string text = \"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\";\n\nConcepts concepts = client.Concepts(text: text);\n\nforeach (var concept in concepts.ConceptsMember)\n{\n  Console.WriteLine(concept.Key);\n}","language":"csharp"}]},"method":"get","results":{"codes":[{"status":200,"language":"json","code":"{\n  \"text\":\"Apple was founded by Steve Jobs, Steve Wozniak and Ronald Wayne.\",\n  \"language\":\"en\",\n  \"concepts\":{\n    \"http://dbpedia.org/resource/Apple_Inc.\":{\n      \"surfaceForms\":[\n        {\n          \"string\":\"Apple\",\n          \"score\":0.9994597361117074,\n          \"offset\":0\n        }\n      ],\n      \"types\":[\n        \"http://www.wikidata.org/entity/Q43229\",\n        \"http://schema.org/Organization\",\n        \"http://dbpedia.org/ontology/Organisation\",\n        \"http://dbpedia.org/ontology/Company\"\n      ],\n      \"support\":10626\n    }\n  }\n}","name":""}]},"settings":"","auth":"required","params":[{"_id":"55a8f048cf45e1390093f24a","ref":"","in":"query","required":false,"desc":"Text to extract concepts from","default":"","type":"string","name":"text"},{"_id":"55a8f048cf45e1390093f249","ref":"","in":"query","required":false,"desc":"URL to extract concepts from","default":"","type":"string","name":"url"},{"_id":"55a8f18bc8bd450d000dd113","ref":"","in":"query","required":false,"desc":"Language (refer to [Language Support](/docs/language-support))","default":"auto","type":"string","name":"language"}],"url":"/concepts"},"isReference":false,"order":5,"body":"The **Concept Extraction** endpoint extracts different types of notable entities from a document, using Wikipedia (and potentially other knowledge bases) as context. It also taps into Linked Open Data to provide structured data around the extracted entities, such as LOD URIs which can be used to retrieve additional information about an entity such as a person's height or a company's stock price, as well as semantic types of an entity (DBpedia, Schema.org, etc.) which can be used for filtering entities by their type.\n\n**N.B.** We recommend using both Entity and Concept Extraction together if you're looking to extract well-known entities with higher precision. See [Entity Extraction](doc:entities).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Under the hood, our Concept Extraction endpoint performs precise [Named Entity Disambiguation](https://en.wikipedia.org/wiki/Entity_linking) to find out what exactly the author had in mind when mentioning a topic or entity. For instance, in the sentence \\\"Apple was founded by Steve Jobs\\\" does “apple” refer to the fruit or the company?\",\n  \"title\": \"Named Entity Disambiguation\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Surface Forms of a Concept\",\n  \"body\": \"Each concept can have one or more surface forms. Each surface form of a concept may occur one or more times in a body of text. Our API will only return the first occurrence of a surface form for a given concept. For example:\\n\\nInput:\\n\\n    “Apple reports record first quarter results. Apple says sales of iPhones have slowed.”\\n    \\n`Apple` is a surface form for concept `Apple_Inc.`. Even though it's appeared two times in the text, our API only annotates the first occurrence.\\n\\nHowever, in cases that _different_ surface forms point to the same concept, our API will annotate all of those surface forms. For example:\\n\\nInput:\\n\\n    “The European migrant crisis or European refugee crisis began in 2015, when a rising number of refugees and migrants made the journey to the European Union to seek asylum, travelling across the Mediterranean Sea, or through Southeast Europe.”\\n    \\n`European migrant crisis` and `European refugee crisis` are both surface forms of the concept `European_migrant_crisis` and our API will return both in its results.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Sort Concepts by Relevance\",\n  \"body\": \"Concepts can be sorted by several measures. Using API response it's easy to sort them using `support` property. Or filtering concepts which their surface forms `score` is higher than certain threshold. However, there are occasions where you wish to sort concepts by their relevance to the submitted article. One approach could be sorting them by sum of their weighed surface-forms based on whether they have surfaced in the title or body of the article.\\n\\nWe've an example at our sandbox demonstrating this approach: https://developer.aylien.com/sandbox#465b66785970335357a2\"\n}\n[/block]","excerpt":"/concepts","slug":"concepts","type":"endpoint","title":"Concept Extraction"}

getConcept Extraction

/concepts

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

text:
string
Text to extract concepts from
url:
string
URL to extract concepts from
language:
stringauto
Language (refer to [Language Support](/docs/language-support))

Examples


Result Format


Documentation

The **Concept Extraction** endpoint extracts different types of notable entities from a document, using Wikipedia (and potentially other knowledge bases) as context. It also taps into Linked Open Data to provide structured data around the extracted entities, such as LOD URIs which can be used to retrieve additional information about an entity such as a person's height or a company's stock price, as well as semantic types of an entity (DBpedia, Schema.org, etc.) which can be used for filtering entities by their type. **N.B.** We recommend using both Entity and Concept Extraction together if you're looking to extract well-known entities with higher precision. See [Entity Extraction](doc:entities). [block:callout] { "type": "info", "body": "Under the hood, our Concept Extraction endpoint performs precise [Named Entity Disambiguation](https://en.wikipedia.org/wiki/Entity_linking) to find out what exactly the author had in mind when mentioning a topic or entity. For instance, in the sentence \"Apple was founded by Steve Jobs\" does “apple” refer to the fruit or the company?", "title": "Named Entity Disambiguation" } [/block] [block:callout] { "type": "info", "title": "Surface Forms of a Concept", "body": "Each concept can have one or more surface forms. Each surface form of a concept may occur one or more times in a body of text. Our API will only return the first occurrence of a surface form for a given concept. For example:\n\nInput:\n\n “Apple reports record first quarter results. Apple says sales of iPhones have slowed.”\n \n`Apple` is a surface form for concept `Apple_Inc.`. Even though it's appeared two times in the text, our API only annotates the first occurrence.\n\nHowever, in cases that _different_ surface forms point to the same concept, our API will annotate all of those surface forms. For example:\n\nInput:\n\n “The European migrant crisis or European refugee crisis began in 2015, when a rising number of refugees and migrants made the journey to the European Union to seek asylum, travelling across the Mediterranean Sea, or through Southeast Europe.”\n \n`European migrant crisis` and `European refugee crisis` are both surface forms of the concept `European_migrant_crisis` and our API will return both in its results." } [/block] [block:callout] { "type": "info", "title": "Sort Concepts by Relevance", "body": "Concepts can be sorted by several measures. Using API response it's easy to sort them using `support` property. Or filtering concepts which their surface forms `score` is higher than certain threshold. However, there are occasions where you wish to sort concepts by their relevance to the submitted article. One approach could be sorting them by sum of their weighed surface-forms based on whether they have surfaced in the title or body of the article.\n\nWe've an example at our sandbox demonstrating this approach: https://developer.aylien.com/sandbox#465b66785970335357a2" } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}