Skip to content

Commit

Permalink
Update snarl_analyser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Plogeur authored Jan 14, 2025
1 parent f4d99e5 commit 6c696a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stoat/snarl_analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def determine_str(self, s:str, length_s:int, i:int) -> tuple[int, int]:
i += 1
return i, s[start_idx:i]

def decompose_string(self, s:str) -> List[str]:
def decompose_string(self, s:str) -> set:
"""Decompose a string with snarl information."""
result = []
result = set()
i = 0
length_s = len(s)
prev_int = None
Expand All @@ -74,14 +74,14 @@ def decompose_string(self, s:str) -> List[str]:
i, current_int = self.determine_str(s, length_s, i)

if prev_int is not None and prev_sym is not None:
result.append(f"{prev_sym}{prev_int}{start_sym}{current_int}")
result.add(f"{prev_sym}{prev_int}{start_sym}{current_int}")

prev_int = current_int
prev_sym = start_sym

return result

def decompose_snarl(self, lst:List[str]) -> List[List[str]]:
def decompose_snarl(self, lst:List[str]) -> List[set[str]]:
"""Decompose a list of snarl strings."""
return [self.decompose_string(s) for s in lst]

Expand Down

0 comments on commit 6c696a6

Please sign in to comment.