https://github.com/soenneker/soenneker.utils.string.trie
A utility library for comparing strings via trie (prefix tree) similarity
https://github.com/soenneker/soenneker.utils.string.trie
csharp dotnet prefix similarity string tree trie triesimilaritystringutil util utils
Last synced: 4 months ago
JSON representation
A utility library for comparing strings via trie (prefix tree) similarity
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.utils.string.trie
- Owner: soenneker
- License: mit
- Created: 2024-05-14T01:32:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-07T14:16:07.000Z (4 months ago)
- Last Synced: 2026-03-07T19:32:11.743Z (4 months ago)
- Topics: csharp, dotnet, prefix, similarity, string, tree, trie, triesimilaritystringutil, util, utils
- Language: C#
- Homepage: https://soenneker.com
- Size: 1.03 MB
- Stars: 1
- Watchers: 1
- 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.trie/)
[](https://github.com/soenneker/soenneker.utils.string.trie/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.utils.string.trie/)
[](https://github.com/soenneker/soenneker.utils.string.trie/actions/workflows/codeql.yml)
#  Soenneker.Utils.String.Trie
### A utility library for comparing strings via trie (prefix tree) similarity
## Installation
```
dotnet add package Soenneker.Utils.String.Trie
```
## Why?
Imagine you have two strings. Trie-based matching helps you figure out how similar they are by looking at the prefixes they share. Here's why it's handy:
## Easy to Understand:
Trie-based matching is straightforward. It helps identify common prefixes between two strings, providing an intuitive measure of similarity.
## Not Bothered by Length:
Whether a string is long or short doesn't throw off trie-based matching. It cares more about the common prefixes than the total length of the strings.
## Efficient for Big Tasks:
When you're dealing with lots of strings or large texts, trie-based matching is efficient. It quickly identifies common prefixes without getting bogged down by complicated calculations, making it a practical choice for large datasets.
## Usage
```csharp
string str1 = "hello";
string str2 = "hell";
double similarity = TrieStringSimilarityUtil.CalculateSimilarityPercentage(str1, str2); // 80
```