Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephangeorg/trigram-similarity
Determining the similarity of alphanumeric text based on trigram matching.
https://github.com/stephangeorg/trigram-similarity
ngrams postgres similarity text-similarity trigram trigrams
Last synced: about 1 month ago
JSON representation
Determining the similarity of alphanumeric text based on trigram matching.
- Host: GitHub
- URL: https://github.com/stephangeorg/trigram-similarity
- Owner: StephanGeorg
- License: mit
- Created: 2021-05-18T12:19:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-25T11:09:32.000Z (about 3 years ago)
- Last Synced: 2024-11-09T18:49:28.185Z (about 1 month ago)
- Topics: ngrams, postgres, similarity, text-similarity, trigram, trigrams
- Language: JavaScript
- Homepage:
- Size: 231 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trigram-similarity [![npm version](https://badge.fury.io/js/trigram-similarity.svg)](https://badge.fury.io/js/trigram-similarity)
The trigram-similarity module provides functions and operators for determining the similarity of alphanumeric text based on trigram matching.
This is the JavaScript implementation of Postgres [pg_trgm](https://www.postgresql.org/docs/13/pgtrgm.html) and returns a number that indicates how
similar the two arguments are.The range of the result is **zero** (indicating that the two strings are completely dissimilar) to **one** (indicating
that the two strings are identical).If you want to learn more about the concept see [this post](https://stackoverflow.com/a/43158586/1410482).
## Installation
```
npm i trigram-similarity
```## Usage
```javascript
import trigramSimilarity from 'trigram-similarity';
``````javascript
const similarity = trigramSimilarity('Chateau blanc', 'chateau cheval blanc');
// 0.7368421052631579
```