A fuzzy matching & clustering library for python.
Go to file
Yomguithereal ddde336ff1 Ignoring .python-version 2020-09-21 12:39:30 +02:00
data Adding the split command 2018-08-22 17:44:42 +02:00
experiments Notes 2018-12-22 19:13:21 +01:00
fog Adding unidecode to transformations 2019-07-25 11:45:31 +02:00
test Fixing passjoin unit tests 2019-12-13 22:07:20 +01:00
.gitignore Ignoring .python-version 2020-09-21 12:39:30 +02:00
.travis.yml Better makefile 2018-08-23 16:36:41 +02:00
LICENSE.txt Fixing 2018-05-18 15:59:00 +02:00
MANIFEST.in Fixing setup to install without cython 2018-08-23 15:41:34 +02:00
Makefile Misc 2019-07-16 11:50:45 +02:00
Notes.md Notes 2018-12-22 19:13:21 +01:00
README.md hr 2018-06-01 19:59:24 +02:00
requirements.txt Adding missing requirements 2018-07-18 16:35:23 +02:00
setup.py More abstract 2019-04-16 17:07:19 +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.