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

BanCompetitors constructor model argument is unintuitive #91

Open
baggiponte opened this issue Feb 9, 2024 · 4 comments
Open

BanCompetitors constructor model argument is unintuitive #91

baggiponte opened this issue Feb 9, 2024 · 4 comments

Comments

@baggiponte
Copy link

baggiponte commented Feb 9, 2024

The BanCompetitors scanner accepts the following arguments:

def __init__(
        competitors: Sequence[str],
        *,
        threshold: float = 0.5,
        redact: bool = True,
        model: Optional[Dict] = None,
): ...

The model argument is unclear. I would suggest replacing the argument with a Literal (or an enum), like so:

SpanMarkerModel = Literal["tomaarsen/span-marker-bert-base-orgs", "tomaarsen/span-marker-bert-small-orgs"]

def __init__(
        competitors: Sequence[str],
        *,
        threshold: float = 0.5,
        redact: bool = True,
        model: Optional[SpanMarkerModel] = None,
): ...

And replace this not in check with the following:

from typing import get_args

if model not in get_args(SpanMarkerModel):
...
@asofter
Copy link
Collaborator

asofter commented Feb 9, 2024

Hey @baggiponte , that's a great suggestion. Thanks for that. Will implement

@baggiponte
Copy link
Author

Thanks! This might apply to FactualRelevance here. Rather than a tuple, it might be a Literal["base", "large", "small"].

@asofter
Copy link
Collaborator

asofter commented Apr 9, 2024

I introduced a Model object which will be further improved in the next versions.

@baggiponte
Copy link
Author

I saw the repo yesterday, this is cool! Is it documented already?

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

No branches or pull requests

2 participants