Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # def constructSuffixArray(convertedTextSplit, wordCount):
- # suffixes = [(convertedTextSplit[i:i + wordCount], i) for i in range(len(convertedTextSplit))]
- # suffixes.sort(key=lambda s: s[0])
- # return [s[1] for s in suffixes]
- # def sort_bucket(convertedTextSplit, bucket, order, wordCount):
- # d = defaultdict(list)
- # for i in bucket:
- # key = ''.join([str(ss) for ss in convertedTextSplit[i:i+order]])
- # d[key].append(i)
- # result = []
- # for k,v in sorted(d.items()):
- # if len(v) > 1:
- # result += sort_bucket(convertedTextSplit, v, order*2,wordCount)
- # else:
- # result.append(v[0])
- # return result
- # def constructSuffixArray(convertedTextSplit, wordCount):
- # return sort_bucket(convertedTextSplit, (i for i in range(len(convertedTextSplit))), 1, wordCount)
Advertisement
Add Comment
Please, Sign In to add comment