Esempio n. 1
0
    def train(self, filename=None, **kwargs):
        # type: (Optional[Text], **Any) -> None
        """Train the policies / policy ensemble using dialogue data from file"""

        trainer = PolicyTrainer(self.policy_ensemble, self.domain,
                                self.featurizer)
        trainer.train(filename, **kwargs)
Esempio n. 2
0
    def train(self, filename=None, model_path=None, remove_duplicates=True, **kwargs):
        # type: (Optional[Text], Optional[Text], **Any) -> None
        """Train the policies / policy ensemble using dialogue data from file"""

        trainer = PolicyTrainer(self.policy_ensemble, self.domain,
                                self.featurizer)
        trainer.train(filename, **kwargs)

        if model_path:
            self.persist(model_path)
Esempio n. 3
0
def default_processor(default_domain):
    ensemble = SimplePolicyEnsemble([ScoringPolicy()])
    interpreter = RegexInterpreter()
    PolicyTrainer(ensemble, default_domain,
                  BinaryFeaturizer()).train(DEFAULT_STORIES_FILE,
                                            max_history=3)
    tracker_store = InMemoryTrackerStore(default_domain)
    return MessageProcessor(interpreter, ensemble, default_domain,
                            tracker_store)
Esempio n. 4
0
def test_message_processor(default_domain, capsys):
    story_filename = "data/dsl_stories/stories_defaultdomain.md"
    ensemble = SimplePolicyEnsemble([ScoringPolicy()])
    interpreter = RegexInterpreter()

    PolicyTrainer(ensemble, default_domain,
                  BinaryFeaturizer()).train(story_filename, max_history=3)

    tracker_store = InMemoryTrackerStore(default_domain)
    processor = MessageProcessor(interpreter, ensemble, default_domain,
                                 tracker_store)

    processor.handle_message(UserMessage("_greet", ConsoleOutputChannel()))
    out, _ = capsys.readouterr()
    assert "hey there!" in out
Esempio n. 5
0
def test_message_processor(default_domain, capsys):
    story_filename = "data/dsl_stories/stories_defaultdomain.md"
    ensemble = SimplePolicyEnsemble([ScoringPolicy()])
    interpreter = RegexInterpreter()

    PolicyTrainer(ensemble, default_domain,
                  BinaryFeaturizer()).train(story_filename, max_history=3)

    tracker_store = InMemoryTrackerStore(default_domain)
    processor = MessageProcessor(interpreter, ensemble, default_domain,
                                 tracker_store)

    out = CollectingOutputChannel()
    processor.handle_message(UserMessage("_greet[name=Core]", out))
    assert ("default", "hey there Core!") == out.latest_output()