1.1 - 8.10 - StringSimilarity_MLE Example: Compare src_text2 to tar_text - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Published
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

Input

SQL Call

SELECT * FROM StringSimilarity_MLE (
  ON strsimilarity_input PARTITION BY ANY
  USING
  ComparisonColumnPairs ('jaro (src_text2, tar_text) AS jaro2_sim',
                         'LD (src_text2, tar_text, 2) AS ld2_sim',
                         'n_gram (src_text2, tar_text, 2) AS ngram2_sim',
                         'jaro_winkler (src_text2, tar_text) AS jw2_sim'
  )
  CaseSensitive ('true')
  Accumulate ('id', 'src_text2', 'tar_text')
) AS dt ORDER BY id;

Output

 id src_text2      tar_text       jaro2_sim          ld2_sim            ngram2_sim         jw2_sim            
 -- -------------- -------------- ------------------ ------------------ ------------------ ------------------ 
  2 fone           phone          0.7833333333333333                0.6                0.5 0.7833333333333333
  3 acquire        acquiesce      0.8412698412698413 0.6666666666666666                0.5 0.9047619047619048
  4 cccgggaaccaacc ccagggaaacccac 0.8754578754578755 0.7142857142857143 0.6923076923076923 0.9003663003663004
  5 allen          allies         0.8222222222222223 0.6666666666666666                0.4 0.8755555555555556
  6 angle          angels         0.8777777777777779 0.6666666666666666                0.4 0.9144444444444445
  7 center         centre         0.9444444444444445 0.6666666666666666                0.6 0.9666666666666667
  8 cheap          chief          0.7333333333333334                0.4               0.25 0.7866666666666667
  9 circle         circuit         0.746031746031746 0.5714285714285714                0.5 0.8476190476190476
 10 debut          debris         0.7000000000000001                0.5                0.4               0.79
 11 dell           lead                          0.5               0.25                0.0                0.5
 12 bear           bear                          1.0                1.0                1.0                1.0

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