Skip to main content

Python bindings for the Rust `fst` crate, providing sets and maps backed by finite state transducers.

Project description

appveyor
travis
Python bindings for burntsushi’s fst crate (rustdocs)
for FST-backed sets and maps.
For reasons why you might want to consider using it, see BurntSushi’s great

tl;dr:

  • Work with larger-than-memory sets

  • Perform fuzzy search using Levenshtein automata

Installation

  • You will need:

    • Python >= 3.3, Python or PyPy >= 2.7 with development headers installed

    • Rust nightly (install via rustup)

  • Clone the repository. Installation with pip install git+... does not work currently

  • Run rustup override add nightly to add an override for rustup to use the nightly channel for the repository

  • Run python setup.py bdist_wheel to generate a wheel

  • Install the wheel with pip install dist/rust_fst-0.1-py3-none-any.whl

Status

The package exposes almost all functionality of the fst crate, except for:

  • Combining the results of slicing, search and search_re with set operations

  • Using raw transducers

Examples

from rust_fst import Map, Set

# Building a set in memory
keys = ["fa", "fo", "fob", "focus", "foo", "food", "foul"]
s = Set.from_iter(keys)

# Fuzzy searches on the set
matches = list(s.search(term="foo", max_dist=1))
assert matches == ["fo", "fob", "foo", "food"]

# Searching with a regular expression
matches = list(s.search_re(r'f\w{2}'))
assert matches == ["fob", "foo"]

# Store map on disk, requiring only constant memory for querying
items = [("bruce", 1), ("clarence", 2), ("stevie", 3)]
m = Map.from_iter(items, path="/tmp/map.fst")

# Find all items whose key is greater or equal (in lexicographical sense) to
# 'clarence'
matches = dict(m['clarence':])
assert matches == {'clarence': 2, 'stevie': 3}

Documentation

Head over to readthedocs.org for the API documentation.

If you want to know more about performance characteristics, memory usage
and about the implementation details, please head over to the

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

rust-fst-0.1.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distributions

rust_fst-0.1.2-py2.py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 2 Python 3 Windows x86-64

rust_fst-0.1.2-py2.py3-none-win32.whl (1.2 MB view details)

Uploaded Python 2 Python 3 Windows x86

rust_fst-0.1.2-py2.py3-none-manylinux1_x86_64.whl (1.0 MB view details)

Uploaded Python 2 Python 3

rust_fst-0.1.2-py2.py3-none-macosx_10_9_x86_64.whl (858.1 kB view details)

Uploaded Python 2 Python 3 macOS 10.9+ x86-64

File details

Details for the file rust-fst-0.1.2.tar.gz.

File metadata

  • Download URL: rust-fst-0.1.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rust-fst-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e647e9ae1c38ae2e6f6967ea7bb9075bb06c020e5d0f344f4182786040105886
MD5 e41fafcdd3f77a68fcf71dd756aa582d
BLAKE2b-256 fb88db1427d446119800e00c6e01bd2ffc2cab6babe39e84a014e6afef4a9b22

See more details on using hashes here.

File details

Details for the file rust_fst-0.1.2-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for rust_fst-0.1.2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 04c3bcd57ed20688d885e220c0e83df69b956c929b3e1c12ed8431effa3a1e52
MD5 472fd4fab195a7e2ea81c665014d74a7
BLAKE2b-256 c09da116a1eb984c4798d8386f8366147b0a2e8562d7386f23db6327a0b007ee

See more details on using hashes here.

File details

Details for the file rust_fst-0.1.2-py2.py3-none-win32.whl.

File metadata

File hashes

Hashes for rust_fst-0.1.2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 5ea0461726d0f044a32ae39620ab93762a0cefd0c7a825a36eff59f9d3c4f508
MD5 9c9b5711635164b4ece93766cb6744f1
BLAKE2b-256 cd243e47451113ab401be513e8ed64023d7c96c2203a4e1493155e9cf44b4fc4

See more details on using hashes here.

File details

Details for the file rust_fst-0.1.2-py2.py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rust_fst-0.1.2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0ee2261e89264709d8ef040965c12538bb3b7db89ee00e22f8816d19c86295ce
MD5 3fbbad58a6af001dd674df77973bf808
BLAKE2b-256 f264d8aba6d4bc2193377359086062af8367afb3d8726774fe4750f00c07653a

See more details on using hashes here.

File details

Details for the file rust_fst-0.1.2-py2.py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rust_fst-0.1.2-py2.py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb4107866472df3ed878e714726e59764867c8262b353206c812ef38c1ebb0ad
MD5 0db7410521722f2602ca166e669fde3c
BLAKE2b-256 231242db4ee067877f1a9be3f4f2c1c70499036c45ab2dd0abb44b329ee66756

See more details on using hashes here.

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