fuzzywuzzy
pg-fuzzywuzzy · fuzzywuzzy ratio for postgres
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100107 | fuzzywuzzy | pg-fuzzywuzzy | 0.0.2 | FTS | PostgreSQL | SQL |
| Relationships | |
|---|---|
| Requires | fuzzystrmatch |
Usage
Sources:
fuzzywuzzy provides a single SQL-level similarity score for short text values. It wraps the Levenshtein distance from fuzzystrmatch and is useful for simple fuzzy ordering or filtering when a full search system is unnecessary.
Core Workflow
Install the extension, then call ratio(text, text) to obtain an integer score from 0 to 100:
The installation script creates fuzzystrmatch automatically when it is absent. Provision that dependency explicitly if extension creation is restricted in the target environment.
Object and Semantics
ratio(text, text)returns 100 for identical non-empty strings and 0 when either argument is NULL or empty.- The implementation derives its score from
levenshtein(text, text), the two input lengths, and an integer return value; it is inspired by fuzzywuzzy but does not expose the wider Python fuzzywuzzy API. - The function is declared
IMMUTABLE, and version0.0.2is relocatable.
The project is small and has no documented Unicode normalization, collation, length-limit, or indexing contract. Normalize text deliberately, test multibyte and long inputs, and avoid treating the score as a calibrated probability.