rasa/core/featurizers/tracker_featurizers.py
File tracker_featurizers.py
has 936 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
from __future__ import annotations
from pathlib import Path
from collections import defaultdict
from abc import abstractmethod
import jsonpickle
Function create_state_features
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_state_features(
Function prediction_states
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def prediction_states(
Function prediction_states
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def prediction_states(
Function prediction_states
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def prediction_states(
Function prediction_states
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def prediction_states(
Function featurize_trackers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def featurize_trackers(
Function _extract_examples
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _extract_examples(
Function training_states_labels_and_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def training_states_labels_and_entities(
Function training_states_labels_and_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def training_states_labels_and_entities(
Function _extract_examples
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _extract_examples(
Function training_states_labels_and_entities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def training_states_labels_and_entities(
Function _remove_user_text_if_intent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _remove_user_text_if_intent(trackers_as_states: List[List[State]]) -> None:
"""Deletes user text from state dictionaries if intent is present.
Only featurizing either the intent or user text is currently supported. When
both are present in a state, the user text is removed so that only the intent
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"