Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactoring #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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