Refactor code and add German negation - #11
Open
MiriUll wants to merge 3 commits into
Open
Conversation
MiriUll
commented
Mar 6, 2024
Collaborator
- used factory pattern to group different languages
- added Negator_DE for German negation
- DERBI (needed for German inflection) is WIP, the dependency should be changed to the original repo once the installation issues are fixed
Owner
|
Hi @MiriUll. Thanks for the PR! I have added a commit revamping the project structure so that further negators for new languages can be easily added under The usage now remains quite simple, e.g.: from negate import Negator
negator = Negator("de")
negator.negate_sentence("Es sieht gut aus.")Additional, language-dependent parameters can also be passed (they must be named): negator.negate_sentence("Ich habe eine Idee.", strategy="kein")It is still left to do some further code refactoring (since there are a number of repeated methods for both English and German), and write tests for German. In fact, there seem to be a number of bugs, e.g.: negator.negate_sentence("Ich habe Hunger.") # ['Ich habe keine Hunger.']
negator.negate_sentence("Es funktioniert!") # ['Es funktioimmerrt!']But in order not to make this PR too large, and since this is already a good beginning for German, this can be done in further PRs. Let me know if everything looks good to you and I will then merge it :) |
dmlls
force-pushed
the
main
branch
2 times, most recently
from
October 13, 2024 12:29
8ee59e5 to
8f6c521
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.