Skip to content

Commit

Permalink
fix vocabulary for SequenceParser
Browse files Browse the repository at this point in the history
  • Loading branch information
helpmefindaname committed Nov 11, 2023
1 parent 04cb85e commit 356c9be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lmformatenforcer/characterlevelparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ def add_character(self, new_character: str) -> CharacterLevelParser:
return UnionParser(legal_parsers)

def get_allowed_characters(self) -> str:
allowed_character_strs = []
allowed_characters = set()
for parser in self.parsers:
allowed_character_strs.append(parser.get_allowed_characters())
allowed_characters.update(parser.get_allowed_characters())
if not parser.can_end():
break
return "".join([parser.get_allowed_characters() for parser in self.parsers])
return "".join(allowed_characters)

def can_end(self) -> bool:
return all([parser.can_end() for parser in self.parsers])
Expand Down

0 comments on commit 356c9be

Please sign in to comment.