1
0
Fork 0

Do not substitute game name delimiters separated by fewer than two letters to allow titles like "R.O.V.E.R.".

This commit is contained in:
Casper V. Kristensen 2018-08-25 19:27:18 +02:00
parent df4cafadbd
commit 42b8b65de9
Signed by: caspervk
GPG key ID: B1156723DB3BDDA8

View file

@ -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