Giter VIP home page Giter VIP logo

acautomation's Introduction

About

ACAutomation Python Package

Install

pip install ACAutomation

Usage

>>> from ACAutomation import ACAutomation
>>> a = ACAutomation()
>>> 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')]

If you want to insert unicode string, please encode them to string first.

>>> from ACAutomation import ACAutomation
>>> a = ACAutomation()
>>> a.insert('你好')
>>> a.insert('你坏')
>>> a.insert('你')
>>> a.build()
>>> a.matchOne('你好你坏你')
(0, '\xe4\xbd\xa0'd)
>>> 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')]

Once you insert a new word to ACAutomation, please remember call build method. You can call build method multiple times.

acautomation's People

Contributors

dingyaguang117 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.