A fuzzy matching & clustering library for python.
Go to file
Yomguithereal aa7126f791 New bench 2018-07-06 19:00:57 +02:00
data CLI experimental endpoint 2018-06-22 17:57:25 +02:00
experiments New bench 2018-07-06 19:00:57 +02:00
fog Adding the skeleton key 2018-07-06 18:58:46 +02:00
test Adding the skeleton key 2018-07-06 18:58:46 +02:00
.gitignore Updating phylactery 2018-06-07 11:11:41 +02:00
.travis.yml Dropping 3.4 2018-07-05 17:44:00 +02:00
LICENSE.txt Fixing 2018-05-18 15:59:00 +02:00
Makefile Adding fog.phonetics.cologne 2018-07-04 17:06:43 +02:00
README.md hr 2018-06-01 19:59:24 +02:00
requirements.txt CLI experimental endpoint 2018-06-22 17:57:25 +02:00
setup.py Bump 0.4.0 2018-06-30 11:21:58 +02:00

README.md

Build Status

Fog

A fuzzy matching/clustering library for Python.

Installation

You can install fog with pip with the following command:

pip install fog

Usage

Metrics

sparse_cosine_similarity

Computes the cosine similarity of two sparse weighted sets. Those sets have to be represented as counters.

from fog.metrics import sparse_cosine_similarity

# Basic
sparse_cosine_similarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
>>> ~0.062

Arguments

  • A Counter: first weighted set. Must be a dictionary mapping keys to weights.
  • B Counter: second weighted set. Muset be a dictionary mapping keys to weights.

jaccard_similarity

Computes the Jaccard similarity of two arbitrary iterables.

from fog.metrics import jaccard_similarity

# Basic
jaccard_similarity('context', 'contact')
>>> ~0.571

Arguments

  • A iterable: first sequence to compare.
  • B iterable: second sequence to compare.

weighted_jaccard_similarity

Computes the weighted Jaccard similarity of two weighted sets. Those sets have to be represented as counters.

from fog.metrics import weighted_jaccard_similarity

# Basic
weighted_jaccard_similarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
>>> ~0.026

Arguments

  • A Counter: first weighted set. Must be a dictionary mapping keys to weights.
  • B Counter: second weighted set. Muset be a dictionary mapping keys to weights.