Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions artificial_detection/models/smr/sais.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
def construct_suffix_array(string):
ta = construct_type_array(string)
mapping = construct_alphabet_mapping(string)
Expand Down Expand Up @@ -167,14 +168,10 @@ def construct_buckets(encoded_string, mapping):


def get_bucket_heads(buckets):
heads = [0]
for bucket_size in buckets[:-1]:
heads.append(heads[-1] + bucket_size)
heads = [0] + np.cumsum(buckets[:-1]).tolist()
return heads


def get_bucket_tails(buckets):
tails = [0]
for bucket_size in buckets[1:]:
tails.append(tails[-1] + bucket_size)
tails = [0] + np.cumsum(buckets[1:]).tolist()
return tails