notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.8.x).

Version: Master/Unreleased

rasa.nlu.featurizers.featurizer

Featurizer2 Objects

class Featurizer2(Generic[FeatureType], ABC)

Base class for all featurizers.

get_default_config

@staticmethod
def get_default_config() -> Dict[Text, Any]

Returns the component's default config.

__init__

def __init__(name: Text, config: Dict[Text, Any]) -> None

Instantiates a new featurizer.

Arguments:

  • config - configuration
  • name - a name that can be used as identifier, in case the configuration does not specify an alias (or this alias is None)

validate_config

@classmethod
@abstractmethod
def validate_config(cls, config: Dict[Text, Any]) -> None

Validates that the component is configured properly.

validate_compatibility_with_tokenizer

@classmethod
@abstractmethod
def validate_compatibility_with_tokenizer(cls, config: Dict[Text, Any], tokenizer_type: Type[Tokenizer]) -> None

Validates that the featurizer is compatible with the given tokenizer.

add_features_to_message

def add_features_to_message(sequence: FeatureType, sentence: Optional[FeatureType], attribute: Text, message: Message) -> None

Adds sequence and sentence features for the attribute to the given message.

Arguments:

  • sequence - sequence feature matrix
  • sentence - sentence feature matrix
  • attribute - the attribute which both features describe
  • message - the message to which we want to add those features

validate_configs_compatible

@staticmethod
def validate_configs_compatible(featurizer_configs: Iterable[Dict[Text, Any]]) -> None

Validates that the given configurations of featurizers can be used together.

Raises:

InvalidConfigException if the given featurizers should not be used in the same graph.