General Usage

The SoundsLike Phonetic Tokenizer for .Net applications is a phonetic normalization function that converts your customer names (or any text) into a numeric value that represents how it's pronounced.

By querying against these numbers, you will enrich your database searches and your applications will get around the problem of finding data that has different spellings or finding data that has similar or identical pronunciation. 

Copy the SoundsLike.dll and supporting SoundsLike.xml document (for intellesense) to your projects' BIN directory and add a Reference.

C#

TokenMaker objToken = new TokenMaker("*--- license key here ---*");

objToken.ProcessingFirstName = True;
objToken.StringToTokenize = "James";
if (objToken.IsValid) {
  myNarrow = objToken.TokenNarrow;
  myWide = objToken.TokenNarrow;
  myGroup = objToken.DiminutiveGroup;
}
else {
  strError = objToken.ErrorMessage;
  //Handle bad strings here
}


VB.NET

Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")
Dim myNarrow As Integer
Dim myWide As Integer
Dim myGroup As Integer

objToken.ProcessingFirstName = True
objToken.StringToTokenize = "James"

If objToken.IsValid Then
  myNarrow = objToken.TokenNarrow
  myWide = objToken.TokenNarrow
  myGroup = objToken.DiminutiveGroup
Else
  strError = objToken.ErrorMessage
  'Handle bad strings here
End If



TokenMaker "EqualsNarrow" Method

This function may be used if the TokenNarrow property is not stored in the database.  It can also be used for real-time compares of two words.  If you set ProcessingFirstName to 'True', diminutive checking will be enabled and you will get 'True' result for 'Dick' = 'Richard' even though they do not sound alike.

C#

//Initialize
TokenMaker objToken = new TokenMaker("*--- license key here ---*");
objToken.ProcessingFirstName = False;
   :
   :
//Loop processing
if (objToken.EqualsNarrow("yacht", "yawt")) {
  displayRecord = true;
}
else {
  displayRecord = false;
}
   :
   :


VB.NET

'Initialize
Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")
objToken.ProcessingFirstName = False
   :
   :
'Loop processing
If objToken.EqualsNarrow("diaphragm", "diafram") Then
  displayRecord = True
Else
  displayRecord = False
End If
   :
   :



TokenMaker "EqualsNickname" Method (new for version 1.2)

This function may used to check if two names match because they are in the same nickname group.  Only the first word of each string will be used.  The ProcessingFirstName property is ignored and assumed to be 'True'.  No phonetic matching will occur.

C#

TokenMaker objToken = new TokenMaker("*--- license key here ---*");

if (objToken.EqualsNickname("Robert Smith", "Bob Smith")) {
  //Names match; do something here
}
else {
  //Names do not match
}


VB.NET

Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")

If objToken.EqualsNickname("Dick Barnes", "Richard Barnes") Then
  'Names match; do something here
Else
  'Names do not match
End If



Supplemental "SOUNDEX" Method (new for version 1.2)

SOUNDEX is a phonetic algorithm for indexing names by their sound when pronounced in English.  The basic aim is for names with the same pronunciation to be encoded to the same string so that matching can occur despite minor differences in spelling.  SOUNDEX is the most widely known of all phonetic algorithms.

C#

coming soon


VB.NET

Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")

Dim strSoundex As String

'Regular 4-byte length SOUNDEX token
strSoundex = objToken.sup_SOUNDEX("Antidisestablishmentarianism") 'returns A533

'Custom length SOUNDEX token
strSoundex = objToken.sup_SOUNDEX("Antidisestablishmentarianism", 6) 'returns A53322



Supplemental "Levenshtein Distance" Method (new for version 1.2)

Levenshtein Distance is a measure of the similarity between two strings.  The distance is the number of deletions, insertions, or substitutions required to transform the first string into the second.  The greater the Levenshtein Distance, the more different the strings are.  This is also sometimes called "Edit Distance."

C#

coming soon


VB.NET

Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")

Dim distance As Integer

distance = objToken.sup_LevenshteinDistance("Boland", "Coland") 'returns 1



Supplemental "Probability Of Match" Method (new for version 1.2)

This method returns a "Probability Of Match" percentage.  It compares portions of two strings and computes a percentage (does not use the Levenshtein Distance).  This is great for comparing mailing addresses to determine householding.  By packing the name, address, suite, city, state, zip and country into a single string separated by spaces, the following example below returned a 98.4% probability of match:

  • string1 = "Robert MacIntyre Q 5337 Likini St P/H 2806 Honolulu HI 96818 USA"
  • string2 = "Robert McIntyre P/H 2806 5337 Likini St Honolulu HI 96818 USA"

    and we were able to remove duplicate data from our database.  Very powerful.

    C#

    coming soon


    VB.NET

    Dim objToken As New SoundsLike.TokenMaker("*--- license key here ---*")

    Dim percent As Decimal

    percent = objToken.sup_ProbabilityOfMatch("Boland", "Coland") 'returns 85.7142857142857



    Calling the SoundsLike DLL from Visual Basic 6

    (only available for version 1.2)   Several steps are necessary to call .Net DLLs from VB6.  These instructions assume you have the .Net Framework (at least 1.1) installed and Visual Studio .Net (so you can open a .Net command prompt.)  Please follow these steps and be sure to contact us via the support page if you encounter any difficulties.

    1

    Extract the zip file and place the SoundsLike.DLL in the desired location.

    2

    Open a .Net Command Prompt window.  Usually found under Windows at: "Start" > "All Programs" > "Microsoft Visual Studio .NET 2003" > "Visual Studio .NET Tools" > "Visual Studio .NET 2003 Command Prompt"

    3

    Change directory to where the SoundsLike.DLL is located.

    4

    Run this command from the Command Prompt:
    tlbexp SoundsLike.dll /out:SoundsLike.tlb

    5

    Run this command from the Command Prompt:
    regasm /tlb=SoundsLike.tlb SoundsLike.dll

    6

    Run this command from the Command Prompt:
    gacutil /if SoundsLike.dll

    7

    Open your VB6 project.

    8

    Open the References window by selecting "Project" > "References..." from the tool bar.

    9

    Select "SoundsLike Phonetic Tokenizer" and click "OK".


    Visual Basic 6.0

    Dim objToken As SoundsLike.TokenMaker
    Set objToken = New SoundsLike.TokenMaker

    objToken.LicenseKey = "*--- license key here ---*"

    objToken.PreScrubbingEnabled = True
    objToken.ProcessingFirstName = True

    objToken.StringToTokenize = "Dick"

    Dim slNarrowToken As Long
    Dim slWideToken As Long
    Dim slNicknameGroup As Long
    Dim slErrorCode As Byte
    Dim slErrorMessage As String
    Dim slPOM As Double
    Dim slSOUNDEX As String
    Dim slDistance As Long

    slNarrowToken = objToken.TokenNarrow
    slWideToken = objToken.TokenWide
    slNicknameGroup = objToken.DiminutiveGroup
    slErrorCode = objToken.errorCode
    slErrorMessage = objToken.ErrorMessage

    slPOM = objToken.sup_ProbabilityOfMatch("Bollard", "Collard")

    slSOUNDEX = objToken.sup_SOUNDEX("Antidisestablishmentarianism") 'returns A533
    slSOUNDEX = objToken.sup_SOUNDEX("Antidisestablishmentarianism", 6) 'returns A53322

    slDistance = objToken.sup_LevenshteinDistance("Bollard", "Collard")

    If objToken.EqualsNarrow("diaphragm", "diafram") = True Then
      'The words sound like each other!
    End If

    If objToken.EqualsWide("yacht", "yawt") = True Then
      'The words sound like each other!
    End If

    If objToken.EqualsNickname("Robert", "Bob") = True Then
      'The first names match!
    End If



    Visual Basic 6 / SqlServer Case Study

    (only available for version 1.2)   Here is an example of how you can use the SoundsLike Tokenizer in a VB6 application.  These instructions assume you have the .Net Framework (at least 1.1) installed.  Please follow these steps and be sure to contact us via the support page if you encounter any difficulties.


    Table Creation Script

    CREATE TABLE [dbo].[tblTestPerson] (
     [CustomerID] [int] IDENTITY (1, 1) NOT NULL ,
     [Prefix] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [FirstName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [MiddleName] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [LastName] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [Suffix] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [TokenFirstName] [bigint] NULL ,
     [TokenLastName] [bigint] NULL ,
     [TokenNickNameGrp] [bigint] NULL ,
     [Credentials] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [Gender] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [DateOfBirth] [datetime] NULL ,
     [SSN] [char] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [PhotoURL] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [PhotoOnFile] [bit] NULL ,
     [PhotoShownOutside] [bit] NULL ,
     [SpouseName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [LastUpdated] [datetime] NULL ,
     [LastUpdatedBy] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ) ON [PRIMARY]
    GO

    ALTER TABLE [dbo].[tblTestPerson] WITH NOCHECK ADD
     CONSTRAINT [PK_tblTestPerson] PRIMARY KEY CLUSTERED
     (
      [CustomerID]
     ) ON [PRIMARY]
    GO

    ALTER TABLE [dbo].[tblTestPerson] ADD
     CONSTRAINT [DF_tblTestPerson_TokenFirstName] DEFAULT (0) FOR [TokenFirstName],
     CONSTRAINT [DF_tblTestPerson_TokenLastName] DEFAULT (0) FOR [TokenLastName],
     CONSTRAINT [DF_tblTestPerson_TokenNickNameGrp] DEFAULT (0) FOR [TokenNickNameGrp]
    GO


    Initial database load (pre-tokenizing existing data)

    Private Sub btnIntialLoad_Click() 
    
      '---------------------------------------------------------------------------
      'Create an instance of the SoundsLike Phonetic Tokenizer
      '---------------------------------------------------------------------------
      Dim objToken As SoundsLike.TokenMaker
      Set objToken = New SoundsLike.TokenMaker 
    
      objToken.LicenseKey = "*--- license key here ---*"
      objToken.PreScrubbingEnabled = True 
    
      Dim slTokenFirstName As Long
      Dim slTokenLastName As Long
      Dim slNicknameGroup As Long
      
      '---------------------------------------------------------------------------
      'Define and establish database connection
      '---------------------------------------------------------------------------
      Dim objConn As ADODB.Connection
      Dim objConnUpd As ADODB.Connection
      Dim objRs As ADODB.Recordset
      Dim strSQL As String 
    
      Set objConn = CreateObject("ADODB.Connection")
      Set objConnUpd = 
       CreateObject("ADODB.Connection")  Set
      
      objRs = CreateObject("ADODB.Recordset")
      objConn.ConnectionString= _
          "Driver={SQLServer};Server=SNDLK;Database=dbCustomer;UID=xxx;PWD=xxx;"
      objConn.CommandTimeout = 90 ' seconds
      objConn.ConnectionTimeout = 45 ' seconds
      
      objConn.Open
      objRs.ActiveConnection = objConn 
    
      objConnUpd.ConnectionString = objConn.ConnectionString
      objConnUpd.Open
      
      '---------------------------------------------------------------------------
      'Build SQL
      '---------------------------------------------------------------------------
      objSQL = "SELECT CustomerID, FirstName, LastName " _
             & "FROM dbo.tblTestPerson " _
             & "WHERE (TokenFirstName < 1) OR (TokenLastName < 1)"
              
      '---------------------------------------------------------------------------
      'Execute SQL
      '---------------------------------------------------------------------------
      Set objRs = CreateObject("ADODB.Recordset")
      objRs.ActiveConnection = objConn
      objRs.Open objSQL
        
      '---------------------------------------------------------------------------
      'Loop thru and tokenize all existing names already in the database
      ' ===This is a one-time operation to pre-tokenize existing data===
      '---------------------------------------------------------------------------
      While Not objRs.EOF
      
        'Tokenize the first name and get the nickname group (if any)
        objToken.ProcessingFirstName = True
        objToken.StringToTokenize = objRs("FirstName")
        slTokenFirstName = objToken.TokenNarrow
        slNicknameGroup = objToken.DiminutiveGroup
        If slNicknameGroup = -1 Then slNicknameGroup = 0 'Use 0 to indicate no nickname
      
        'Tokenize the last name
        objToken.ProcessingFirstName = False
        objToken.StringToTokenize = objRs("LastName")
        slTokenLastName = objToken.TokenNarrow
        
        strSQL = "Update tblTestPerson " _
               & "Set TokenFirstName = " & slTokenFirstName & "," _
               & "    TokenNickNameGrp = " & slNicknameGroup & "," _
               & "    TokenLastName = " & slTokenLastName & " " _
               & "Where CustomerID = " & objRs("CustomerID")
      
        objConnUpd.Execute strSQL
            
        objRs.MoveNext
      Wend
      
      '---------------------------------------------------------------------------
      'Clean up
      '---------------------------------------------------------------------------
      objRs.Close
      objConn.Close
      objConnUpd.Close 
    
      Set objRs = Nothing
      Set objConn = Nothing
      Set objConnUpd = Nothing
      Set objToken = Nothing 
    
    End Sub


    Processing the search in VB6

    Private Sub btnSearch_Click() 
    
      '---------------------------------------------------------------------------
      'Create an instance of the SoundsLike Phonetic Tokenizer
      '---------------------------------------------------------------------------
      Dim objToken As SoundsLike.TokenMaker
      Set objToken = New SoundsLike.TokenMaker 
    
      objToken.LicenseKey = "*--- license key here ---*"
      objToken.PreScrubbingEnabled = True
      objToken.ProcessingFirstName = True 
    
      Dim slTokenFirstName As Long
      Dim slTokenLastName As Long
      Dim slNicknameGroup As Long
      
      '---------------------------------------------------------------------------
      'Tokenize the first name the user is looking for
      '  and get the nickname group (if any)
      '---------------------------------------------------------------------------
      objToken.StringToTokenize = tbFirstName.Text
      If Not objToken.IsValid Then MsgBox (objToken.ErrorMessage) 'Testing
      slTokenFirstName = objToken.TokenNarrow
      slNicknameGroup = objToken.DiminutiveGroup
      
      '---------------------------------------------------------------------------
      'Tokenize the last name the user is looking for
      '---------------------------------------------------------------------------
      objToken.ProcessingFirstName = False
      If Not objToken.IsValid Then MsgBox (objToken.ErrorMessage) 'Testing
      objToken.StringToTokenize = tbLastName.Text
      slTokenLastName = objToken.TokenNarrow
    
    
      '---------------------------------------------------------------------------
      'Define and establish database connection
      '---------------------------------------------------------------------------
      Dim objConn As ADODB.Connection
      Dim objRs As ADODB.Recordset
      Dim strSQL As String 
    
      Set objConn = CreateObject("ADODB.Connection")
      Set objRs = CreateObject("ADODB.Recordset")
      
      objConn.ConnectionString = _
           "Driver={SQL Server};Server=SNDLK;Database=dbCustomer;UID=xxx;PWD=xxx;"
      objConn.CommandTimeout = 90 ' seconds
      objConn.ConnectionTimeout = 45 ' seconds
      
      objConn.Open
      objRs.ActiveConnection = objConn 
    
      '---------------------------------------------------------------------------
      'Build SQL - THIS IS HOW IT'S DONE RIGHT HERE > > >
      '  look for text matches AND numeric token matches
      '---------------------------------------------------------------------------
      objSQL = "SELECT FirstName, MiddleName, LastName, " _
             & "PhotoURL, PhotoOnFile, PhotoShownOutside, SpouseName " _
             & "FROM dbo.tblTestPerson " _
             & "WHERE  ( (FirstName = '" & Trim(tbFirstName.Text) & "') " _
             & "OR (TokenFirstName = " & slTokenFirstName & ") " _
             & "OR (TokenNickNameGrp = " & slNicknameGroup & ") ) " _
             & "AND    ( (LastName = '" & Trim(tbLastName.Text) & "') " _
             & "OR (TokenLastName = " & slTokenLastName & ") ) " _
             & "ORDER BY LastName, FirstName"
              
      '---------------------------------------------------------------------------
      'Execute SQL
      '---------------------------------------------------------------------------
      Set objRs = CreateObject("ADODB.Recordset")
      objRs.ActiveConnection = objConn
      objRs.Open objSQL
        
      '---------------------------------------------------------------------------
      'Process results
      '---------------------------------------------------------------------------
      While Not objRs.EOF
        'Load search result screen here
        objRs.MoveNext
      Wend
      
      '---------------------------------------------------------------------------
      'Clean up
      '---------------------------------------------------------------------------
      objRs.Close
      objConn.Close
      Set objRs = Nothing
      Set objConn = Nothing
      Set objToken = Nothing 
    
    End Sub


    Don't forget to tokenize new Customer data when it gets added.




    Frequently Asked Questions 


     
  • Home  |  About  |  Benefits  |  Online Demos  |  Download  |  Purchase  |  Support