Catalog PyPI
PACKAGE EXPLORERView in registry

ACAutomaton

PyPI

ACAutomaton python wrapper,support unicode

acac-automationautomation
Versions collected1
Direct dependencies0From release 1.0.3
Last observed20 Oct, 17:53 UTC

README

Version 1.0.3 documentation
# 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')]

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.33 Oct 20210

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
dingyaguang117/acautomaton

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:53 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fbca1fa93bfeeede35635b35f9c6d5044e906ec79a168ea4c5af4b00f83ed8b6