From c4ba21664232dc499480ad1ad9f717c0f1006ccc Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 1 Sep 2014 17:27:36 +0200 Subject: [PATCH] * Switch canon_case to get value, to avoid keyerror --- spacy/orth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/orth.py b/spacy/orth.py index d9b4abecc..6241a0414 100644 --- a/spacy/orth.py +++ b/spacy/orth.py @@ -41,9 +41,9 @@ def can_tag(name, thresh): # String features def canon_case(string, prob, cluster, case_stats, tag_stats): - upper_pc = case_stats['upper'] - title_pc = case_stats['title'] - lower_pc = case_stats['lower'] + upper_pc = case_stats.get('upper', 0.0) + title_pc = case_stats.get('title', 0.0) + lower_pc = case_stats.get('lower', 0.0) if upper_pc >= lower_pc and upper_pc >= title_pc: return string.upper()