From 6025cdb992db9446d747ae0855a11e74a5e311c9 Mon Sep 17 00:00:00 2001 From: ines Date: Mon, 8 May 2017 16:38:16 +0200 Subject: [PATCH] Fix string interpolation in times --- spacy/en/tokenizer_exceptions.py | 9 ++++----- spacy/es/tokenizer_exceptions.py | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spacy/en/tokenizer_exceptions.py b/spacy/en/tokenizer_exceptions.py index 6c62fc752..2c197db2c 100644 --- a/spacy/en/tokenizer_exceptions.py +++ b/spacy/en/tokenizer_exceptions.py @@ -279,14 +279,13 @@ for exc_data in [ # Times for h in range(1, 12 + 1): - hour = str(h) for period in ["a.m.", "am"]: - _exc[hour+period] = [ - {ORTH: hour}, + _exc["%d%s" % (h, period)] = [ + {ORTH: "%d" % h}, {ORTH: period, LEMMA: "a.m."}] for period in ["p.m.", "pm"]: - _exc[hour+period] = [ - {ORTH: hour}, + _exc["%d%s" % (h, period)] = [ + {ORTH: "%d" % h}, {ORTH: period, LEMMA: "p.m."}] diff --git a/spacy/es/tokenizer_exceptions.py b/spacy/es/tokenizer_exceptions.py index 64f1cdbad..b66d2cda0 100644 --- a/spacy/es/tokenizer_exceptions.py +++ b/spacy/es/tokenizer_exceptions.py @@ -61,14 +61,13 @@ _exc["12m."] = [ for h in range(1, 12 + 1): - hour = str(h) for period in ["a.m.", "am"]: - _exc[hour+period] = [ - {ORTH: hour}, + _exc["%d%s" % (h, period)] = [ + {ORTH: "%d" % h}, {ORTH: period, LEMMA: "a.m."}] for period in ["p.m.", "pm"]: - _exc[hour+period] = [ - {ORTH: hour}, + _exc["%d%s" % (h, period)] = [ + {ORTH: "%d" % h}, {ORTH: period, LEMMA: "p.m."}]