Communary.PASM

PowerShell Approximate String Matching and Fuzzy Search (by gravejester)

Communary.PASM Alternatives

We don't know any alternatives yet. If you know any, please suggest them below.

Communary.PASM discussion

Log in or Post with

Communary.PASM reviews and mentions

Posts with mentions or reviews of Communary.PASM. We have used some of these posts to build our list of alternatives and similar projects.
  • Stuck on a puzzle - Anagrams
    1 project | /r/PowerShell | 18 Oct 2022
    function Get-LevenshteinDistance { <# .SYNOPSIS Get the Levenshtein distance between two strings. .DESCRIPTION The Levenshtein Distance is a way of quantifying how dissimilar two strings (e.g., words) are to one another by counting the minimum number of operations required to transform one string into the other. .EXAMPLE Get-LevenshteinDistance 'kitten' 'sitting' .LINK http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C.23 http://en.wikipedia.org/wiki/Edit_distance https://communary.wordpress.com/ https://github.com/gravejester/Communary.PASM .NOTES Author: Øyvind Kallstad Date: 07.11.2014 Version: 1.0 #> [CmdletBinding()] param( [Parameter(Position = 0)] [string]$String1, [Parameter(Position = 1)] [string]$String2, # Makes matches case-sensitive. By default, matches are not case-sensitive. [Parameter()] [switch] $CaseSensitive, # A normalized output will fall in the range 0 (perfect match) to 1 (no match). [Parameter()] [switch] $NormalizeOutput ) if (-not($CaseSensitive)) { $String1 = $String1.ToLowerInvariant() $String2 = $String2.ToLowerInvariant() } $d = New-Object 'Int[,]' ($String1.Length + 1), ($String2.Length + 1) try { for ($i = 0; $i -le $d.GetUpperBound(0); $i++) { $d[$i,0] = $i } for ($i = 0; $i -le $d.GetUpperBound(1); $i++) { $d[0,$i] = $i } for ($i = 1; $i -le $d.GetUpperBound(0); $i++) { for ($j = 1; $j -le $d.GetUpperBound(1); $j++) { $cost = [Convert]::ToInt32((-not($String1[$i-1] -ceq $String2[$j-1]))) $min1 = $d[($i-1),$j] + 1 $min2 = $d[$i,($j-1)] + 1 $min3 = $d[($i-1),($j-1)] + $cost $d[$i,$j] = [Math]::Min([Math]::Min($min1,$min2),$min3) } } $distance = ($d[$d.GetUpperBound(0),$d.GetUpperBound(1)]) if ($NormalizeOutput) { Write-Output (1 - ($distance) / ([Math]::Max($String1.Length,$String2.Length))) } else { Write-Output $distance } } catch { Write-Warning $_.Exception.Message }

Stats

Basic Communary.PASM repo stats
1
41
10.0
almost 4 years ago

gravejester/Communary.PASM is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of Communary.PASM is PowerShell.


Sponsored
Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com