Skip to content

Commit

Permalink
Update fabba.py
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxinye committed Jul 8, 2024
1 parent cfc5ec1 commit 6ae8eab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fABBA/fabba.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def symbolsAssign(clusters, alphabet_set=0):
----------
Return:
string (list of string), alphabets(numpy.ndarray): for the
corresponding symbolic sequence and for mapping from symbols to labels or
labels to symbols, repectively.
Expand All @@ -310,8 +310,11 @@ def symbolsAssign(clusters, alphabet_set=0):
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z']

elif isinstance(alphabet_set, list) and len(alphabets):
alphabets = alphabet_set
elif isinstance(alphabet_set, list):
if len(clusters) <= len(alphabet_set):
alphabets = alphabet_set
else:
raise ValueError("Please ensure the length of ``alphabet_set`` is greatere than ``clusters``.")

else:
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
Expand All @@ -335,7 +338,7 @@ def symbolsAssign(clusters, alphabet_set=0):

alphabets = np.asarray(alphabets)
string = alphabets[clusters]
return string, alphabets
return string.tolist(), alphabets



Expand Down

0 comments on commit 6ae8eab

Please sign in to comment.