Open Day Presentation
BSc Implementation of Efficient Approximate String Matching Package for Python
Student
Desk
Initial task setting
Supervisor
Second Reader

g24-26

Keywords
Rust, PyO3, Python, agrep, string

Technologies
Rust, Python, PyO3, maturin, agrep

The agrep_rust tool is a Python package that brings agrep string matching capabilities to Python users. Unlike traditional command-line tools that only display results, agrep_rust returns match offsets directly to Python, enabling further programmatic processing.

Implemented in Rust, the library achieves C-level performance with Rust's inherent safety guarantees. The tool operates as a smart dispatcher: an engine builder analyzes user input (patterns, edit distance, case sensitivity etc.) and selects the optimal algorithm from implementations like fuzzy Bitap, Wu-Manber, Boyer-Moore, and wrappers for highly optimized Aho-Corasick, Regex, and Two-way matchers. Once preprocessed and constructed, engines can be used multiple times.

Currently supporting ASCII input for maximum performance, agrep_rust prioritizes throughput and speed of search. By combining Rust's speed with Python's flexibility, agrep_rust gives Python developers efficient, programmatic access string matching tool.