From 51a9db3b40297c016a55c495fb9b4a7d3abecc24 Mon Sep 17 00:00:00 2001 From: insolor <2442833+insolor@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:58:32 +0300 Subject: [PATCH 1/3] Ignore "Crash" strings, ignore -betaN strings --- df_translation_toolkit/utils/df_ignore_string_rules.py | 3 ++- tests/test_df_ignore_string_rules.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/df_translation_toolkit/utils/df_ignore_string_rules.py b/df_translation_toolkit/utils/df_ignore_string_rules.py index 82bdc12..27742e6 100644 --- a/df_translation_toolkit/utils/df_ignore_string_rules.py +++ b/df_translation_toolkit/utils/df_ignore_string_rules.py @@ -99,7 +99,7 @@ def ignore_underline_separated_words(string: str) -> bool: @rules.register def ignore_dash_prepended_strings(string: str) -> bool: - return re.fullmatch(r"-[a-z_]+-?", string) is not None + return re.fullmatch(r"-[a-z0-9_]+-?", string) is not None @rules.register @@ -113,6 +113,7 @@ def ignore_word_with_number(string: str) -> bool: forbidden_starts = { + "Crash", "String:", "Adventure:", "Hotkey:", diff --git a/tests/test_df_ignore_string_rules.py b/tests/test_df_ignore_string_rules.py index fd36936..8d5f30c 100644 --- a/tests/test_df_ignore_string_rules.py +++ b/tests/test_df_ignore_string_rules.py @@ -66,6 +66,7 @@ (rules.ignore_underline_separated_words, "init_sound returned false!", True), (rules.ignore_dash_prepended_strings, "-world_sites_and_pops", True), (rules.ignore_dash_prepended_strings, "-site_map-", True), + (rules.ignore_dash_prepended_strings, "-beta23", True), ( rules.ignore_by_blacklisted_words, "*** Error(s) finalizing the creature ", From bea86fba071b4fea3aab3606fb5f5005b1b486e2 Mon Sep 17 00:00:00 2001 From: insolor <2442833+insolor@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:03:33 +0300 Subject: [PATCH 2/3] Some more rules --- df_translation_toolkit/utils/df_ignore_string_rules.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/df_translation_toolkit/utils/df_ignore_string_rules.py b/df_translation_toolkit/utils/df_ignore_string_rules.py index 27742e6..6dddbfe 100644 --- a/df_translation_toolkit/utils/df_ignore_string_rules.py +++ b/df_translation_toolkit/utils/df_ignore_string_rules.py @@ -175,6 +175,9 @@ def ignore_word_with_number(string: str) -> bool: "Patched save:", "vector", "?_", + "ill-sized", + "Item creation failed:", + "Item submission failed:", } From a07a46e38628d83cdd6d5e33049d969aff243c50 Mon Sep 17 00:00:00 2001 From: insolor <2442833+insolor@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:08:58 +0300 Subject: [PATCH 3/3] Sort sets in df_ignore_string_rules --- .../utils/df_ignore_string_rules.py | 436 +++++++++--------- 1 file changed, 218 insertions(+), 218 deletions(-) diff --git a/df_translation_toolkit/utils/df_ignore_string_rules.py b/df_translation_toolkit/utils/df_ignore_string_rules.py index 6dddbfe..a49b08f 100644 --- a/df_translation_toolkit/utils/df_ignore_string_rules.py +++ b/df_translation_toolkit/utils/df_ignore_string_rules.py @@ -113,71 +113,71 @@ def ignore_word_with_number(string: str) -> bool: forbidden_starts = { - "Crash", - "String:", + ": DEMAND_", + ": MANDATE_", + ": REQUIRED_", + "?_", "Adventure:", - "Hotkey:", - "Main:", - "Location:", + "Arena Creature:", + "Arena Tree:", + "Arena Weather:", + "Assign Trade:", + "Building Items:", + "Building List:", + "Building,", "Buildjob:", - "Movie:", + "Cage: ", + "Choose name:", + "Command Line:", + "Crash", "Custom:", - "Orders:", + "DOUBLE TAGGED ITEM:", + "Designate,", "Dwf Look:", - "Arena Creature:", - "Squad Schedule:", - "Building List:", "Hot Keys:", - "Load Game:", - "old save:", - "Stockpile Settings:", - "Assign Trade:", - "World:", - "World Param:", - "Command Line:", - "Noble List:", - "Arena Weather:", - "Building Items:", - "Arena Tree:", + "Hotkey:", "Image Creator:", + "Item creation failed:", + "Item submission failed:", "Legends:", - "World Gen:", - "Setup game:", - "World Generation:", - "Choose name:", - "View item:", - "Trainer:", - "Order:", - "Unitview,", - "Building,", - "Designate,", - "Stockpile,", - "Setup,", + "Load Game:", + "Location:", + "Main:", "Manager,", - "Work Order,", - "Unitjob,", - "Secondary Option", - "Unrecognized ", "Missing ", - "unknown", - "Option ", - "Numpad ", "Move view/cursor ", - "invalid ", - "incorrect ", + "Movie:", "NULL ", + "Noble List:", "Nuked ", - "Cage: ", - ": REQUIRED_", - ": MANDATE_", - ": DEMAND_", - "DOUBLE TAGGED ITEM:", + "Numpad ", + "Option ", + "Order:", + "Orders:", "Patched save:", - "vector", - "?_", + "Secondary Option", + "Setup game:", + "Setup,", + "Squad Schedule:", + "Stockpile Settings:", + "Stockpile,", + "String:", + "Trainer:", + "Unitjob,", + "Unitview,", + "Unrecognized ", + "View item:", + "Work Order,", + "World Gen:", + "World Generation:", + "World Param:", + "World:", "ill-sized", - "Item creation failed:", - "Item submission failed:", + "incorrect ", + "invalid ", + "old save:", + "unknown", + "vector", } @@ -187,174 +187,174 @@ def ignore_starts(string: str) -> bool: blacklist_full_string = { - "bad allocation", - "bad array new length", - "Out of memory - aborting", - "Fatal Error", - "nameless", - "string too long", - "invalid string position", "!ARG", - "current", + "2DASYNC", + "2DHW", + "2DSW", + "Alt+", + "Ampersand", + "Asterisk", + "At", + "B!+", + "B!~", + "Backquote", + "Backslash", + "Backspace", + "Bl+", + "Bl~", + "Capslock", + "Caret", + "Colon", + "Comma", + "Ctrl+", + "Delete", + "Dollar", + "Down", + "Empty biased index vector", + "End", + "End of macro", + "Enter", + "Equals", + "Euro", + "Exclaim", "Exh", + "Fatal Error", + "Fnt", + "Greater", + "Hash", + "Insert", + "Lalt", + "Lctrl", + "Left", + "Leftbracket", + "Leftparen", + "Less", + "Lmeta", + "Lshift", + "Lsuper", + "Menu", + "Minus", + "Mode", + "Nm+", + "Nm-", + "Nm~", + "Numlock", + "Out of memory - aborting", "Ovx", + "Page Down", + "Page Up", + "Pal", "Pb!", "Pb+", "Pb~", + "Period", + "Plus", "Pn!", "Pn+", "Pn~", + "Print", + "Pz+", + "Pz~", + "Question", + "Quote", + "Quotedbl", + "Ralt", + "Rctrl", + "Right", + "Rightbracket", + "Rightparen", + "Rmeta", + "Rshift", + "Rsuper", + "Scrollock", + "Semicolon", + "Shift+", + "Slash", + "Slg", + "Space", "Sw!", "Sw+", "Sw~", + "Sysreq", + "Tab", "Tir", - "Nm-", - "Bl+", - "B!~", - "B!+", - "Pz+", - "Fnt", - "Pal", - "Bl~", - "Nm~", - "Nm+", - "Slg", - "Pz~", - "scrollx", - "scrolly", - "buildreq", - "jobvalue", - "version", - "gview", + "Underscore", + "Undo", + "Unknown exception", + "Up", + "_DIV ", + "addingtask", "assignbuildingjobs", - "year", "assigndesjobs", - "weathertimer", - "season", + "bad allocation", + "bad array new length", + "bad cast", + "buildreq", + "current", + "cursor", + "data", + "dunginv", + "enabler", + "feature-", + "game", + "gamemode", + "gametype", + "gps", + "gview", + "handleannounce", + "init", + "insufficient memory", + "interactinvslot", + "interactitem", + "invalid string position", + "itemmade", + "jobvalue", "line", "linechar", - "scrollz", "linelim", - "gametype", - "point", - "gamemode", - "cursor", - "modejob", + "looklist", + "mainview", + "manucomp", + "menuposition", "modeitem", - "addingtask", - "modeseason", - "selectingtaskobject", - "paused", + "modejob", "modepage", + "modeseason", "modestation", - "squadcount", - "modeview", "modeunit", - "game", - "gps", - "plotinfo", - "world", - "itemmade", - "olookz", - "oscrollx", + "modeview", + "nameless", "olookx", "olooky", - "menuposition", - "looklist", - "unitprintstack", - "title", - "init", - "mainview", - "texture", - "interactitem", - "interactinvslot", - "throwitem", - "dunginv", - "page", + "olookz", + "oscrollx", "oscrolly", "oscrollz", - "updatelightstate", - "handleannounce", + "page", + "paused", + "plotinfo", + "point", "preserveannounce", - "manucomp", - "enabler", - "Empty biased index vector", - "Unknown exception", - "bad cast", - "data", - "region", - "text", "raw", + "region", + "scrollx", + "scrolly", + "scrollz", + "season", + "selectingtaskobject", "site-", - "feature-", - "Backspace", - "Enter", - "Up", - "Delete", - "Leftbracket", - "Backslash", - "Rightbracket", - "Caret", - "Underscore", - "Backquote", - "Rshift", - "Lshift", - "Rctrl", - "Lctrl", - "Ralt", - "Lalt", - "Rmeta", - "Lmeta", - "Numlock", - "Capslock", - "Scrollock", - "Down", - "Right", - "Insert", - "End", - "Page Up", - "Page Down", - "Euro", - "Undo", - "Lsuper", - "Rsuper", - "Print", - "Sysreq", - "Menu", - "Space", - "Tab", - "Shift+", - "Ctrl+", - "Alt+", - "Question", - "Quotedbl", - "Hash", - "Ampersand", - "Quote", - "Leftparen", - "Rightparen", - "Left", - "Colon", - "Semicolon", - "Less", - "Equals", - "Greater", - "At", - "Asterisk", - "Plus", - "Comma", - "Minus", - "Period", - "Slash", - "Exclaim", - "Dollar", - "Mode", - "_DIV ", - "End of macro", - "2DASYNC", - "2DHW", - "2DSW", - "insufficient memory", + "squadcount", + "string too long", + "text", + "texture", + "throwitem", + "title", + "unitprintstack", + "updatelightstate", + "version", + "weathertimer", + "world", + "year", } @@ -383,45 +383,45 @@ def ignore_by_blacklisted_words(string: str) -> bool: allowed_short_words = { + "'s", + "/E", + "/N", + "/S", + "/W", "A", + "At", + "He", + "I", + "It", + "No", + "On", + "Up", + "We", "an", - "er", - "us", # sarcofag-us "as", + "at", + "b.", + "by", + "d.", + "er", + "es", + "he", "in", - "st", "is", - "'s", - "s", - "es", - "nd", - "rd", - "th", + "it", "me", "my", + "nd", "no", - "to", - "b.", - "d.", - "At", - "Up", - "On", "of", - "at", - "by", "on", - "I", - "He", - "he", - "We", - "it", - "It", - "No", + "rd", + "s", "s]", - "/N", - "/S", - "/E", - "/W", + "st", + "th", + "to", + "us", }