コード例 #1
0
ファイル: multi_project.py プロジェクト: zuiwanting/rasa
    def _init_from_file(self, path: Text) -> None:
        path = os.path.abspath(path)
        if os.path.exists(path) and data.is_config_file(path):
            config = io_utils.read_config_file(path)

            parent_directory = os.path.dirname(path)
            self._init_from_dict(config, parent_directory)
        else:
            raise_warning(f"'{path}' does not exist or is not a valid config file.")
コード例 #2
0
    def _from_file(cls, path: Text, skill_selector: "SkillSelector") -> "SkillSelector":
        path = os.path.abspath(path)
        if os.path.exists(path) and data.is_config_file(path):
            config = io_utils.read_yaml_file(path)

            if isinstance(config, dict):
                parent_directory = os.path.dirname(path)
                return cls._from_dict(config, parent_directory, skill_selector)

        return cls.all_skills()
コード例 #3
0
ファイル: skill.py プロジェクト: zhiyuxzh/rasa
    def _from_directory(cls, path: Text,
                        skill_selector: "SkillSelector") -> "SkillSelector":
        for parent, _, files in os.walk(path):
            for file in files:
                full_path = os.path.join(parent, file)

                if data.is_config_file(
                        full_path) and skill_selector.is_imported(full_path):
                    skill_selector = cls._from_file(full_path, skill_selector)

        return skill_selector
コード例 #4
0
ファイル: skill.py プロジェクト: psds01/rasa_custom
    def _from_file(cls, path: Text,
                   skill_selector: "SkillSelector") -> "SkillSelector":
        from rasa import data  # pytype: disable=pyi-error

        path = os.path.abspath(path)
        if os.path.exists(path) and data.is_config_file(path):
            config = io_utils.read_config_file(path)

            parent_directory = os.path.dirname(path)
            return cls._from_dict(config, parent_directory, skill_selector)

        return cls.all_skills()
コード例 #5
0
    def _init_from_directory(self, path: Text):
        for parent, _, files in os.walk(path):
            for file in files:
                full_path = os.path.join(parent, file)
                if not self.is_imported(full_path):
                    # Check next file
                    continue

                if data.is_domain_file(full_path):
                    self._domain_paths.append(full_path)
                elif data.is_nlu_file(full_path):
                    self._nlu_paths.append(full_path)
                elif data.is_story_file(full_path):
                    self._story_paths.append(full_path)
                elif data.is_config_file(full_path):
                    self._init_from_file(full_path)
コード例 #6
0
ファイル: multi_project.py プロジェクト: sanaayakurup/rasa-1
    def _init_from_directory(self, path: Text):
        for parent, _, files in os.walk(path, followlinks=True):
            for file in files:
                full_path = os.path.join(parent, file)
                if not self.is_imported(full_path):
                    # Check next file
                    continue

                if data.is_end_to_end_conversation_test_file(full_path):
                    self._e2e_story_paths.append(full_path)
                elif Domain.is_domain_file(full_path):
                    self._domain_paths.append(full_path)
                elif data.is_nlu_file(full_path):
                    self._nlu_paths.append(full_path)
                elif data.is_story_file(full_path):
                    self._story_paths.append(full_path)
                elif data.is_config_file(full_path):
                    self._init_from_file(full_path)