LogoLogo
  • Welcome to Tailent Automation Platform documentation
    • Start for Free
  • Getting Started
    • State Machine Approach
    • TAP Studio
      • How to install TAP Studio
      • TAP Studio Overview
      • Variables and Data Types
      • Transitions
        • Normal transitions
        • Exception transitions
      • How to Create a New Automation Project in TAP Studio
      • How to add an Activity to Favorites
      • How to Open an Existing Automation Project in TAP Studio
      • How to Save an Automation Project
      • Control Identifiers in UI Browser
      • List of Activities that use Control Identifier as Input Parameter
      • Press Key - Values of Key parameter
      • Outlook vs standard IMAP protocol
      • Hardware & Software Requirements TAP Studio
    • TAP Assistant
      • Basic Scheduling
      • Setting Custom Log Sizes
    • TAP Frequenty Asked Questions
  • Actions
    • TAP Actions
      • CSV
        • Append CSV
        • Read CSV
        • Write CSV
      • Application
        • Kill Process
        • Start Process
        • Wait for Control
      • Clipboard
        • Get Clipboard Text
        • Set Clipboard Text
      • Control
        • If Control Exists
        • Wait for Control to Disappear
        • Check Control
        • Select List Item
        • Set Focus
        • Set Text
        • Get Value
        • Get Native Value
        • Get Window State
        • Set Window State
      • Custom
        • C# Script
      • Data
        • JSON Deserialization
      • Database
        • Connect To Database
        • Database Query
        • Database Non Query
        • Disconnect From Database
      • Diagram
        • Invoke Workflow
        • Sequence
      • Direct text
        • Click Text
        • Extract Direct Text
      • Excel
        • Write Table
        • Set Range Color
        • Rename Sheet
        • Read Range
        • Read Cell Formula
        • Insert Rows
        • Insert Columns
        • Format Range
        • Fill Rows
        • Fill Columns
        • Delete Sheet
        • Delete Rows
        • Delete Columns
        • Create Sheet
        • Clear Range
        • Open Excel WorkBook
        • Close Excel WorkBook
        • Get Cell Value
        • Set Cell Value
      • Flow
        • Assign Value
        • Show Message Box
        • Wait
      • Loging
        • Log to FIle
        • Write to Console
      • IO
        • Copy File
        • Create Directory
        • Create File
        • Delete Directory
        • Delete File
        • Move File
        • Read Text File
        • Write To File
      • Keyboard
        • Press Key
        • Type Text
        • Type Password
      • Mail
        • Get Email Messages
        • Move Mail Message
        • Save Email Attachment
        • Get Outlook 365 Emails
        • Save Outlook 365 Attachments
      • Mouse
        • Click Control
        • Click Point
        • Move Mouse
        • Move to Control
        • Click Image
      • Office
        • Word.Replace
        • Get Word Page Count
      • PDF
        • Extract Sections from PDF
        • Get PDF Page Count
        • Read text from PDF
      • UI
        • Assign Control Identifier
      • User
        • Choose File
        • Choose Folder
        • User Input Dialog
      • Visual
        • Get Image
        • Extract Text
      • Web
        • Wait for Page
        • Run JavaScript
        • Wait for Element Attribute
        • Set Element Text
        • Get HTML Element
        • Open Browser
        • Click Element
        • Get HTML
        • HTTP REST Request
      • ZIP
        • Add to ZIP
        • Extract ZIP
  • TAP Release Updates
    • Release Updates
      • TAP Release Notes 24.8
      • TAP Release Notes 24.01
      • TAP Release Notes 21.12
      • TAP Release Notes 21.10
      • TAP Release Notes 21.06
      • TAP Release Notes 21.04
      • TAP Release Notes 21.02
      • TAP Release Notes 20.12
      • TAP Release Notes 20.11
      • TAP Release Notes 20.09
  • Use Cases
    • Use Cases
      • TAP Studio - Define Invoices Naming Convention
      • TAP Studio - Extract Accounting Data from Invoices
      • TAP Studio - Control Identifier Fine Tuning
      • TAP Studio - Move File
      • TAP Studio - Download Invoices from Email and Move Emails
      • TAP Studio - How to input invoice data into an Accounting System
      • TAP Studio - How to open all desired files of a certain type in a folder
      • TAP Studio - How to parse a custom excel date format without errors
  • Knowledge Base
  • Scripting Utility Classes
    • Tailent.Control Class
      • Tailent.Control.ControlExists
    • Tailent.Console Class
      • Tailent.Console.WriteLine
    • Tailent.StringUtils Class
      • Tailent.StringUtils.FuzzSetMatching
    • Common Scripts Repository
      • C# Scripts Repository
        • Read Excel
        • Write Excel
        • Add LOV in Excel
        • Change Excel Cell Color
        • RegexSplit (Text Filtering)
        • Start a process
        • Filter HTML Contents
        • Reading CSV Contents
        • LINQ Filtering
        • Data Conversion
          • Double to DateTime
  • Solution Migration
  • Microsoft 365 Automation
    • Creating an application Instance
  • Remote Desktop Automation
    • Setting up the remote context
  • Knowledge Base
    • Configuring Proxy Servers
    • tap.runtime.config - Debug flag
    • Unblocking Action .dll Files
Powered by GitBook
On this page

Was this helpful?

  1. Scripting Utility Classes
  2. Tailent.StringUtils Class

Tailent.StringUtils.FuzzSetMatching

This method matches a given string to a given string dataset, using a set of fuzzy text matching algorithms. This is more useful than traditional exact string matching when the provided string is not an exact match with one from the dataset.

Given the following example dataset:

“Apple Inc.” , “IBM”, “Oracle Ltd.”

If we are trying to locate “Apple Inc.” from the dataset using traditional string matching, we would need to look for the exact same string. Using the FuzzSetMatching method, we can specify a partial or incomplete string to look for matches within the dataset - for instance, we could just look for “Apple” or “App” and we would still get a match. This also works if the target item from the dataset starts differently (for instance, “Apple” would still match with “2020 Apple Inc.”).

The way the method works is simple - it will analyze every item in the dataset and provide a score between 0 and 100 to every item (higher means better match). After the scoring phase is complete, a shortlist is built and any items from a dataset with a score lower than the specified threshold are discarded. The remaining items are considered good matches and the one with the highest score will be returned.

Usage

The method can be called within C# Script actions blocks, using the following syntax:

string Tailent.StringUtils.FuzzSetMatching(string TargetString, 
IEnumerable<string> DataSet, int Threshold = 75, bool MatchCase = false)

Returns

The best matching string from the dataset (according to the set threshold) or null if the dataset is empty, or no strings from the dataset received a score larger than the threshold.

Parameters

string TargetString - the partial string used for searching.

IEnumerable<string> DataSet - any IEnumerable string collection, representing the dataset that will be searched.

int Threshold - (OPTIONAL) an integer value representing the minimum score required to consider candidates. The higher the score, the more exact the match has to be. This needs to be adjusted depending on dataset consistency and usage scenarios. Default value is 75.

bool MatchCase - (OPTIONAL) a boolean value specifying if the matching process should be case sensitive or not. Default value is false.

Example usage

Tailent.StringUtils.FuzzSetMatching(Partner, Partners.Keys.Cast<string>(), 85);

The above example does a case-insensitive search for the string stored in the Partner variable (string), within the dataset (Partners variable of type Dictionary<string, string>). With the dataset being a dictionary, it has to be cast to a list of string (hence the .Cast call). The matching threshold is set to 85 in this case, to force a more exact matching.

PreviousTailent.StringUtils ClassNextCommon Scripts Repository

Last updated 1 year ago

Was this helpful?