INNER CODE UNIT · Python
__init__
NorskRegnesentral/skweak · skweak/aggregation.py:22
def __init__(self, name: str, labels: List[str]):
"""Creates a new aggregator with the following arguments:
- name is the aggregator name
- labels is a list of output labels to aggregate, such as PERSON, ORG etc.
Labels that are not mentioned here are ignored.
"""
super(AbstractAggregator, self).__init__(name)
if len(labels)==0:
raise RuntimeError("Must have at least one label")
self.out_labels = labels
# We start by assuming that the list of labels produced by the
# labelling functions ("observed labels") and the output labels
# after the aggregation are the same
self.observed_labels = list(labels)
# we may also have label groups (for underspecified/overspecified labels)
self.label_groups = {}