def METHOD_NAME(
    training_data: TrainingData, use_only_entities: bool = False
) -> List[Dict[Text, Text]]:
    """Get regex features from training data.
    Args:
        training_data: The training data
        use_only_entities: If True only regex features with a name equal to a entity
          are considered.
    Returns:
        Regex features.
    """
    if not use_only_entities:
        return training_data.regex_features
    return [
        regex
        for regex in training_data.regex_features
        if regex["name"] in training_data.entities
    ]