Classify HTML

POST classify/html

Classify the submitted HTML and return scored categories and keywords.

Parameters

Parameter Type Description
html (required) string HTML content to be classified.
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)
entities (optional) boolean Perform Named Entity Recognition (NER) on the content submitted (defaults to false)
sentiment (optional) boolean Perform sentiment analysis 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 scored_categories and scored_keywords as well as a categories dictionary. The scored_keywords object contains a list of high-value phrases that eContext was able to pull out of the submitted text as well as associated scores for each. The scored_categories object contains a list of category_id and score objects where the category_id corresponds to an item in the categories dictionary. Higher values indicate a higher score.

Example Request

POST Request

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

The contents of classify-html-input.json:

{
    "html": "<!DOCTYPE html><html><head><title>Microsoft Stores offer $100 Xbox One discount
    if you trade in a PS3</title></head><body><h1>Microsoft Stores offer $100 Xbox One discount
    if you trade in a PS3</h1><p>Currently there’s one advantage the PS4 has over the Xbox One
    that Microsoft can do little about: the price difference.</p><p>Sure, they
    could cut the price of the Xbox One by $100 and match the PS4 at $399, but then Microsoft
    would be making a big loss on every console sold. However, they have come up with a way to
    offer you an Xbox One for $399.</p><p>From now until March 2, Microsoft Stores will offer
    you $100 of store credit if you trade in a PS3, Xbox 360 S, or Xbox 360 E. Of course,
    there’s a number of terms and conditions in order to get that $100. The console must be in
    fully working order and have its original accessories including the power supply. You will
    also only be guaranteed to get $100 for your old machine if you agree to purchase an Xbox
    One at the same time.</p></body></html>"
}

POST Response

{
    "econtext": {
        "classify": {
            "title": "Microsoft Stores offer $100 Xbox One discount if you trade in a PS3",
            "scored_categories": [
                {
                    "category_id": "f84fecd03747f686a400004a0c0c131f",
                    "score": 0.2287166454892
                },
                {
                    "category_id": "38ad1efe89be1d7422cfce5636156cad",
                    "score": 0.16518424396442
                },
                {
                    "category_id": "269e2e578e59d5730412dd0e1137bfd4",
                    "score": 0.1143583227446
                },
                {
                    "category_id": "7c11e7aa595539b4801d8e7621c20840",
                    "score": 0.1143583227446
                },
                {
                    "category_id": "fd84446c4932d31e5f447e94d7f2da8f",
                    "score": 0.09148665819568
                },
                {
                    "category_id": "367f5ea7ca1e5c3ff10b077d9a65eb42",
                    "score": 0.082592121982211
                },
                {
                    "category_id": "fb842bf3a7941336e6add468d3906ff4",
                    "score": 0.050825921219822
                }
            ],
            "scored_keywords": [
                {
                    "keyword": "microsoft stores",
                    "score": 0.2287166454892
                },
                {
                    "keyword": "xbox one",
                    "score": 0.16518424396442
                },
                {
                    "keyword": "microsoft",
                    "score": 0.1143583227446
                },
                {
                    "keyword": "ps3",
                    "score": 0.1143583227446
                },
                {
                    "keyword": "discount",
                    "score": 0.09148665819568
                },
                {
                    "keyword": "xbox",
                    "score": 0.082592121982211
                },
                {
                    "keyword": "ps4",
                    "score": 0.050825921219822
                }
            ],
            "categories": {
                "f84fecd03747f686a400004a0c0c131f": {
                    "id": "f84fecd03747f686a400004a0c0c131f",
                    "name": "Microsoft Stores",
                    "path": [
                        "Computers \u0026 Electronics",
                        "General Electronics",
                        "General Electronics Retailers [List]",
                        "Microsoft Stores"
                    ],
                    "idpath": [
                        "bdc03d860e5f33c08146faa43487c1bd",
                        "5d246a5262680d7e5ab8239a56425730",
                        "adf37548583dd2d1266e915980c09f1f",
                        "f84fecd03747f686a400004a0c0c131f"
                    ],
                    "stats": {
                        "social_relevance": 2.1834e-6,
                        "social_idf": 12.8158720241
                    },
                    "facets": []
                },
                "269e2e578e59d5730412dd0e1137bfd4": {
                    "id": "269e2e578e59d5730412dd0e1137bfd4",
                    "name": "Microsoft",
                    "path": [
                        "Computers \u0026 Electronics",
                        "Technology Companies",
                        "Microsoft"
                    ],
                    "idpath": [
                        "bdc03d860e5f33c08146faa43487c1bd",
                        "45d78f5a0c2e0b188bb3931288ca0074",
                        "269e2e578e59d5730412dd0e1137bfd4"
                    ],
                    "stats": {
                        "social_relevance": 9.00323e-5,
                        "social_idf": 9.0965774811
                    },
                    "facets": [
                        [
                            "brand",
                            "microsoft"
                        ]
                    ]
                },
                "38ad1efe89be1d7422cfce5636156cad": {
                    "id": "38ad1efe89be1d7422cfce5636156cad",
                    "name": "Xbox One",
                    "path": [
                        "Games \u0026 Toys",
                        "Video Games",
                        "Video Game Products",
                        "Video Game Electronics",
                        "Video Game Systems",
                        "Microsoft Game Systems",
                        "Xbox One"
                    ],
                    "idpath": [
                        "798f51fd6b8d172fa4fd718313c8c4c6",
                        "761a66aa4f58df6fdc5151837e392ffa",
                        "e85b2a2795db3616a2e4efe77e9763d3",
                        "fb6e05a0a6cb6e6e12f984484a95c8bd",
                        "281afc76dd2aba143e93fbda5b12cd43",
                        "3b372c9f4b17d9bf3daaa696d88bd2cb",
                        "38ad1efe89be1d7422cfce5636156cad"
                    ],
                    "stats": {
                        "social_relevance": 8.08493e-5,
                        "social_idf": 9.2041595147
                    },
                    "facets": [
                        [
                            "domain",
                            "product"
                        ],
                        [
                            "brand",
                            "microsoft"
                        ],
                        [
                            "product line",
                            "xbox one"
                        ]
                    ]
                },
                "367f5ea7ca1e5c3ff10b077d9a65eb42": {
                    "id": "367f5ea7ca1e5c3ff10b077d9a65eb42",
                    "name": "Xbox",
                    "path": [
                        "Games \u0026 Toys",
                        "Video Games",
                        "Video Game Products",
                        "Video Game Electronics",
                        "Video Game Systems",
                        "Microsoft Game Systems",
                        "Xbox"
                    ],
                    "idpath": [
                        "798f51fd6b8d172fa4fd718313c8c4c6",
                        "761a66aa4f58df6fdc5151837e392ffa",
                        "e85b2a2795db3616a2e4efe77e9763d3",
                        "fb6e05a0a6cb6e6e12f984484a95c8bd",
                        "281afc76dd2aba143e93fbda5b12cd43",
                        "3b372c9f4b17d9bf3daaa696d88bd2cb",
                        "367f5ea7ca1e5c3ff10b077d9a65eb42"
                    ],
                    "stats": {
                        "social_relevance": 0.0001794867,
                        "social_idf": 8.4066451632
                    },
                    "facets": [
                        [
                            "product line",
                            "xbox"
                        ],
                        [
                            "domain",
                            "product"
                        ],
                        [
                            "brand",
                            "microsoft"
                        ]
                    ]
                },
                "fd84446c4932d31e5f447e94d7f2da8f": {
                    "id": "fd84446c4932d31e5f447e94d7f2da8f",
                    "name": "Discounts",
                    "path": [
                        "Shopping",
                        "Shopping Resources",
                        "Coupon Websites \u0026 Services",
                        "Coupon Services",
                        "Coupons \u0026 Promotional Discounts",
                        "Discounts"
                    ],
                    "idpath": [
                        "b5993a12bb630473aa1f4f7c924f5cb9",
                        "72c561d57874e3163e70f8876b4b88b9",
                        "8d82bfef852c143f2caa363514ece6ec",
                        "e06400364dee27e6d8ade510564f8f27",
                        "987101e47b003440c98a48eb750145ad",
                        "fd84446c4932d31e5f447e94d7f2da8f"
                    ],
                    "stats": {
                        "social_relevance": 0.0001633682,
                        "social_idf": 8.5007396243
                    },
                    "facets": [
                        [
                            "domain",
                            "service"
                        ]
                    ]
                },
                "7c11e7aa595539b4801d8e7621c20840": {
                    "id": "7c11e7aa595539b4801d8e7621c20840",
                    "name": "PlayStation 3",
                    "path": [
                        "Games \u0026 Toys",
                        "Video Games",
                        "Video Game Products",
                        "Video Game Electronics",
                        "Video Game Systems",
                        "Sony Game Systems",
                        "PlayStation",
                        "PlayStation 3"
                    ],
                    "idpath": [
                        "798f51fd6b8d172fa4fd718313c8c4c6",
                        "761a66aa4f58df6fdc5151837e392ffa",
                        "e85b2a2795db3616a2e4efe77e9763d3",
                        "fb6e05a0a6cb6e6e12f984484a95c8bd",
                        "281afc76dd2aba143e93fbda5b12cd43",
                        "fc2ef8f2df41f297e63aa06a1992132b",
                        "c83189555c0bcf05939ae6b5ad3ac17c",
                        "7c11e7aa595539b4801d8e7621c20840"
                    ],
                    "stats": {
                        "social_relevance": 1.25865e-5,
                        "social_idf": 11.0641178895
                    },
                    "facets": [
                        [
                            "domain",
                            "product"
                        ],
                        [
                            "brand",
                            "sony"
                        ],
                        [
                            "product line",
                            "playstation 3"
                        ]
                    ]
                },
                "fb842bf3a7941336e6add468d3906ff4": {
                    "id": "fb842bf3a7941336e6add468d3906ff4",
                    "name": "PlayStation 4",
                    "path": [
                        "Games \u0026 Toys",
                        "Video Games",
                        "Video Game Products",
                        "Video Game Electronics",
                        "Video Game Systems",
                        "Sony Game Systems",
                        "PlayStation",
                        "PlayStation 4"
                    ],
                    "idpath": [
                        "798f51fd6b8d172fa4fd718313c8c4c6",
                        "761a66aa4f58df6fdc5151837e392ffa",
                        "e85b2a2795db3616a2e4efe77e9763d3",
                        "fb6e05a0a6cb6e6e12f984484a95c8bd",
                        "281afc76dd2aba143e93fbda5b12cd43",
                        "fc2ef8f2df41f297e63aa06a1992132b",
                        "c83189555c0bcf05939ae6b5ad3ac17c",
                        "fb842bf3a7941336e6add468d3906ff4"
                    ],
                    "stats": {
                        "social_relevance": 0.0005111679,
                        "social_idf": 7.3600482699
                    },
                    "facets": [
                        [
                            "domain",
                            "product"
                        ],
                        [
                            "product line",
                            "playstation 4"
                        ],
                        [
                            "brand",
                            "sony"
                        ]
                    ]
                },
                "b92b6f1c-26e1-579c-b2ab-c8d78fa820c7": {
                    "id": "b92b6f1c-26e1-579c-b2ab-c8d78fa820c7",
                    "name": "Microsoft",
                    "path": [
                        "Organizations",
                        "Microsoft"
                    ],
                    "idpath": [
                        "003469e8-80c6-51da-8ea8-e22db254fb74",
                        "b92b6f1c-26e1-579c-b2ab-c8d78fa820c7"
                    ],
                    "stats": null,
                    "facets": null
                }
            },
            "entities": [
                {
                    "category_id": "f84fecd03747f686a400004a0c0c131f",
                    "type": "ORG"
                },
                {
                    "category_id": "7c11e7aa595539b4801d8e7621c20840",
                    "type": "PRODUCT"
                },
                {
                    "category_id": "f84fecd03747f686a400004a0c0c131f",
                    "type": "ORG"
                },
                {
                    "category_id": "7c11e7aa595539b4801d8e7621c20840",
                    "type": "PRODUCT"
                },
                {
                    "category_id": "f84fecd03747f686a400004a0c0c131f",
                    "type": "ORG"
                },
                {
                    "category_id": "b92b6f1c-26e1-579c-b2ab-c8d78fa820c7",
                    "type": "ORG"
                }
            ],
            "sentiment": 0.6422,
            "chars": 326,
            "overlay": {
                "f84fecd03747f686a400004a0c0c131f": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "632",
                                "Technology \u0026 Computing::Consumer Electronics"
                            ],
                            [
                                "596",
                                "Technology \u0026 Computing"
                            ]
                        ]
                    ]
                },
                "269e2e578e59d5730412dd0e1137bfd4": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "632",
                                "Technology \u0026 Computing::Consumer Electronics"
                            ],
                            [
                                "596",
                                "Technology \u0026 Computing"
                            ]
                        ]
                    ]
                },
                "38ad1efe89be1d7422cfce5636156cad": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "239",
                                "Hobbies \u0026 Interests"
                            ],
                            [
                                "269",
                                "Hobbies \u0026 Interests::Games and Puzzles"
                            ]
                        ],
                        [
                            [
                                "680",
                                "Video Gaming"
                            ]
                        ],
                        [
                            [
                                "681",
                                "Video Gaming::Console Games"
                            ]
                        ]
                    ]
                },
                "367f5ea7ca1e5c3ff10b077d9a65eb42": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "239",
                                "Hobbies \u0026 Interests"
                            ],
                            [
                                "269",
                                "Hobbies \u0026 Interests::Games and Puzzles"
                            ]
                        ],
                        [
                            [
                                "680",
                                "Video Gaming"
                            ]
                        ],
                        [
                            [
                                "681",
                                "Video Gaming::Console Games"
                            ]
                        ]
                    ]
                },
                "fd84446c4932d31e5f447e94d7f2da8f": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "473",
                                "Shopping"
                            ]
                        ],
                        [
                            [
                                "474",
                                "Shopping::Coupons and Discounts"
                            ]
                        ]
                    ]
                },
                "7c11e7aa595539b4801d8e7621c20840": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "239",
                                "Hobbies \u0026 Interests"
                            ],
                            [
                                "269",
                                "Hobbies \u0026 Interests::Games and Puzzles"
                            ]
                        ],
                        [
                            [
                                "680",
                                "Video Gaming"
                            ]
                        ],
                        [
                            [
                                "681",
                                "Video Gaming::Console Games"
                            ]
                        ]
                    ]
                },
                "fb842bf3a7941336e6add468d3906ff4": {
                    "IAB_v2.0_2018": [
                        [
                            [
                                "239",
                                "Hobbies \u0026 Interests"
                            ],
                            [
                                "269",
                                "Hobbies \u0026 Interests::Games and Puzzles"
                            ]
                        ],
                        [
                            [
                                "680",
                                "Video Gaming"
                            ]
                        ],
                        [
                            [
                                "681",
                                "Video Gaming::Console Games"
                            ]
                        ]
                    ]
                },
                "b92b6f1c-26e1-579c-b2ab-c8d78fa820c7": {
                    "IAB_v2.0_2018": []
                }
            }
        },
        "signature": {
            "resource": "POST \/classify\/:type\/:result_id",
            "status": "200 OK - successful",
            "client_ip": "209.41.117.158"
        }
    }
}