* Switch canon_case to get value, to avoid keyerror

This commit is contained in:
Matthew Honnibal 2014-09-01 17:27:36 +02:00
parent a779275a59
commit c4ba216642

View File

@ -41,9 +41,9 @@ def can_tag(name, thresh):
# String features # String features
def canon_case(string, prob, cluster, case_stats, tag_stats): def canon_case(string, prob, cluster, case_stats, tag_stats):
upper_pc = case_stats['upper'] upper_pc = case_stats.get('upper', 0.0)
title_pc = case_stats['title'] title_pc = case_stats.get('title', 0.0)
lower_pc = case_stats['lower'] lower_pc = case_stats.get('lower', 0.0)
if upper_pc >= lower_pc and upper_pc >= title_pc: if upper_pc >= lower_pc and upper_pc >= title_pc:
return string.upper() return string.upper()