Beispiel #1
0
    def __init__(self, component_config=None):
        if not component_config:
            component_config = {}

        # makes sure the name of the configuration is part of the config
        # this is important for e.g. persistence
        component_config["name"] = self.name

        self.component_config = config.override_defaults(
            self.defaults, component_config)

        self.partial_processing_pipeline = None
        self.partial_processing_context = None
Beispiel #2
0
    def __init__(self, component_config=None):
        if not component_config:
            component_config = {}

        # makes sure the name of the configuration is part of the config
        # this is important for e.g. persistence
        component_config["name"] = self.name

        self.component_config = config.override_defaults(
                self.defaults, component_config)

        self.partial_processing_pipeline = None
        self.partial_processing_context = None
Beispiel #3
0
    def create(cls,
               component_config: Dict[Text, Any],
               config: RasaNLUModelConfig) -> 'MitieNLP':
        import mitie

        component_config = override_defaults(cls.defaults, component_config)

        model_file = component_config.get("model")
        if not model_file:
            raise Exception("The MITIE component 'MitieNLP' needs "
                            "the configuration value for 'model'."
                            "Please take a look at the "
                            "documentation in the pipeline section "
                            "to get more info about this "
                            "parameter.")
        extractor = mitie.total_word_feature_extractor(model_file)
        cls.ensure_proper_language_model(extractor)

        return cls(component_config, extractor)
Beispiel #4
0
    def create(cls,
               component_config: Dict[Text, Any],
               config: RasaNLUModelConfig) -> 'SpacyNLP':
        import spacy

        component_config = override_defaults(cls.defaults, component_config)

        spacy_model_name = component_config.get("model")

        # if no model is specified, we fall back to the language string
        if not spacy_model_name:
            spacy_model_name = config.language
            component_config["model"] = config.language

        logger.info("Trying to load spacy model with "
                    "name '{}'".format(spacy_model_name))

        nlp = spacy.load(spacy_model_name, disable=['parser'])
        cls.ensure_proper_language_model(nlp)
        return cls(component_config, nlp)
Beispiel #5
0
 def for_component(self, name, defaults=None):
     for c in self.get('pipeline', []):
         if c.get("name") == name:
             return override_defaults(defaults, c)
     else:
         return defaults or {}
Beispiel #6
0
    def __init__(self, component_config=None):
        self.component_config = config.override_defaults(
            self.defaults, component_config)

        self.partial_processing_pipeline = None
        self.partial_processing_context = None
Beispiel #7
0
 def for_component(self, name, defaults=None):
     for c in self.get('pipeline', []):
         if c.get("name") == name:
             return override_defaults(defaults, c)
     else:
         return defaults or {}
Beispiel #8
0
    def __init__(self, component_config=None):
        self.component_config = config.override_defaults(
                self.defaults, component_config)

        self.partial_processing_pipeline = None
        self.partial_processing_context = None