Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取错误“后缀树字符串不能包含端子符号!”_Python_Runtime Error_Suffix Tree_Suffix Array - Fatal编程技术网

Python 获取错误“后缀树字符串不能包含端子符号!”

Python 获取错误“后缀树字符串不能包含端子符号!”,python,runtime-error,suffix-tree,suffix-array,Python,Runtime Error,Suffix Tree,Suffix Array,我想建立一个通用后缀树。我正在使用此实现。我的代码如下: s1 = u'abcd' x = 36 for i in range(x): listing.append(s1) stree = GeneralisedSuffixTree(listing) 对于x=35的值,代码运行良好,但是对于x=36或更大的值,我得到以下错误 ---------------------------------------------------------------------------

我想建立一个通用后缀树。我正在使用此实现。我的代码如下:

 s1 = u'abcd'
 x = 36
 for i in range(x):
     listing.append(s1)
 stree = GeneralisedSuffixTree(listing) 
对于x=35的值,代码运行良好,但是对于x=36或更大的值,我得到以下错误

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-36-e7b83eadb302> in <module>()
      6     listing.append(s1)
      7 
----> 8 stree = GeneralisedSuffixTree(listing)
      9 
     10 count = []

/home/darshan/anaconda/lib/python2.7/site-packages/suffix_tree.pyc in __init__(self, sequences)
    113         self.sequences += [u'']
    114 
--> 115         SuffixTree.__init__(self,concatString)
    116         self._annotateNodes()
    117 

/home/darshan/anaconda/lib/python2.7/site-packages/suffix_tree.pyc in __init__(self, s, t)
     60 must not contain the special symbol $.'''
     61         if t in s:
---> 62             raise "The suffix tree string must not contain terminal symbol!"
     63         _suffix_tree.SuffixTree.__init__(self,s,t)
     64 

TypeError: exceptions must be old-style classes or derived from BaseException, not str
例外情况来自此文件

我不明白为什么它适用于x<36的值,而不适用于其他值。
请帮助我了解这里发生了什么。

该项目使用的语法在当前Python版本中不再有效;谁知道还有什么可能被破坏。@MartijnPieters:如果我使用旧版本,它会工作吗?我真的不知道,对不起。