Skip to content
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

dash and lowered_split fix for inflect.py _plnoun() #127

Closed
wants to merge 1 commit into from

Conversation

picobyte
Copy link
Contributor

In function _plnoun(), the variable lowered_split is split on dashes, but when reusing this variable, code required whitespace split lowerd words, not dash split.

@jaraco
Copy link
Owner

jaraco commented Feb 1, 2022

Can you add a test that captures the missed expectation prior to the patch?

@jaraco
Copy link
Owner

jaraco commented Mar 23, 2022

I regret not having responded to this sooner. It does now appear to be abandoned. Please feel free to revive the effort at some point.

@jaraco jaraco closed this Mar 23, 2022
@picobyte
Copy link
Contributor Author

picobyte commented May 1, 2022

I'm guessing one would have to trigger this with 'prima-donna' then one would get back something like 'prima donnas' and the singular prima donna in the tests/test_pl_si.py when added to tests/words.txt. Maybe there wiyld be more if pl_sb_irregular_compound would contain more words in the future, like man-of-war, jack-in-the-pulpit

What is the concern with this change? It seems to fix a dash- space confusion, are you inclined to think this was intentional?

@jaraco jaraco reopened this May 1, 2022
@jaraco
Copy link
Owner

jaraco commented May 1, 2022

What is the concern with this change?

It's changing behavior in a function that's already unmanageably complex without any tests. That is, I could revert the change and the tests will still pass. To be sure, it's not your fault the implementation is so complex.

Moreover, this PR barely has a problem description. It alludes to a problem, but did not even provide a single example of a failed expectation. Now I have one example, 'prima-donna', but I'm not even sure that's a good example. When I look up the phrase, it appears it's supposed to be "prima donna" so it would be incorrect to hyphenate the phrase. I also observe that the dash separation logic only applies to two or more dashes.

Man-of-war may be a better example.

Still, I'd like to see some tests added that capture not only the missed expectations, but also expectations around proximate concerns (such as space-separated words or compound subjects with only one dash).

@jaraco
Copy link
Owner

jaraco commented May 1, 2022

Looking at this a bit more, I see that there's similar code in _sinoun that already been re-factored to handle spaces and dashes differently. It would be nice if there were a way to unify this logic too.

@jaraco
Copy link
Owner

jaraco commented May 1, 2022

See #153, where I've refactored the code to unify the logic around prepositional phrases.

@jaraco
Copy link
Owner

jaraco commented May 1, 2022

My mistake. I see now that #126 captures the issue. Let's continue the conversation there.

@jaraco jaraco closed this May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants