hydra.utils.hydra

Utilities for the Hydra parser.

hydra.utils.hydra.category_names(segmentation: bool = False, lemmatisation: bool = False, tagging: bool = False, dependency: bool = False, graph: bool = False, hybrid: bool = False, nonterminal_features: list[str] | None = None, named_entities: bool = False) → list[str][source]

Return the list of categories predicted for each token in a given parser configuration.

Model output names will match those.

Parameters:
  • segmentation – enable segmentation module.

  • lemmatisation – enable lemmatisation module.

  • tagging – enable tagging module.

  • dependency – enable dependency parsing module.

  • graph – enable graph parsing module (extended/additional edges).

  • hybrid – enable hybrid syntactic parsing module.

  • nonterminal_features – nonterminal features to predict (experimental).

  • named_entities – enable NER module.

Returns:

list of category names.

hydra.utils.hydra.get_labels(features: Features, categories: list[str]) → dict[str, list[str]][source]

Collect possible label values for non-numeric categories from a dataset features signature.

Returns:

label values.

hydra.utils.hydra.get_param(config: dict[str, Any], key: str, alt_keys: list[str] | None = None, default: Any = None, allow_none: bool = False) → Any[source]

Retrieve parameter value from a trained model configuration.

Parameters:
  • config – a model configuration.

  • key – parameter to look up.

  • alt_keys – alternative/fallback keys for backward compatibility (warning isssued if used).

  • default – value to return if key is missing.

  • allow_none – admit None as parameter value.

Returns:

the parameter value.

Raises:

KeyError – if key and alt_keys are missing, default=None and allow_none=False.

hydra.utils.hydra.load_config(path: str) → dict[str, Any][source]

Load a trained Hydra model’s configuration.

Returns:

the config.