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.
## Installing
This library can be install from pip:
```bash
pip install dict-extend-fuzzy
```
## Usage
Simple example
```python
from dictextendfuzzy import get_fuzzy
data = {
'aaaa' : 1,
'bbbb' : 2
}
data.get_fuzzy('aaab') # 1
```
Get some more information
```python
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
```python
data.get_fuzzy('kei', 'default_object', level=0.5)
data.get_fuzzy_stats('kay', {}, level=0.25)
```
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.
## Installing
This library can be install from pip:
```bash
pip install dict-extend-fuzzy
```
## Usage
Simple example
```python
from dictextendfuzzy import get_fuzzy
data = {
'aaaa' : 1,
'bbbb' : 2
}
data.get_fuzzy('aaab') # 1
```
Get some more information
```python
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
```python
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
dict-extend-fuzzy-0.1.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for dict_extend_fuzzy-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abaac8628f0cbec7394080601c384b209ceaefc819e22156d613638b7fdef07b |
|
MD5 | 9828fe6b6e25e264d05a6d451adb5417 |
|
BLAKE2b-256 | ce5e9ca2cf682b00ad2d3fd6b92aafa193121692fd82bf5bfb0b77ef59b7dbf4 |