From 42b8b65de9887d349aaf35389d66fe0465b191aa Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 25 Aug 2018 19:27:18 +0200 Subject: [PATCH] Do not substitute game name delimiters separated by fewer than two letters to allow titles like "R.O.V.E.R.". --- dailyreleases/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dailyreleases/main.py b/dailyreleases/main.py index be69b44..9aa8362 100644 --- a/dailyreleases/main.py +++ b/dailyreleases/main.py @@ -102,8 +102,9 @@ class DailyReleasesBot(object): "|iNTERNAL|Steam[._-]?Edition)", rls_name, flags=re.IGNORECASE) - # Prettify game name by substituting word delimiters with spaces and capitalizing each word - game_name = string.capwords(re.sub("[._-]", " ", game_name)) + # Prettify game name by substituting word delimiters with spaces and capitalizing each word. Delimiters + # separated by fewer than two letters are not substituted, to allow titles like "R.O.V.E.R." + game_name = string.capwords(re.sub("[._-]([a-zA-Z]{2,}|[0-9]+)", " \g<1>", game_name)) # Some stopwords are interesting enough to add next to the game in parentheses - we call these tags tags = [stopword