Classify a piece of text with no prior training.

Our Unsupervised Classification endpoint allows users to classify a piece of text according to pre-chosen tags. This training-less classification matches the most appropriate tag from a group of labels or categories, pre-chosen by the user, to a piece of text.

This is a different approach to our other Classification endpoints, which categorize text based on a pre-trained classifier. It allows for greater flexibility for users, who can decide how they want to tag and classify text, without the need for a pre-trained classifier.

Pass a piece of text or URL to the API along with up to 5 labels and we’ll automatically tell you which label the text is most closely related to.

 

Unsupervised Classification Example:

Let's say we want to determine if the following URL is about Football, Baseball, Basketball or Rugby:

    GET /classify/unsupervised?url=http://www.bbc.com/sport/0/football/25912393&class=football&class=baseball&class=basketball&class=rugby

The result is:

    {
     "text": "Lionel Messi: Forward is not for sale, says Barcelona president\n\nBarcelona forward Lionel Messi is not for sale and the club plan to discuss a new contract with the Argentine, says president Josep Maria Bartomeu.\n\nFour-time Ballon d'Or winner Messi, 26, is reported to be a target for French side Paris St-Germain.\n\nIn an interview with radio station RAC1, posted on Barcelona's website,  Bartomeu said: \"The club will sit down and negotiate a new contract.\n\n\"We will do what we have to, to ensure he's the best-paid player.\"\n\nMessi scored 60 goals in 50 appearances last season but has struggled to match that goalscoring form in 2013-14.\n\nHe has scored 18 goals so far but just eight of those have been in the league.\n\nHis last league goal came in September, before he was out for five weeks with a hamstring injury.\n\n\"He can do everything,\" said Barca coach Gerardo Martino. \"If he succeeds in other facets of his game, it doesn't matter if he scores.\n\n\"Nothing surprises me with him. He controls the game well, passes the ball well, he is a good finisher, he can press and recover the ball.\n\n\"He sees passes that most people can only see whilst watching the game on TV or in the stands, not ones that you can normally see on the field.\"",
     "classes": [
      {
       "label": "football",
       "score": 0.094
      },
      {
       "label": "baseball",
       "score": 0.052
      },
      {
       "label": "basketball",
       "score": 0.03
      },
      {
       "label": "rugby",
       "score": 0.012
      }
     ]
    }

Which tells us the article is semantically closer to football than baseball, basketball or rugby.