From d321cd8a14903cf59ca8a9a7edfd8a6b2dcdb64f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 10 Jul 2012 01:01:56 -0400 Subject: [PATCH] Handle all of the 'x of y' as a single case. --- earwigbot/commands/dictionary.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/earwigbot/commands/dictionary.py b/earwigbot/commands/dictionary.py index 6450be7..e3ee7e2 100644 --- a/earwigbot/commands/dictionary.py +++ b/earwigbot/commands/dictionary.py @@ -127,9 +127,7 @@ class Dictionary(Command): substitutions = [ ("", ""), ("\[\[(.*?)\|(.*?)\]\]", r"\2"), - ("\{\{alternative spelling of\|(.*?)\}\}", - r"Alternative spelling of \1."), - ("\{\{synonym of\|(.*?)\}\}", r"Synonym of \1."), + ("\{\{(.*?) of\|(.*?)\}\}", r"\1 of \2."), ("\{\{surname(.*?)\}\}", r"A surname."), ("\{\{given name\|(.*?)(\||\}\})", r"A \1 given name."), ] @@ -143,7 +141,8 @@ class Dictionary(Command): line = self.strip_templates(line) line = line[1:].replace("'''", "").replace("''", "") line = line.replace("[[", "").replace("]]", "") - senses.append(line.strip()) + if line: + senses.append(line.strip()[0].upper() + line.strip()[1:]) if not senses: return None