Documents Classification

This API retrieves document classification result for IAB-2 taxonomy or Documents taxonomy. It returns an object that contains information about the best class and its probability and about probability of other classes.

See Classify request parameters for request’s details.

Resource

This resource represents a controller for single call document classification.

Classify document with taxonomy. Set taxonomy parameter to “default” for IAB-2, set to “documents” for Documents taxonomy, or set to “sentiment” or “sentiment3” for Sentiments taxonomies.

cURL REST Example for IAB-2 (default) taxonomy

Request

curl -v "http://api.groupdocs.cloud/v1.0/classification/classify"
-H "content-type: application/json"
-X POST -d '{ "document": {"folder": "words/docx","name": "four-pages.docx" } }'

Response

{
  "bestClassName": "Books_and_Literature",
  "bestClassProbability": 48.92,
  "bestResults":[{
    "className":"Books_and_Literature",
    "classProbability":48.92
  }],
  "code": 200,
  "status": "OK"
}

cURL REST Example for “Documents” taxonomy

Request

curl -v "http://api.groupdocs.cloud/v1.0/classification/classify?bestClassesCount=3&taxonomy=documents"
-H "content-type: application/json"
-X POST -d '{ "document": {"folder": "words/docx","name": "four-pages.docx" } }'

Response

{
  "bestClassName": "Other",
  "bestClassProbability": 36.8,
  "bestResults": [
    {
      "className": "Other",
      "classProbability": 36.8
    },
    {
      "className": "ADVE",
      "classProbability": 14.72
    },
    {
      "className": "News",
      "classProbability": 12.77
    }
  ],
  "code": 200,
  "status": "OK"
}

cURL REST Example for Sentiment taxonomy

Request

curl -v "http://api.groupdocs.cloud/v1.0/classification/classify?bestClassesCount=1&taxonomy=sentiment"
-H "content-type: application/json"
-X POST -d '{ "document": {"folder": "words/docx","name": "four-pages.docx" } }'

Response

{
  "bestClassName": "Positive",
  "bestClassProbability":90.02,
  "bestResults":[{
    "className":"Positive",
    "classProbability":90.02
  }],
  "Code":200,
  "status":"OK"
}

cURL REST Example for Sentiment3 taxonomy

Request

curl -v "http://api.groupdocs.cloud/v1.0/classification/classify?bestClassesCount=3&taxonomy=sentiment3"
-H "content-type: application/json"
-X POST -d '{ "document": {"folder": "words/docx","name": "four-pages.docx" } }'

Response

{
  "bestClassName": "Positive",
  "bestClassProbability":89.43,
  "bestResults":[{
    "className":"Positive",
    "classProbability":89.43
  },
  {
    "className":"Neutral",
    "classProbability":7.15
  },
  {
    "className":"Negative",
    "classProbability":3.42
  }],
  "Code":200,
  "status":"OK"
}

SDK example

The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here

Classify Document from Storage

C#

Classify Document from Stream

C#