Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 125930
Status: open
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07049
Fixed in: (no value)



Subject: pluralization not complete
I have a table called "device_criteria". Even with naming => { ALL => 'v8', force_ascii => 1 } in my config file, I end up with a source called DeviceCriteria, not DeviceCriterion. this looks to be the root problem: perl -MLingua::EN::Inflect::Phrase -wle'print Lingua::EN::Inflect::Phrase::to_S("device_criteria");' -> device_criteria I guess some splitting into words is required first?
"Karen Etheridge via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: Show quoted text
> I have a table called "device_criteria". Even with naming => { ALL => 'v8', force_ascii => 1 } > in my config file, I end up with a source called DeviceCriteria, not DeviceCriterion. > > this looks to be the root problem: > > perl -MLingua::EN::Inflect::Phrase -wle'print Lingua::EN::Inflect::Phrase::to_S("device_criteria");' > -> device_criteria > > I guess some splitting into words is required first?
That wouldn't help, Lingua::EN::Inflect::Phrase doesn't handle "criteria" on its own either. $ perl -MLingua::EN::Inflect::Phrase -wle'print Lingua::EN::Inflect::Phrase::to_S("criteria");' criteria The underlying problem seems to be that Lingua::EN::Inflect::Number thinks 'criteria' is already singular: $ perl -MLingua::EN::Inflect::Number=number -E 'say number "criteria"' s I think this all stems from the fact hat Lingua::EN::Inflect::Number abuses Lingua::EN::Inflect::PL() to convert to _singular_, which is documented as "undefined (and unlikely to be correct)", the comment in to_S() even says "I don't know why this works, but it seems to." Lingua::EN::Inflect does know to pluralise "criterion" to "criteria", but the usual (accidental?) behaviour of PL() singularising already-plural words doesn't seem to apply to it (or other "ion" -> "a" words like "aphelion"). Lingua::EN::Inflect::Phrase does have a bunch of special cases, I guess this could be added there. -ilmari
Is this being rejected because (seemingly) Lingua::* doesn't know how to handle this word? On 2018-07-26 03:16:47, ilmari wrote: Show quoted text
> > I guess some splitting into words is required first?
> > That wouldn't help, Lingua::EN::Inflect::Phrase doesn't handle > "criteria" on its own either.
This works (and indeed is what I'm doing elsewhere in the codebase: use Lingua::EN::Inflexion 'noun'; my $table_name = 'device_criteria'; my @words = split('_', $table_name); $words[-1] = noun($words[-1])->singular; my $source = camelize(join('_', @words)); perl -MLingua::EN::Inflexion=noun -wle'print noun("criteria")->singular' --> criterion