Skip to content

[FEATURE] The ability to extend ModelInputType, Language, etc... #56

Description

@workforcedeveloper

Problem

Is your proposal tackling an existing problem or limitation?

  • Yes, the problem is that when I am building tasks and want to add additional languages or model input types but can't because I can't monkey-patch additions because they're enums. Take for instance the following code:
from workrb.types import Language

class AfricanLanguages(Language):
    SW = "sw"

This code doesn't work because Language is an enum.

For example, when looking at the function signatures of the base classification tasks and base ranking tasks:

@abstractmethod
    def input_type(self) -> ModelInputType:
        """Input type for texts in the classification task."""

it's required for the return type to be a ModelInputType, but there's no way to add additional ModelInputTypes or Languages.

Proposal

Describe what you would like to see happen.

Open to other ideas, but my immediate thought is to simply remove the Enum from types so that individuals can then extend the enum classes and add an additional feature.

  • Type:

    • New Ontology (data source for multiple tasks)
    • New Task(s)
    • New Model(s)
    • New Metric(s)
    • Other
  • Area(s) of code: paths, modules, or APIs you expect to touch

Alternatives

Have you considered other approaches? Briefly list them and why you did not choose them.

Additional Context

Links to related issues, PRs, docs, or external references.
Screenshots or small examples if useful.

Implementation

  • I plan to implement this in a PR
  • I am proposing the idea and would like someone else to pick it up

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions