-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fix DisjunctiveConstraint edge case and add ConjunctiveDisjunctiveConstraint #17920
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
Fix DisjunctiveConstraint edge case and add ConjunctiveDisjunctiveConstraint #17920
Conversation
…to ac automaton to fix edge cases
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
|
Hey @boy2000-007man, Thanks for the fix proposal! @cwkeam could you take a look here as well? :-) @boy2000-007man - it'd be really nice if you could add a test that would have failed without your fix, but will now pass. Thanks a lot for working on this! |
… fulfills disjunctions
…o handle multiple constraints simultaneously
| self.assertTrue(dc.current_seq == [1, 2, 5]) | ||
| self.assertTrue(dc.advance() is None) | ||
|
|
||
| def test_dc_example_progression_mid_overlap_two(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patrickvonplaten , here is the updated test case for the reported edge case
|
Hey @boy2000-007man, Thanks a lot for the PR - I'm a bit worried about adding so much new code to main transformers to catch an edge case and wonder if it's really worth it. The problem is that this function will quickly become unmaintainable (it already sadly is to some extent) - in your opinion is it absolutely necessary to add this edge case? Also could you maybe provide a "real" generation example that shows how the current implementation fails? |
|
Hi, @patrickvonplaten, the current code implementation is complex to support both the existing |
|
Hey @boy2000-007man, Sorry to reply so late here. Will gently ask @cwkeam in private if he could take a quick look because he's the most familiar with the current code. if there is no answer, I'll come back to it and dive deeper into the code to be able to better answer here. Also cc @gante if you're feeling curios on complex code ;-) |
|
Hi @boy2000-007man 👋 I was having a look into this PR, and one thing I noticed was that the objective of the PR was not immediately clear -- it says at the top that it fixes an edge case but... what edge case? We can find the answer to that in the code, especially in the docstring of I do think we should fix the edge case, as the documented behavior does not match the actual behavior. However, adding clear examples (as in #15761) will be extremely useful for our future selves 🙏 It will also helps the reviewers seeing the value of the PR :D |
Yes please, but with input strings (as opposed to tokens). It's hard to justify adding so many new lines of code without a clear example of why it matters :) We have very limited maintenance capacity, so sometimes it's preferable to have an incomplete short solution that we can maintain than a complete long solution that will accumulate bugs as we introduce new features. |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
What does this PR do?
AC automatonto supersede Trie to fix DisjunctiveConstraint edge caseFixes # (issue)
#17831
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@patrickvonplaten, @cwkeam