No subject


Sun Nov 20 20:48:46 GMT 2022


```
Is this being rejected because (seemingly) Lingua::* doesn't know how to handle this word?

On 2018-07-26 03:16:47, ilmari wrote:

> > 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
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/dbix-class-schema-loader/issues/53
You are receiving this because you are subscribed to this thread.

Message ID: <dbsrgits/dbix-class-schema-loader/issues/53 at github.com>
----==_mimepart_637a9398219a7_7f0fc670206786a
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p></p>
<p dir="auto">Migrated from <a href="https://rt.cpan.org/Ticket/Display.html?id=125930" rel="nofollow">rt.cpan.org#125930</a> (status was 'open')</p>
<p dir="auto">Requestors:</p>
<ul dir="auto">
<li><a href="mailto:ether at cpan.org">ether at cpan.org</a></li>
</ul>
<p dir="auto">From <a href="mailto:ether at cpan.org">ether at cpan.org</a> on 2018-07-25 16:39:52<br>
:</p>
<pre class="notranslate"><code class="notranslate">I have a table called "device_criteria". Even with naming =&gt; { ALL =&gt; 'v8', force_ascii =&gt; 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");'
-&gt; device_criteria

I guess some splitting into words is required first?
</code></pre>
<p dir="auto">From <a href="mailto:ilmari+cpan at ilmari.org">ilmari+cpan at ilmari.org</a> on 2018-07-26 10:16:47<br>
:</p>
<pre class="notranslate"><code class="notranslate">"Karen Etheridge via RT" &lt;bug-DBIx-Class-Schema-Loader at rt.cpan.org&gt;
writes:

&gt; I have a table called "device_criteria". Even with naming =&gt; { ALL =&gt; 'v8', force_ascii =&gt; 1 }
&gt; in my config file, I end up with a source called DeviceCriteria, not DeviceCriterion.
&gt;
&gt; this looks to be the root problem:
&gt;
&gt; perl -MLingua::EN::Inflect::Phrase -wle'print Lingua::EN::Inflect::Phrase::to_S("device_criteria");'
&gt; -&gt; device_criteria
&gt;
&gt; 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" -&gt; "a" words like "aphelion").

Lingua::EN::Inflect::Phrase does have a bunch of special cases, I guess this
could be added there.

-ilmari
</code></pre>
<p dir="auto">From <a href="mailto:ether at cpan.org">ether at cpan.org</a> on 2018-07-26 15:22:31<br>
:</p>
<pre class="notranslate"><code class="notranslate">Is this being rejected because (seemingly) Lingua::* doesn't know how to handle this word?

On 2018-07-26 03:16:47, ilmari wrote:

&gt; &gt; I guess some splitting into words is required first?
&gt; 
&gt; That wouldn't help, Lingua::EN::Inflect::Phrase doesn't handle
&gt; "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])-&gt;singular;
    my $source = camelize(join('_', @words));

perl -MLingua::EN::Inflexion=noun -wle'print noun("criteria")-&gt;singular'
--&gt; criterion
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />Reply to this email directly, <a href="https://github.com/dbsrgits/dbix-class-schema-loader/issues/53">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AACJ4ATGV2LPM3NRK6K64SDWJKFRRANCNFSM6AAAAAASGAWLF4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AACJ4AS4MXLQYBQLJIOY6YTWJKFRRA5CNFSM6AAAAAASGAWLF6WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHFNWFTHQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;dbsrgits/dbix-class-schema-loader/issues/53</span><span>@</span><span>github</span><span>.</span><span>com&gt;</span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/dbsrgits/dbix-class-schema-loader/issues/53",
"url": "https://github.com/dbsrgits/dbix-class-schema-loader/issues/53",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
----==_mimepart_637a9398219a7_7f0fc670206786a--



More information about the DBIx-Class-Devel mailing list