From 0796b675f6d0f7e33d20d5c0f847e0cb43ace7ee Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 3 Feb 2015 16:16:14 -0800 Subject: [PATCH] Improvements to titleFixup --- tradedb.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tradedb.py b/tradedb.py index 8c94fe92..7a5628eb 100644 --- a/tradedb.py +++ b/tradedb.py @@ -1847,7 +1847,12 @@ def titleFixup(text): lambda m: m.group(1) + m.group(2).upper() + m.group(3), text ) + text = re.sub("\b(von|van|de|du|of)\b", + lambda m: m.group(1).lower, + text + ) text = re.sub(r"'S\b", "'s", text) + text = text[0].upper() + text[1:] return text