pattmatch

Implementation of some pattern matching algorithms


Keywords
pattern-matching, text, string, pattern, python3, boyer, moore, rabin, karp, kmp, python
Licenses
GPL-3.0/GPL-3.0+
Install
pip install pattmatch==0.0.2

Documentation

PATTMATCH

https://github.com/monzita/pattmatch/blob/master/pmatch.png

More algorithms can be found here

Documentation

It's here

Example

>>> from pattmatch import *
>>>
>>> kmp('ABCABC', 'ABC')
[[0, 3], [3, 6]]
>>> rabin_karb('ABCDAABC', 'ABC')
[[0, 3], [5, 8]]
>>> boyer_moore('AAABAAACAAD', 'AA')
[[0, 2], [1, 3], [4, 6], [5, 7], [8, 10]]
>>> z_array('ABCDAABBCAAAABBCAAAAABCA', 'AAAA')
[1, 0, 0, 0, 2, 1, 0, 0, 0, 4, 3, 2, 1, 0, 0, 0, 4, 4, 3, 2, 1, 0, 0, 1]

LICENCE

MIT