From 66d311b3267620995e5c35b16f3fba18ed0c48f3 Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 4 Jan 2023 09:52:02 -0800 Subject: Bugfix: user-provided paths may now contain spaces Previously, paths containing spaces would be interpreted by python's argument parser as multiple separate arguments, causing it to fail. Now we escape paths inside PythonWrapper using std::quoted(). * Improve PII filtering. Python output would contain multiple path separators (like C:\\Users\\foo\\), defeating the PII regex. * Silence compiler warning in PII filter. * Document usability improvements. * Transcription layer exponential backoff goes to ~infinity when paused. This is a hack, since we really don't need to transcribe at all when paused, but it lets us keep the code simple. Good enough until the next rewrite. * Shader only samples background when necessary. * Limit matchStrings() print()s to DEBUG mode --- Scripts/string_matcher.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Scripts/string_matcher.py') diff --git a/Scripts/string_matcher.py b/Scripts/string_matcher.py index 686056c..26241f2 100644 --- a/Scripts/string_matcher.py +++ b/Scripts/string_matcher.py @@ -52,7 +52,8 @@ def matchSpaceDelimitedStrings(old_text: str, new_text: str, window_size = 4) -> def matchStrings(old_text: str, new_text: str, window_size = 3) -> str: if old_text == new_text: - print("STRING MATCH exception path 1") + if DEBUG: + print("STRING MATCH exception path 1") return old_text elif len(old_text) >= window_size and len(new_text) >= window_size: # Find the window where the cumulative string distance @@ -105,9 +106,10 @@ def matchStrings(old_text: str, new_text: str, window_size = 3) -> str: new_text[best_match_j:])) return old_prefix + new_text[best_match_j:] else: - print("STRING MATCH exception path 2") - print(" OLD: {}".format(old_text)) - print(" NEW: {}".format(new_text)) + if DEBUG: + print("STRING MATCH exception path 2") + print(" OLD: {}".format(old_text)) + print(" NEW: {}".format(new_text)) return new_text if __name__ == "__main__": -- cgit v1.2.3