Classify Keywords

POST classify/keywords

Classify a list of keywords and return mapped eContext categories.

There is a hard limit of 1,000 keywords per call.

Parameters

Parameter Type Description
keywords (required) array A list of keyword strings to process (no more than 1,000).
classification_type (optional) integer Select the classification method: 1 for rule-based, 2 for model-based, or 0 for a hybrid rule-based + model-based (defaults to 0)
ml_threshold (optional) float Specify a confidence threshold for accepting an ML prediction. A lower value increases recall at the expense of precision (defaults to 0.75)
flags (optional) boolean Provide Object Flags to help filter out certain content categories including adult, firearms, gambling, etc (defaults to false)
branches (optional) array A set of eContext category ids. Any classification outside the section/s of the hierarchy described by this set will be removed from the response.
entities (optional) boolean Perform Named Entity Recognition (NER) on the content submitted (defaults to false)
taxonomy_timestamp (optional) integer A Unix timestamp instructing the classifier to use categories from the eContext Taxonomy that existed at this point in time. This will allow recently deleted categories to remain and hides newly created categories
dataset_id (optional) string A Custom Taxonomies id to use in lieu of the default eContext Taxonomy
add_last_node (optional) bool Include the last category node, or leave at the parent category
classify_limit (optional) integer Limit the number of categories that may be returned per post
classify_timeout (optional) float The number of seconds to spend on a classification task

Return

The result set includes a results key which provides a list of category id keys and associated data including Object Flags, if requested and found. The results in this set are in the same order as the keyword list submitted in the POST call.

Example Request

POST Request

curl -X POST -u username:password --data-binary @classify-keywords-input.json \
--header "Content-type: application/json" \
https://api.econtext.com/v2/classify/keywords

The contents of classify-keywords-input.json:

{
    "keywords": [
        "chicago cubs win world series",
        "chicago bears",
        "chicago museums"
    ]
}

POST Response

{
  "econtext": {
    "classify": {
      "results": [
        {
          "flags": [],
          "category_id": "f807a71b4e0687cdaeb24afaaa725781"
        },
        {
          "flags": [],
          "category_id": "85edc49558d9373a4a5bcfc6eb0bac90"
        },
        {
          "flags": [],
          "category_id": "ab4a592bf3b0724f7955734270df0044"
        }
      ],
      "mappings": [
        "f807a71b4e0687cdaeb24afaaa725781",
        "85edc49558d9373a4a5bcfc6eb0bac90",
        "ab4a592bf3b0724f7955734270df0044"
      ],
      "categories": {
        "85edc49558d9373a4a5bcfc6eb0bac90": {
          "id": "85edc49558d9373a4a5bcfc6eb0bac90",
          "name": "Chicago Bears",
          "path": [
            "Sports",
            "Team Sports",
            "Football",
            "Football Leagues & Teams",
            "Professional Football Leagues & Teams",
            "NFL",
            "National Football Conference",
            "National Football Conference - North Division",
            "Chicago Bears"
          ],
          "idpath": [
            "b00fac5f30dc8dbb660c8d08fe66f487",
            "97e2d582fd4e9fe6c9ca51128222e55f",
            "1d86d6fea65150be10232959abc02574",
            "9398300d477069715ad4682b293fb087",
            "04455c6d36d1056a7be0b231e861c0c5",
            "f3fafece413cb4e87975d12457ddb9a1",
            "4f2d7f778d65a60d35cc53fff475e84f",
            "7680bb6c2b3e6babe7bfcc7c44fd752b",
            "85edc49558d9373a4a5bcfc6eb0bac90"
          ],
          "stats": {
            "social_relevance": 0.0000145741,
            "social_idf": 10.89641527996
          }
        },
        "ab4a592bf3b0724f7955734270df0044": {
          "id": "ab4a592bf3b0724f7955734270df0044",
          "name": "Museums",
          "path": [
            "Travel",
            "Sightseeing Tours & Tourist Attractions",
            "Tourist Attractions",
            "Arts & Culture Attractions",
            "Museums"
          ],
          "idpath": [
            "71d23bae99aff67ee839c60c0c8ba179",
            "464464e0888a968cc968fa732e173502",
            "38d7f7961dc84f1c28b49c9c0f7864c6",
            "37a81c7685508c8ea16cafeebc81eab3",
            "ab4a592bf3b0724f7955734270df0044"
          ],
          "stats": {
            "social_relevance": 0.0001311244,
            "social_idf": 8.6995146942028
          }
        },
        "f807a71b4e0687cdaeb24afaaa725781": {
          "id": "f807a71b4e0687cdaeb24afaaa725781",
          "name": "Chicago Cubs",
          "path": [
            "Sports",
            "Team Sports",
            "Baseball & Softball",
            "Baseball & Softball Leagues & Teams",
            "Baseball Leagues & Teams",
            "MLB",
            "National League",
            "National League Central",
            "Chicago Cubs"
          ],
          "idpath": [
            "b00fac5f30dc8dbb660c8d08fe66f487",
            "97e2d582fd4e9fe6c9ca51128222e55f",
            "c7ba1574765e1e52284f7c741eda8cb2",
            "0e549b37faa378d09c7eb2933c58d5d0",
            "eb4500849649483fe92110c60fa23305",
            "1e230ea842e7351f0b56386a9c91580c",
            "395270339c7febd83b22fa70c92d0461",
            "67f178964c2e14f125cb6677ab3f7fe7",
            "f807a71b4e0687cdaeb24afaaa725781"
          ],
          "stats": {
            "social_relevance": 0.0000496709,
            "social_idf": 9.6702417656539
          }
        }
      },
      "overlay": []
    },
    "signature": {
      "resource": "GET /classify/:type/:result_id",
      "status": "200 OK - successful",
      "client_ip": "127.0.0.1"
    }
  }
}