In aviation, if you think there’s going to be a problem with a landing or a take-off, you stop, pull away, and try again. There are two somewhat conflicting quotes that I love: If you can walk away from a landing, it’s a good landing. If you use the airplane the next day, it’s an […]
Month: September 2021
minHash implementation in PowerShell
Could not have done it without the Better Programming article. function minHash($a, $b, $shingleLength=3, [switch]$caseInsensitive=$False) { # adapted from https://betterprogramming.pub/identify-similarities-between-sentences-in-python-e9f71d454d1d function jaccardDistance($a, $b) { $toTest = [System.Collections.Generic.HashSet[string]] @($b) $intersect = [System.Collections.Generic.HashSet[string]] @($a) $intersect.IntersectWith($toTest) $union = [System.Collections.Generic.HashSet[string]] @($a) $union.UnionWith($toTest) if($union.Count -eq 0) { return $null } return $intersect.Count / $union.Count } function shingles($s, $len=3, [switch]$caseInsensitive=$False) { […]