mhulsman / PySAIS

A Python C module wrapper around the SA-IS suffix array construction algorithm by Yuta Mori.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Python C module wrapper for the SA-IS algorithm implementation by Yuta Mori. Additionally includes an implementation of a linear LCP construction algirthm.

The idea to create a C module wrapper was inspired by the CTypes wrapper from David Hughes.

Installation:

./setup.py build
./setup.py test    # optional
./setup.py install

Example:

import pysais
import numpy as np

sequence = 'mississippi$'
sa = pysais.sais(sequence)
lcp, lcp_lm, lcp_mr = pysais.lcp(sequence, sa)

for off in sa :
    print '%3d : %s' % (off, sequence[off:])

array = np.array([2, 3, 1, 0], dtype = np.int32)
sa_int = pysais.sais_int(array, 4)
lcp_int, lcp_lm_int, lcp_mr_int = pysais.lcp_int(array, sa_int)

License:

The code is available under the MIT license (see LICENSE file).

Status:

Build Status

About

A Python C module wrapper around the SA-IS suffix array construction algorithm by Yuta Mori.

License:MIT License


Languages

Language:C 95.2%Language:Python 4.8%