Short, Java implementation of a suffix tree and usage?

前端 未结 3 953
误落风尘
误落风尘 2021-02-06 04:43

I\'m looking for a short, simple suffix tree building/usage algorithm in Java. The best I\'ve found so far lies withing the Semantic Discovery Toolkit, but the implementation is

相关标签:
3条回答
  • 2021-02-06 05:17

    You can also take mine but this is not Ukkonen's algorithm - as all other simple approaches, it runs in quadratic time. I agree that a naive algorithm (that may work ok for the shorter sequences) is easy to write in half a day at most.

    0 讨论(0)
  • 2021-02-06 05:26

    The article "Simple Linear Work Suffix Array Construction", by Karkkainen and Sanders, terminates with 50 lines of C++. You will probably also want something to produce the LCP array. Googling for "Computing the LCP array in linear time, given S and the suffix array POS." should find you that.

    0 讨论(0)
  • 2021-02-06 05:31

    I just finished a Java implementation of a suffix tree. In my blog entry you can find out more about suffix trees, see how to use my library, as well as download and build the library using Subversion and Maven. Yes, it's longer than just a few lines in a single class file, but it is highly documented and is created for use in the real world for practical purposes. In addition, it uses the Ukkonen approach for linear time construction. (Most of the implementations noted here have at least O(n^2) running time.)

    0 讨论(0)
提交回复
热议问题