后缀树、广义后缀树和字符串处理方法
suffix-trees的Python项目详细描述
后缀树和广义后缀树的python实现。 还提供了strees和gstrees的典型应用方法。
安装
pip安装后缀树
用法
fromsuffix_treesimportSTree# Suffix-Tree example.st=STree.STree("abcdefghab")print(st.find("abc"))# 0print(st.find_all("ab"))# [0, 8]# Generalized Suffix-Tree example.a=["xxxabcxxx","adsaabc","ytysabcrew","qqqabcqw","aaabc"]st=STree.STree(a)print(st.lcs())# "abc"