Category Call


Service Call:
http://api.semantichacker.com/TOKEN/category[/ConfigurationID]?

Overview

The category service call identifies the main topic categories for the input text or URI. The results of the call are ordered by weight. A category's weight indicates how relevant it is to the topics contained in the input. Examples include 'Sports/Football/American/NFL' and 'Sports/Football/American/Players' for the input URI 'http://www.nfl.com', and 'Computers/Software/Operating Systems/Linux' for the input URI 'http://www.kernel.org'.

The category service allows for an optional configuration ID to be provided at the end of the request path. View the Service Configurations page for more information.

Category Call Parameters

In addition to the common request parameters, the category call has the following optional parameters.

Name Value Required
(Yes/No)
Usage Notes
showLabels 'true' or 'false' No Can be used to indicate whether or not the response should include dimension labels or dimension numeric IDs. The default is 'false' and the response will only have dimension numeric IDs. Using numeric IDs and extracting labels locally from a labels file can save a significant amount of bandwidth and is highly recommended. Labels files for all configurations can be found on our Service Configurations page.
format 'xml','json', 'tagcloud', 'jsontagcloud', 'javascripttagcloud', or 'rdf' No In addition to JSON and XML, the category service supports Tag Cloud Formats ('tagcloud', 'jsontagcloud', 'javascripttagcloud'), and RDF ('rdf') output formats. NOTE: the 'externalId' parameter is required when using the RDF output format.
linkBase http://www.somedomain.com/ No An optional parameter that is recognized if the format is 'tagcloud', 'jsontagcloud', or 'javascripttagcloud'. When specified, the href attribute for each returned <a> contained in the tag cloud will be set to <linkBase>/<conceptTag>.
linkTarget <windowName> No An optional parameter that is recognized if the format is 'tagcloud', 'jsontagcloud', or 'javascripttagcloud'. When specified, the target attribute for each returned <a> contained in the tag cloud will be set to the provided value.

XML Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fwww.kernel.org&showLabels=true

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://www.semantichacker.com/api">
	<about>
		<requestId>87E7644CD41B002A5BE9F5E46730C93A</requestId>
		<docId>C0B1E02C7E06323EA312CC7288F865BE</docId>
		<systemType>category</systemType>
		<configId>odp_2007_l1_1.7k</configId>
		<contentType>text/html</contentType>
		<contentDigest>6ABDCDB166C100D8D27E0046134FD6CF</contentDigest>
		<requestDate>2008-10-13T14:06:18+0000</requestDate>
		<systemVersion>2.0</systemVersion>
		<sourceUri>http://www.kernel.org</sourceUri>
	</about>
	<categorizer>
		<categorizerResponse>
			<categories>
				<category id="11040" weight="1.21881" label="Top/Computers/Software/Operating Systems/Linux" />
			</categories>
		</categorizerResponse>
	</categorizer>
</response>

JSON Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fwww.kernel.org&showLabels=true&format=json


{
   "about":     {
       "requestId": "87E7644CD41B002A5BE9F5E46730C93A",
       "docId": "C0B1E02C7E06323EA312CC7288F865BE",
       "systemType": "category",
       "configId": "odp_2007_l1_1.7k",
       "contentType": "text/html",
       "contentDigest": "6ABDCDB166C100D8D27E0046134FD6CF",
       "requestDate": "2008-10-13T14:06:18+0000",
       "systemVersion": "2.0",
       "sourceUri": "http://www.kernel.org</sourceUri"
   },
   "categorizer": {"categorizerResponse": {"categories":     [
               {
           "id": "11040",
           "weight": "1.21881",
           "label": "Top/Computers/Software/Operating Systems/Linux"
       },
   ]}}
}

TagCloud Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fen.wikipedia.org%2fwiki%2fElectric_guitar&format=tagcloud

  <ul class="tw-cloud">
    <li class="size6">
      <a rel="tag" href="http://delicious.com/tag/Top/Arts/Music/Instruments/Stringed/Guitar/Electric" target="_blank" title="Top/Arts/Music/Instruments/Stringed/Guitar/Electric (1.000)"><span>Top/Arts/Music/Instruments/Stringed/Guitar/Electric <em>(1.000)</em></span></a>
    </li>  
    <li class="size5">
      <a rel="tag" href="http://delicious.com/tag/Top/Shopping/Music/Instruments/Stringed/Guitar" target="_blank" title="Top/Shopping/Music/Instruments/Stringed/Guitar (0.697)"><span>Top/Shopping/Music/Instruments/Stringed/Guitar <em>(0.697)</em></span></a>
    </li>  
  </ul>

JSON TagCloud Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fen.wikipedia.org%2fwiki%2fElectric_guitar&format=jsontagcloud

{ "cloudHtml" :
 "  <ul class=\"tw-cloud\">\n    <li class=\"size6\">\n      <a rel=\"tag\" href=\"http://delicious.com/tag/Top/Arts/Music/Instruments/Stringed/Guitar/Electric\" target=\"_blank\" title=\"Top/Arts/Music/Instruments/Stringed/Guitar/Electric (1.000)\"><span>Top/Arts/Music/Instruments/Stringed/Guitar/Electric <em>(1.000)<\/em><\/span><\/a>\n    <\/li>  \n    <li class=\"size5\">\n      <a rel=\"tag\" href=\"http://delicious.com/tag/Top/Shopping/Music/Instruments/Stringed/Guitar\" target=\"_blank\" title=\"Top/Shopping/Music/Instruments/Stringed/Guitar (0.697)\"><span>Top/Shopping/Music/Instruments/Stringed/Guitar <em>(0.697)<\/em><\/span><\/a>\n    <\/li>  \n  <\/ul>\n"
};	

Javascript TagCloud Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fen.wikipedia.org%2fwiki%2fElectric_guitar&format=javascripttagcloud

var tag = { "cloudHtml" :
 "  <ul class=\"tw-cloud\">\n    <li class=\"size6\">\n      <a rel=\"tag\" href=\"http://delicious.com/tag/Top/Arts/Music/Instruments/Stringed/Guitar/Electric\" target=\"_blank\" title=\"Top/Arts/Music/Instruments/Stringed/Guitar/Electric (1.000)\"><span>Top/Arts/Music/Instruments/Stringed/Guitar/Electric <em>(1.000)<\/em><\/span><\/a>\n    <\/li>  \n    <li class=\"size5\">\n      <a rel=\"tag\" href=\"http://delicious.com/tag/Top/Shopping/Music/Instruments/Stringed/Guitar\" target=\"_blank\" title=\"Top/Shopping/Music/Instruments/Stringed/Guitar (0.697)\"><span>Top/Shopping/Music/Instruments/Stringed/Guitar <em>(0.697)<\/em><\/span><\/a>\n    <\/li>  \n  <\/ul>\n"
};
document.write(tag.cloudHtml);

RDF Response Example

http://api.semantichacker.com/TOKEN/category?uri=http%3a%2f%2fen.wikipedia.org%2fwiki%2fElectric_guitar&externalId=r001&format=rdf

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:twtype="http://s.textwise.com/1.0/type#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:tw="http://s.textwise.com/1.0/pred#" > 
  <rdf:Description rdf:about="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#DocInfo"/>
    <tw:externalId>r001</tw:externalId>
    <tw:sourceUrl>http://en.wikipedia.org/wiki/Electric_guitar</tw:sourceUrl>
  </rdf:Description>
  <rdf:Description rdf:about="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb/meta">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#DocInfoMeta"/>
    <tw:docId rdf:resource="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb"/>
    <tw:configId>odp_2007_l1_1.7k</tw:configId>
    <tw:tagSpaceLanguage>en_US</tw:tagSpaceLanguage>
    <tw:tagSpace>http://d.textwise.com/1.0/element/odp_2007_l1_1.7k/en_US/category</tw:tagSpace>
    <tw:systemVersion>2.0</tw:systemVersion>
    <tw:contentType>text/html</tw:contentType>
    <tw:requestDate>2008-10-14T11:48:36+0000</tw:requestDate>
    <tw:contentDigest>572C03FEBF4A1A8E51A4E43F2C640F20</tw:contentDigest>
  </rdf:Description>
  <rdf:Description rdf:about="http://d.textwise.com/1.0/element/odp_2007_l1_1.7k/en_US/category/1012">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#CategoryTag"/>
    <tw:label>Top/Arts/Music/Instruments/Stringed/Guitar/Electric</tw:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb/Instance/1">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#Instance"/>
    <tw:docId rdf:resource="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb"/>
    <tw:subject rdf:resource="http://d.textwise.com/1.0/element/odp_2007_l1_1.7k/en_US/category/1012"/>
    <tw:weight>1.2347553</tw:weight>
  </rdf:Description>
  <rdf:Description rdf:about="http://d.textwise.com/1.0/element/odp_2007_l1_1.7k/en_US/category/4199">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#CategoryTag"/>
    <tw:label>Top/Shopping/Music/Instruments/Stringed/Guitar</tw:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb/Instance/2">
    <rdf:type rdf:resource="http://s.textwise.com/1.0/type#Instance"/>
    <tw:docId rdf:resource="http://d.textwise.com/1.0/dochash/eabafc40-aee3-9739-b797-1ec0b53a3fbb"/>
    <tw:subject rdf:resource="http://d.textwise.com/1.0/element/odp_2007_l1_1.7k/en_US/category/4199"/>
    <tw:weight>0.8604636</tw:weight>
  </rdf:Description>
</rdf:RDF>