Version: 2.0.x

rasa.nlu.utils.spacy_utils

SpacyNLP Objects

class SpacyNLP(Component)

load_model

| @staticmethod
| load_model(spacy_model_name: Text) -> "Language"

Try loading the model, catching the OSError if missing.

merge_content_lists

| @staticmethod
| merge_content_lists(indexed_training_samples: List[Tuple[int, Text]], doc_lists: List[Tuple[int, "Doc"]]) -> List[Tuple[int, "Doc"]]

Merge lists with processed Docs back into their original order.

filter_training_samples_by_content

| @staticmethod
| filter_training_samples_by_content(indexed_training_samples: List[Tuple[int, Text]]) -> Tuple[List[Tuple[int, Text]], List[Tuple[int, Text]]]

Separates empty training samples from content bearing ones.

process_content_bearing_samples

| process_content_bearing_samples(samples_to_pipe: List[Tuple[int, Text]]) -> List[Tuple[int, "Doc"]]

Sends content bearing training samples to spaCy's pipe.

process_non_content_bearing_samples

| process_non_content_bearing_samples(empty_samples: List[Tuple[int, Text]]) -> List[Tuple[int, "Doc"]]

Creates empty Doc-objects from zero-lengthed training samples strings.

ensure_proper_language_model

| @staticmethod
| ensure_proper_language_model(nlp: Optional["Language"]) -> None

Checks if the spacy language model is properly loaded.

Raises an exception if the model is invalid.