boltons icon indicating copy to clipboard operation
boltons copied to clipboard

`strutils.plural` does not handle acronyms correctly

Open mhucka opened this issue 4 years ago • 1 comments

If the word to be pluralized is an acronym like "DOI", then plural will match case and produce "DOIS", which is not the desired result in many (most?) cases. A better result would be "DOIs", to match its use in sentences such as "There are a total of 53 DOIs associated with this journal".

I realize acronyms are especially challenging, because it's basically impossible for plural to recognize every conceivable acronym. Perhaps a better solution would be to have some kind of option or override on the case-matching part of the code, such that the user could say "don't match case".

mhucka avatar Aug 04 '21 01:08 mhucka

Good point, I'd take a PR for that if you want to take a swing at it. :)

On Tue, Aug 3, 2021 at 6:27 PM Mike Hucka @.***> wrote:

If the word to be pluralized is an acronym like "DOI", then plural will match case and produce "DOIS", which is not the desired result in many (most?) cases. A better result would be "DOIs", to match its use in sentences such as "There are a total of 53 DOIs associated with this journal".

I realize this is a difficult case, because it's basically impossible for plural to recognize every conceivable acronym. Perhaps a better solution would be to have some kind of option or override on the case-matching part of the code, such that the user could say "don't match case".

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mahmoud/boltons/issues/291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA7ZEMVKXI7RM3ZPWOJHXLT3CJOPANCNFSM5BP7USVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

mahmoud avatar Aug 04 '21 07:08 mahmoud