INNER CODE UNIT · Python
add_underspecified_label
NorskRegnesentral/skweak · skweak/aggregation.py:203
def add_underspecified_label(self, coarse_label: str, sub_labels: Set[str]):
"""Kept for backward compability purposes. The method add_label_group
should be preferred."""
self.add_label_group(coarse_label, sub_labels)
def _get_vote_matrix(self, include_underspec=True) -> Tuple[np.ndarray, np.ndarray]:
"""Creates a boolean matrice of shape (nb_observed_labels, nb_out_labels)
which specifies possible mappings between observed labels and actual
output labels.
If include_underspec is set to True, we also include "partial" votes due to
underspecified labels (e.g. ENT)."""
votes = np.zeros((len(self.observed_labels),
len(self.out_labels)), dtype=np.float32)
for i, label in enumerate(self.observed_labels):