StringSimilarity Example 2: Compare src_text2 to tar_text - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantage™

Input

SQL Call

SELECT * FROM StringSimilarity (
  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, 2) 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
1 astter aster 0.944444444444445 0.833333333333333 0.8 0.961111111111111
2 fone phone 0.783333333333333 0.6 0.5 0.783333333333333
3 acquire acquiesce 0.841269841269841 0.666666666666667 0.5 0.904761904761905
4 CCCGGGAACCAACC CCAGGGAAACCCAC 0.875457875457875 0.714285714285714 0.692307692307692 0.9003663003663
5 allen allies 0.822222222222222 0.666666666666667 0.4 0.875555555555556
6 angle angels 0.877777777777778 0.666666666666667 0.4 0.914444444444445
7 center centre 0.944444444444445 0.666666666666667 0.6 0.966666666666667
8 cheap chief 0.733333333333333 0.4 0.25 0.786666666666667
9 circle circuit 0.746031746031746 0.571428571428571 0.5 0.847619047619048
10 debut debris 0.7 0.5 0.4 0.79
11 dell lead 0.5 0.25 0 0.5
12 bear bear 1 1 1 1