fix: sentences generation with spaces
This commit is contained in:
@@ -105,6 +105,8 @@ class Generator:
|
||||
self.log.info("Wrote sentences output to %s", self.target_sentences_path)
|
||||
except OSError as e:
|
||||
self.log.error(
|
||||
"Could not write sentences output file at: %s (%s)", self.target_sentences_path, e
|
||||
"Could not write sentences output file at: %s (%s)",
|
||||
self.target_sentences_path,
|
||||
e,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -49,15 +49,15 @@ class Sentence:
|
||||
@classmethod
|
||||
def from_text(cls, src_text: str, names: list[str]) -> Sentence:
|
||||
text = src_text
|
||||
if "EMPTY" in names:
|
||||
text = text.replace(" ", "{EMPTY}")
|
||||
else:
|
||||
log.warning("No EMPTY tile in names, removing spaces in '%s'", src_text)
|
||||
text.replace(" ", "")
|
||||
changed = True
|
||||
data = []
|
||||
remaining_text = ""
|
||||
while changed:
|
||||
|
||||
while changed and len(text):
|
||||
if text[0] == " " and "EMPTY" in names:
|
||||
text = text[1:]
|
||||
data += [names.index("EMPTY")]
|
||||
continue
|
||||
changed = False
|
||||
min_name = None
|
||||
min_pattern = None
|
||||
|
||||
Reference in New Issue
Block a user