https://github.com/soenneker/soenneker.utils.string.longestcommonsequence
A utility library for comparing strings via the Longest Common Sequence algorithm
https://github.com/soenneker/soenneker.utils.string.longestcommonsequence
common comparison csharp dotnet fuzzy lcsstringutil longest longestcommonsequence matching sequence similarity string utils
Last synced: 2 months ago
JSON representation
A utility library for comparing strings via the Longest Common Sequence algorithm
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.utils.string.longestcommonsequence
- Owner: soenneker
- License: mit
- Created: 2024-01-01T00:13:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-29T23:49:43.000Z (2 months ago)
- Last Synced: 2025-07-30T01:48:37.735Z (2 months ago)
- Topics: common, comparison, csharp, dotnet, fuzzy, lcsstringutil, longest, longestcommonsequence, matching, sequence, similarity, string, utils
- Language: C#
- Homepage: https://soenneker.com
- Size: 1.08 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.utils.string.longestcommonsequence/)
[](https://github.com/soenneker/soenneker.utils.string.longestcommonsequence/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.utils.string.longestcommonsequence/)#  Soenneker.Utils.String.LongestCommonSequence
### A utility library for comparing strings via the Longest Common Sequence algorithm## Installation
```
dotnet add package Soenneker.Utils.String.LongestCommonSequence
```## Why?
### Clarity in Similarity:
LCS gives a straightforward measure of similarity. The longer the common subsequence, the more similar the sequences.### Length-Flexible:
No bias for longer or shorter sequences. Focuses on shared elements, not sequence length.### Meaningful Over Quantity:
Emphasizes the meaning of elements, not just their frequency. Great for identifying shared meaningful content.### Efficient for Big Data:
Handles large datasets and extensive sequences efficiently. Practical for tasks involving substantial amounts of data.## Usage
```csharp
var text1 = "This is a test";
var text2 = "This is another test";double result = LcsStringUtil.CalculateSimilarityPercentage(text1, text2); // 70
```