Skip to content

thepabloaguilar/floc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b5d6b0b · Oct 28, 2021

History

31 Commits
Oct 28, 2021
Oct 28, 2021
Oct 28, 2021
Oct 28, 2021
Oct 27, 2021
Apr 11, 2021
Apr 11, 2021
Apr 11, 2021
Oct 28, 2021
Apr 11, 2021
Oct 27, 2021
Apr 11, 2021
Apr 11, 2021
Oct 28, 2021
Apr 11, 2021

Repository files navigation

FLoC

Build Status Documentation Status Python Versions Coverage Status License Checked with mypy wemake python styleguide


Introduction

This is a Python wrapper of this implementation for FLoC written in go!

It's easy to calculate the CohortID using this lib, see the example below:

>>> from floc import simulate
>>> host_list = [
...     'www.nikkei.com',
...     'jovi0608.hatenablog.com',
...     'www.nikkansports.com',
...     'www.yahoo.co.jp',
...     'www.sponichi.co.jp',
...     'www.cnn.co.jp',
...     'floc.glitch.me',
...     'html5.ohtsu.org',
... ]
>>> simulate(host_list)
21454

By default, we'll use the SortingLshClusters from FLoC's 1.0.6 version. If you want to use other, just pass it to the function:

>>> from floc import simulate
>>> host_list = [
...     'www.nikkei.com',
...     'jovi0608.hatenablog.com',
...     'www.nikkansports.com',
...     'www.yahoo.co.jp',
...     'www.sponichi.co.jp',
...     'www.cnn.co.jp',
...     'floc.glitch.me',
...     'html5.ohtsu.org',
... ]
>>> sorting_cluster_data = "" # READ THE DATA FROM SOMEWHERE
>>> simulate(host_list, sorting_cluster_data)
21454

We also expose some other functions, see the documentation here