GithubHelp home page GithubHelp logo

felipelouza / gsa-is Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 5.0 7.21 MB

Inducing enhanced suffix arrays for string collections [DCC'16, TCS 2017]

Home Page: https://doi.org/10.1016/j.tcs.2017.03.039

License: MIT License

Makefile 0.74% C 99.26%
suffix-array lcp-array document-array indexing

gsa-is's Issues

Suffix array from multi-character tokens

I need to build a suffix array on multi-character tokens (basically 'words') rather than characters. In my first attempt I created a sorted 'alphabet' of unique tokens from the input, and assigned each an integer, then passed the string of these integer indexes, joined with a separator into the algorithm. This works, but require lots of string joins/splits, and there are additional suffixes computed that start with the separator which is not ideal.

I'm wondering if there a better way to do this, perhaps computing the SA directly on the array rather than on a string ??

A toy example given the input array [ "if", "it", "is", "true", "it", "is", "true"].

[
    0: if it is true it is true
    1: is true
    2: is true it is true
    3: it is true
    4: it is true it is true
    5: true
    6: true it is true
]

moved from: felipelouza/gsufsort#5

gSACA-K fails on empty string

Implementation causes a segmentation fault when the input contains at least one empty string.

Example input

In your notation a$b$$d$#.

Expected output

Suffixes should be sorted as usual + the document index in DA, empty-suffix pointer in SA and a 0 in the LCP array.

I reckon:

i       SA      DA      LCP     suffixes
0       8       4       0       #
1       1       0       0       $b$$d$#
2       3       1       0       $$d$#
3       4       2       0       $d$#
4       6       3       0       $#
5       0       0       0       a$b$$d$#
6       2       1       0       b$$d$#
7       5       3       0       d$#

Actual output

Segmentation fault.

Workaround

Add a dummy token to all empty strings.

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.