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

Refactor code and add German negation #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

MiriUll
Copy link
Collaborator

@MiriUll MiriUll commented Mar 6, 2024

  • 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

@dmlls
Copy link
Owner

dmlls commented Apr 3, 2024

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 negators.

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 dmlls force-pushed the german_negation branch from 3858b4c to 7977b15 Compare April 3, 2024 13:48
@dmlls dmlls force-pushed the main branch 2 times, most recently from 8ee59e5 to 8f6c521 Compare October 13, 2024 12:29
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.

2 participants