Skip to main content

Bag of Factors allow you to analyze a corpus from its self_factors.

Project description

Bag of Factors

PyPI Status Build Status Documentation Status Code Coverage

Bag of Factors allow you to analyze a corpus from its factors.

Features

Feature Extraction

The feature_extraction module mimicks the module https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text with a focus on character-based extraction.

The main differences are:

  • it is slightly faster;

  • the features can be incrementally updated;

  • it is possible to fit only a random sample of factors to reduce space and computation time.

The main entry point for this module is the CountVectorizer class, which mimicks its scikit-learn counterpart (also named CountVectorizer). It is in fact very similar to sklearn’s CountVectorizer using char or char_wb analyzer option from that module.

Fuzz

The fuzz module mimicks the fuzzywuzzy-like packages like

The main difference is that the Levenshtein distance is replaced by the Joint Complexity distance. The API is also slightly change to enable new features:

  • The list of possible choices can be pre-trained (fit) to accelerate the computation in the case a stream of queries is sent against the same list of choices.

  • Instead of one single query, a list of queries can be used. Computations will be parallelized.

The main fuzz entry point is the Process class.

Getting Started

Look at examples from the reference section.

Credits

This package was created with Cookiecutter and the francois-durand/package_helper_2 project template.

History

0.3.5 (2021-04-08): ARM64

  • Attempt to update PyPi with Mac M1 compatible wheels.

0.3.4 (2021-01-05): Cleaning

  • Renaming process.py to fuzz.py to emphasize that the module aims at being an alternative to the fuzzywuzzy package.

  • Removed modules FactorTree and JC. What they did is now essentially covered by the feature_extraction and fuzz modules.

  • General cleaning / rewriting of the documentation.

0.3.3 (2021-01-01): Cython/Numba balanced

  • All core CountVectorizer methods ported to Cython. Roughly 2.5X faster than sklearn counterpart (mainly because some features like min_df/max_df are not implemented).

  • Process numba methods NOT converted to Cython as Numba seems to be 20% faster for csr manipulation.

  • Numba functions are cached to avoid compilation lag.

0.3.2 (2020-12-30): Going Cython

  • First attempt to use Cython

  • Right now only the fit_transform method of CountVectorizer has been cythonized, for testing wheels.

  • If all goes well, numba will probably be abandoned and all the heavy-lifting will be in Cython.

0.3.1 (2020-12-28): Simplification of core algorithm

  • Attributes of the CountVectorizer have been reduced to the minimum: one dict!

  • Now faster than sklearn counterpart! (The reason been only one case is considered here so we can ditch a lot of checks and attributes).

0.3.0 (2020-12-15): CountVectorizer and Process

  • The core is now the CountVectorizer class. Lighter and faster. Only features are kept inside.

  • New process module inspired by fuzzywuzzy!

0.2.0 (2020-12-15): Fit/Transform

  • Full refactoring to make the package fit/transform compliant.

  • Add a fit_sampling method that allows to fit only a (random) subset of factors

0.1.1 (2020-12-12): Upgrades

  • Docstrings added

  • Common module (feat. save/load capabilities)

  • Joint Complexity module

0.1.0 (2020-12-12): First release

  • First release on PyPI.

  • Core FactorTree class added.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bof-0.3.5.tar.gz (157.8 kB view hashes)

Uploaded Source

Built Distributions

bof-0.3.5-cp39-cp39-win_amd64.whl (245.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

bof-0.3.5-cp39-cp39-win32.whl (229.3 kB view hashes)

Uploaded CPython 3.9 Windows x86

bof-0.3.5-cp39-cp39-manylinux2010_x86_64.whl (663.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

bof-0.3.5-cp39-cp39-manylinux2010_i686.whl (636.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

bof-0.3.5-cp39-cp39-manylinux1_x86_64.whl (663.3 kB view hashes)

Uploaded CPython 3.9

bof-0.3.5-cp39-cp39-manylinux1_i686.whl (636.6 kB view hashes)

Uploaded CPython 3.9

bof-0.3.5-cp39-cp39-macosx_11_0_arm64.whl (242.8 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

bof-0.3.5-cp39-cp39-macosx_10_9_x86_64.whl (254.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

bof-0.3.5-cp39-cp39-macosx_10_9_universal2.whl (341.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

bof-0.3.5-cp38-cp38-win_amd64.whl (246.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

bof-0.3.5-cp38-cp38-win32.whl (229.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

bof-0.3.5-cp38-cp38-manylinux2010_x86_64.whl (683.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

bof-0.3.5-cp38-cp38-manylinux2010_i686.whl (654.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

bof-0.3.5-cp38-cp38-manylinux1_x86_64.whl (683.2 kB view hashes)

Uploaded CPython 3.8

bof-0.3.5-cp38-cp38-manylinux1_i686.whl (654.8 kB view hashes)

Uploaded CPython 3.8

bof-0.3.5-cp38-cp38-macosx_10_9_x86_64.whl (251.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

bof-0.3.5-cp37-cp37m-win_amd64.whl (243.2 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

bof-0.3.5-cp37-cp37m-win32.whl (226.8 kB view hashes)

Uploaded CPython 3.7m Windows x86

bof-0.3.5-cp37-cp37m-manylinux2010_x86_64.whl (621.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

bof-0.3.5-cp37-cp37m-manylinux2010_i686.whl (593.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

bof-0.3.5-cp37-cp37m-manylinux1_x86_64.whl (621.2 kB view hashes)

Uploaded CPython 3.7m

bof-0.3.5-cp37-cp37m-manylinux1_i686.whl (593.0 kB view hashes)

Uploaded CPython 3.7m

bof-0.3.5-cp37-cp37m-macosx_10_9_x86_64.whl (250.9 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

bof-0.3.5-cp36-cp36m-win_amd64.whl (241.9 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

bof-0.3.5-cp36-cp36m-win32.whl (225.6 kB view hashes)

Uploaded CPython 3.6m Windows x86

bof-0.3.5-cp36-cp36m-manylinux2010_x86_64.whl (620.1 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

bof-0.3.5-cp36-cp36m-manylinux2010_i686.whl (592.0 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

bof-0.3.5-cp36-cp36m-manylinux1_x86_64.whl (620.1 kB view hashes)

Uploaded CPython 3.6m

bof-0.3.5-cp36-cp36m-manylinux1_i686.whl (592.0 kB view hashes)

Uploaded CPython 3.6m

bof-0.3.5-cp36-cp36m-macosx_10_9_x86_64.whl (249.8 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page