Skip to content

Commit

Permalink
method to get scorer name
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgesmr committed Dec 5, 2022
1 parent d66eaa4 commit aa85304
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scorers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Scorer(ABC):
def score(cls, scored_post: ScoredPost):
pass

@classmethod
def get_name(cls):
return cls.__name__.replace("Scorer", "")


class SimpleScorer(UniformWeight, Scorer):
@classmethod
Expand Down Expand Up @@ -97,4 +101,4 @@ def score(cls, scored_post: ScoredPost) -> ExtendedSimpleWeightedScorer:
def get_scorers():
all_classes = inspect.getmembers(importlib.import_module(__name__), inspect.isclass)
scorers = [c for c in all_classes if c[1] != Scorer and issubclass(c[1], Scorer)]
return {scorer[0].replace("Scorer", ""): scorer[1] for scorer in scorers}
return {scorer[1].get_name(): scorer[1] for scorer in scorers}

0 comments on commit aa85304

Please sign in to comment.