An algorithm provides scores between 0.0 (no match) to 1.0 (perfect match) for a comparison of two strings.
The algorithm is designed for auto-completion. For string similarity, please check Levenshtein distance (Wagner–Fischer algorithm).
Usage
Include the library:
from stringscore import liquidmetal
Score any string against an abbreviation:
>>> liquidmetal.score('FooBar', 'foo')
0.95
>>> liquidmetal.score('FooBar', 'fb')
0.916666666667
>>> liquidmetal.score('Foo Bar', 'fb')
0.928571428571
>>> liquidmetal.score('Foo Bar', 'baz')
0.0
>>> liquidmetal.score('Foo Bar', '')
0.8
Similar Works
Quicksilver’s scoreForAbbreviation algorithm by Alcor (Blacktree, Inc)
LiquidMetal by Ryan McGeary
string_score by Joshaven Potter
License
String Score is released under the MIT License.
Credits
Copyright © 2003 Blacktree, Inc (Original author of Quicksilver)
Copyright © 2009 Ryan McGeary (Author of LiquidMetal)
Copyright © 2013 Grey Lee
History
0.1.0 (2013-02-25)
First release.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stringscore-0.1.0.tar.gz
(4.9 kB
view details)
File details
Details for the file stringscore-0.1.0.tar.gz.
File metadata
- Download URL: stringscore-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa05026df6e8d871d0ea40c55e04641c1508853d8c07deb907a160527d8a2132
|
|
| MD5 |
b01a4af7d15723d236a5db1b1b979ea3
|
|
| BLAKE2b-256 |
1a02978764e3a58a6ab74297dffa4e85559c7cd548dea06e8ac0118f8fd0b974
|