1.1 - 8.10 - TextTagger Example: TaggingRules - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Teradata Vantage
Release Number
October 2019
Content Type
Programming Reference
Publication ID
English (United States)


id title content catalog
1 Chennai Floods Chennai floods have battered the capital city of Tamil Nadu and its adjoining areas. Normal life came to a standstill when roads were submerged in water and all modes of transport were severely affected. In the past, Chennai has had tsunamis and earthquakes Regional
2 Tennis Superstars Roger Federer born on 8 August 1981, is a greatest tennis player, who has been continuously ranked inside the top 10 since October 2002 and has won Wimbledon, USOpen, Australian and FrenchOpen titles mutiple times sports
3 Sports Rivalry The Federer Nadal rivalry, known by many as Fedal, is between two professional tennis players, Roger Federer of Switzerland and Rafael Nadal of Spain. They are currently engaged in a storied rivalry, which many consider to be the greatest in tennis history. They have played 34 times, most recently in the 2015 Swiss Indoors final, and Nadal leads their eleven-year-old rivalry with an overall record of 231 sports
4 Sports Rivalry The India Pakistan cricket rivalry is one of the most intense sports rivalries in the world. An India-Pakistan cricket match has been estimated to attract up to one billion viewers, according to TV ratings firms and various other reports. The 2011 World Cup semifinal between the two teams attracted around 988 million television viewers sports
5 Sports Rivalry An Ashes series is traditionally of five Tests, hosted in turn by England and Australia at least once every four years. As of August 2015, England hold the ashes, having won three of the five Tests in the 2015 Ashes series. Overall, Australia has won 32 series, England 32 and five series have been drawn. sports

SQL Call

SELECT * FROM TextTagger (
  ON text_inputs
  TaggingRules ('contain(content, "floods", 1,) or
          contain(content, "tsunamis", 1,) AS Natural-Disaster',
         'contain(content, "Roger", 1,) and
          contain(content, "Nadal", 1,) AS Tennis-Rivalry',
         'contain(title, "Tennis", 1,) and
          contain(content, "Roger", 1,) AS Tennis-Greats',
         'contain(content, "India", 1,) and
          contain(content, "Pakistan", 1,) AS Cricket-Rivalry',
         'contain(content,"Australia",1,) and
          contain(content, "England", 1,) AS The-Ashes'
  OutputByTag ('true')
  Accumulate ('id')
) AS dt ORDER BY id;


 id tag              
 -- ---------------- 
  1 Natural-Disaster
  2 Tennis-Greats   
  3 Tennis-Rivalry  
  4 Cricket-Rivalry 
  5 The-Ashes

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.