Skip to content

feat: extract label aggregation#3363

Merged
tstadel merged 5 commits intomainfrom
aggregate_labels
Oct 13, 2022
Merged

feat: extract label aggregation#3363
tstadel merged 5 commits intomainfrom
aggregate_labels

Conversation

@tstadel
Copy link
Member

@tstadel tstadel commented Oct 11, 2022

Related Issues

Label aggregation is encapsulated into BaseDocumentStore's get_all_labels_aggregate and cannot be used outside the document store. Label aggregation should not be tied to DocumentStores.

Proposed Changes:

  • extract logic into method aggregate_labels of new module haystack.utils.labels
  • refactor
  • adjust docstrings

How it's used:

from haystack.utils import aggregate_labels

labels = fetch_labels()  # from anywhere, returns List[Label]
aggregated_labels = aggregate_labels(labels)  # returns List[MultiLabel]

How did you test it?

  • rely on existing tests of BaseDocumentStore.get_all_labels_aggregated()

Notes for the reviewer

  • None

Checklist

@tstadel tstadel marked this pull request as ready for review October 12, 2022 13:08
@tstadel tstadel requested a review from a team as a code owner October 12, 2022 13:08
@tstadel tstadel requested review from bogdankostic and removed request for a team October 12, 2022 13:08
@tstadel tstadel merged commit ba30971 into main Oct 13, 2022
@tstadel tstadel deleted the aggregate_labels branch October 13, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:eval type:feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants