-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError
raised in format_skeleton
when using fuzzy matching
#1084
Comments
@akx What do you think? Should we fix this? |
Yeah, I think so. My original commit for fuzzy skeletons (fuzzy skeletons, yikes what a horrible mental image) cd70395 refers to the ICU4J Apparently there's been at least one commit unicode-org/icu@edaebfa that has improved that function since – we should maybe look at whether that improvement would in fact fix this? |
Looks like the only thing that changed is more format specifier replacements which we could add as well: if 'k' in skeleton and not any('k' in option for option in options):
skeleton = skeleton.replace('k', 'H')
if 'K' in skeleton and not any('K' in option for option in options):
skeleton = skeleton.replace('K', 'h')
if 'a' in skeleton and not any('a' in option for option in options):
skeleton = skeleton.replace('a', '')
if 'b' in skeleton and not any('b' in option for option in options):
skeleton = skeleton.replace('b', '') This doesn't fix the |
For the time being, we could maybe just document that |
Yeah, that sounds like the best option |
Overview Description
When using
format_skeleton
, aKeyError
is raised despite usingfuzzy=True
.Steps to Reproduce
From the docs:
The way I read it is that as long as I pass
fuzzy=True
(which is the default) a skeleton should always be found and I should not need to worry aboutKeyError
s in that case.Even the example in the docs makes it seem a
KeyError
is only thrown withfuzzy=False
:If this is the expected behaviour, I think the docs should state that explicitly. If not, I would suggest adding
allow_different_fields=True
to the underlyingmatch_skeleton()
call.Additional Information
Babel version:
2.15
The text was updated successfully, but these errors were encountered: