rasa/core/domain.py
def persist_clean(self, filename: Text) -> None:
        """Write domain to a file.

         Strips redundant keys with default values."""

        data = self.as_dict()

        for idx, intent_info in enumerate(data["intents"]):
            for name, intent in intent_info.items():
                if intent.get("use_entities"):
                    data["intents"][idx] = name

        for slot in data["slots"].values():
            if slot["initial_value"] is None:
                del slot["initial_value"]
            if slot["auto_fill"]:
                del slot["auto_fill"]
            if slot["type"].startswith('rasa.core.slots'):
                slot["type"] = Slot.resolve_by_type(slot["type"]).type_name

        if data["config"]["store_entities_as_slots"]:
            del data["config"]["store_entities_as_slots"]

        # clean empty keys
        data = {k: v
                for k, v in data.items()
                if v != {} and v != [] and v is not None}

        utils.dump_obj_as_yaml_to_file(filename, data)
Write domain to a file.

         Strips redundant keys with default values.
Write domain to a file.
Strips redundant keys with default values.
Write domain to a file . Strips redundant keys with default values .
def persist_clean(self, filename: Text) -> None:
        data = self.as_dict()
        for idx, intent_info in enumerate(data["intents"]):
            for name, intent in intent_info.items():
                if intent.get("use_entities"):
                    data["intents"][idx] = name
        for slot in data["slots"].values():
            if slot["initial_value"] is None:
                del slot["initial_value"]
            if slot["auto_fill"]:
                del slot["auto_fill"]
            if slot["type"].startswith('rasa.core.slots'):
                slot["type"] = Slot.resolve_by_type(slot["type"]).type_name
        if data["config"]["store_entities_as_slots"]:
            del data["config"]["store_entities_as_slots"]
        data = {k: v
                for k, v in data.items()
                if v != {} and v != [] and v is not None}
        utils.dump_obj_as_yaml_to_file(filename, data)
def persist_clean ( self , filename : Text ) -> None : data = self . as_dict ( ) for idx , intent_info in enumerate ( data [ "intents" ] ) : for name , intent in intent_info . items ( ) : if intent . get ( "use_entities" ) : data [ "intents" ] [ idx ] = name for slot in data [ "slots" ] . values ( ) : if slot [ "initial_value" ] is None : del slot [ "initial_value" ] if slot [ "auto_fill" ] : del slot [ "auto_fill" ] if slot [ "type" ] . startswith ( 'rasa.core.slots' ) : slot [ "type" ] = Slot . resolve_by_type ( slot [ "type" ] ) . type_name if data [ "config" ] [ "store_entities_as_slots" ] : del data [ "config" ] [ "store_entities_as_slots" ] data = { k : v for k , v in data . items ( ) if v != { } and v != [ ] and v is not None } utils . dump_obj_as_yaml_to_file ( filename , data )
Write domain to a file.
Write domain to a file .
"""Write domain to a file.

         Strips redundant keys with default values.""" # clean empty keys
self
filename
Text