Skip to main content

# About ACAutomaton Python Package High-performance multi-string lookup data structure

# Notice 1. If you want to insert unicode string, please encode them to byte string first. 2. Once you insert a new word to ACAutomaton, please remember call build method. You can call build method multiple times.

# Install

pip install ACAutomaton

# Usage

>>> from ACAutomaton import ACAutomaton
>>> a = ACAutomaton()
>>> a.insert('11')
>>> a.insert('22')
>>> a.insert('33')
>>> a.build()
>>> a.matchOne('0011222333')
(2, '11')
>>> a.matchOne('00')
(-1, None)
>>> a.matchAll('0011222333')
[(2, '11'), (4, '22'), (5, '22'), (7, '33'), (7, '33'), (8, '33'), (8, '33')]

example for unicode string

>>> from ACAutomaton import ACAutomaton
>>> a = ACAutomaton()
>>> a.insert('你好')
>>> a.insert('你坏')
>>> a.insert('你')
>>> a.build()
>>> a.matchOne('你好你坏你')
(0, '\xe4\xbd\xa0')
>>> a.matchAll('你好你坏你不存在')
[(0, '\xe4\xbd\xa0'), (0, '\xe4\xbd\xa0\xe5\xa5\xbd'), (6, '\xe4\xbd\xa0'), (6, '\xe4\xbd\xa0\xe5\x9d\x8f'), (12, '\xe4\xbd\xa0')]
>>> a.matchAll('不存在')
[]
>>> a.insert('不存在')
>>> a.build()
>>> a.matchAll('不存在')
[(0, '\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8')]

Metadata

Release files for ACAutomaton 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ACAutomaton 1.0.3
File Size Uploaded Provenance
ACAutomaton-1.0.3.tar.gz 3.8 kB Without provenance Details

Release files / ACAutomaton-1.0.3.tar.gz

Download URL ACAutomaton-1.0.3.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b09281ee10ef3b9f3b0c4f55074ac32129024b60c5909e1ca970a72dad60847f
BLAKE2b-256 checksum
How to use checksums
9a2b06697f1a3f3d830d08773302b0251d41bcb21d5cea608345b493df727c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Security for ACAutomaton 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page