ahocorasick_rs — это Python-обёртка над высокопроизводительной библиотекой на Rust aho-corasick, предназначенная для поиска сразу нескольких паттернов в строке. Работает быстрее и эффективнее, чем pyahocorasick.
import ahocorasick_rs
patterns = ["hello", "world"]
text = "hello world, hello!"
ac = ahocorasick_rs.AhoCorasick(patterns)
print(ac.find_matches_as_strings(text))
# ['hello', 'world', 'hello']
#Python #Rust #AhoCorasick #Regex #StaticAnalysis #DevTools #Search #PyPI #PythonTips #OpenSource #FastCode #TextProcessing #ahocorasick_rs
https://github.com/G-Research/ahocorasick_rs
Please open Telegram to view this post
VIEW IN TELEGRAM
GitHub
GitHub - G-Research/ahocorasick_rs: Check for multiple patterns in a single string at the same time: a fast Aho-Corasick algorithm…
Check for multiple patterns in a single string at the same time: a fast Aho-Corasick algorithm for Python - G-Research/ahocorasick_rs
1 6⚡2🔥2 1