Get element by fuzzy key from dict
Project description
Dict extension - get_fuzzy
Get element by fuzzy key from dict.
Introduction
The library is extension for buildin type dict
. After import you can use get_fuzzy
and get_fuzzy_stats
like get
method.
The minimum required python-3.4
Installing
This library can be install from pip:
pip install dict-extend-fuzzy
Usage
Simple example
from dictextendfuzzy import get_fuzzy
data = {
'aaaa' : 1,
'bbbb' : 2
}
data.get_fuzzy('aaab') # 1
Get some more information
from dictextendfuzzy import get_fuzzy_stats
data = {
'aaaa' : 1,
'bbbb' : 2
}
obj = data.get_fuzzy_stats('aaab')
obj.key # 'aaaa'
obj.value # 1
obj.ratio # 0.75
With optional parameters
data.get_fuzzy('kei', 'default_object', level=0.5)
data.get_fuzzy_stats('kay', {}, level=0.25)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dict_extend_fuzzy-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85738f781833aef4353f5b97350e85e6da8871bfd4e19f41f488199da7cf45a |
|
MD5 | ada6f944f8495c98b5414bd0fd9707bf |
|
BLAKE2b-256 | dc5f2ecf30745adf8707da69a7d5c8eda731bb045379f132831cea9513ace477 |