Gapotchenko.FX.Math.Metrics
2024.1.3
Prefix Reserved
dotnet add package Gapotchenko.FX.Math.Metrics --version 2024.1.3
NuGet\Install-Package Gapotchenko.FX.Math.Metrics -Version 2024.1.3
<PackageReference Include="Gapotchenko.FX.Math.Metrics" Version="2024.1.3" />
paket add Gapotchenko.FX.Math.Metrics --version 2024.1.3
#r "nuget: Gapotchenko.FX.Math.Metrics, 2024.1.3"
// Install Gapotchenko.FX.Math.Metrics as a Cake Addin #addin nuget:?package=Gapotchenko.FX.Math.Metrics&version=2024.1.3 // Install Gapotchenko.FX.Math.Metrics as a Cake Tool #tool nuget:?package=Gapotchenko.FX.Math.Metrics&version=2024.1.3
Overview
The module provides math metrics algorithms.
String Metrics
Gapotchenko.FX.Math.Metrics.StringMetrics
class provides a variety of algorithms for measuring the distance and similarity between two strings of symbols.
The notion of a string is purely abstract.
So it is not limited to just System.String
of characters; it can be a string of anything in the form of IEnumerable<T>
sequence of elements.
In this way, Gapotchenko.FX.Math.Metrics
module achieves the right degree of abstraction desirable for a versatile math toolkit.
Edit Distance
Edit distance is a string metric reflecting the minimum number of operations required to transform one string into the other. There are several ways to measure the edit distance.
The table below compares metric functions provided by StringMetrics
class:
Metric Function | Insertion | Deletion | Substitution | Transposition | Algorithm |
---|---|---|---|---|---|
Levenshtein distance | ✓ | ✓ | ✓ | StringMetrics.Distance.Levenshtein |
|
Longest common subsequence (LCS) distance | ✓ | ✓ | StringMetrics.Distance.Lcs |
||
Hamming distance | ✓ | StringMetrics.Distance.Hamming |
|||
Damerau–Levenshtein distance | ✓ | ✓ | ✓ | ✓ | StringMetrics.Distance.DamerauLevenshtein |
Optimal string alignment (OSA) distance | ✓ | ✓ | ✓ | ✓ | StringMetrics.Distance.Osa |
Jaro similarity | ✓ | StringMetrics.Similarity.Jaro |
Levenshtein Distance
StringMetrics.Distance.Levenshtein
algorithm allows you to calculate the Levenshtein distance between two strings of symbols.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
int distance = StringMetrics.Distance.Levenshtein.Calculate("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance); // distance = 2
Longest Common Subsequence (LCS) Distance
StringMetrics.Distance.Lcs
algorithm allows you to calculate the longest common subsequence (LCS) distance between two strings of symbols.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
int distance = StringMetrics.Distance.Lcs.Calculate("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance); // distance = 2
Hamming Distance
StringMetrics.Distance.Hamming
algorithm allows you to calculate the Hamming distance between two strings of symbols.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
int distance = StringMetrics.Distance.Hamming.Calculate("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance); // distance = 2
Please note that the Hamming distance can only be calculated between two string of an equal length.
Damerau-Levenshtein Distance
StringMetrics.Distance.DamerauLevenshtein
algorithm allows you to calculate the Damerau–Levenshtein distance between two strings of symbols.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
int distance = StringMetrics.Distance.DamerauLevenshtein.Calculate("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance); // distance = 1
Optimal String Alignment (OSA) Distance
StringMetrics.Distance.Osa
algorithm allows you to calculate the optimal string alignment (OSA) distance between two strings of symbols.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
int distance = StringMetrics.Distance.Osa.Calculate("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance); // distance = 1
Jaro Similarity
StringMetrics.Similarity.Jaro
algorithm allows you to calculate the Jaro distance between two strings of symbols.
Although the Jaro similarity is often referred to as an edit distance metric, its value does not represent a number of edit operations and varies between 0.0 and 1.0 such that 1.0 represents an exact match and 0.0 equates to no similarities.
Consider an example:
using Gapotchenko.FX.Math.Metrics;
double similarity = StringMetrics.Similarity.Jaro.Calculate("ABC", "BAC");
Console.WriteLine("Similarity is {0.00}.", similarity); // similarity = 0.36
Commonly Used Types
Gapotchenko.FX.Math.Metrics.StringMetrics
Other Modules
Let's continue with a look at some other modules provided by Gapotchenko.FX:
- Gapotchenko.FX
- Gapotchenko.FX.AppModel.Information
- Gapotchenko.FX.Collections
- Gapotchenko.FX.Console
- Gapotchenko.FX.Data
- Gapotchenko.FX.Diagnostics
- Gapotchenko.FX.IO
- Gapotchenko.FX.Linq
- Gapotchenko.FX.Math
- Gapotchenko.FX.Memory
- Gapotchenko.FX.Security.Cryptography
- Gapotchenko.FX.Text
- Gapotchenko.FX.Threading
- Gapotchenko.FX.Tuples
Or look at the full list of modules.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 is compatible. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.1
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETCoreApp 3.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETFramework 4.6.1
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETFramework 4.7.1
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETFramework 4.7.2
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETStandard 2.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
.NETStandard 2.1
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
net5.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
net6.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
net7.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
net8.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
-
net9.0
- Gapotchenko.FX.Collections (>= 2024.1.3)
- Gapotchenko.FX.Linq (>= 2024.1.3)
- Gapotchenko.FX.Math (>= 2024.1.3)
- Gapotchenko.FX.Math.Intervals (>= 2024.1.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Gapotchenko.FX.Math.Metrics:
Package | Downloads |
---|---|
Gapotchenko.FX.Profiles.Math
Represents the Math profile of Gapotchenko.FX. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2024.1.3 | 84 | 11/10/2024 |