mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Switch canon_case to get value, to avoid keyerror
This commit is contained in:
parent
a779275a59
commit
c4ba216642
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user