def load_entity(self, name, *args, **kwargs): """ Loads an entity, optionally checking the cache first Args: name (str): The associated name of the entity file_name (str): The location of the entity file reload_cache (bool): Whether to refresh all of cache """ Entity.verify_name(name) self.entities.load(Entity.wrap_name(name), *args, **kwargs)
def load_entity(self, name, file_name, reload_cache=False): """ Loads an entity, optionally checking the cache first Args: name (str): The associated name of the entity file_name (str): The location of the entity file reload_cache (bool): Whether to refresh all of cache """ Entity.verify_name(name) self.entities.load(Entity.wrap_name(name), file_name, reload_cache) with open(file_name) as f: self.padaos.add_entity(name, f.read().split('\n'))
def add_entity(self, name, *args, **kwargs): """ Adds an entity that matches the given lines. Example: self.add_intent('weather', ['will it rain on {weekday}?']) self.add_entity('{weekday}', ['monday', 'tuesday', 'wednesday']) # ... Args: name (str): The name of the entity lines (list<str>): Lines of example extracted entities reload_cache (bool): Whether to refresh all of cache """ Entity.verify_name(name) self.entities.add(Entity.wrap_name(name), *args, **kwargs)
def load_entity(self, name, file_name, reload_cache=False, must_train=True): """ Loads an entity, optionally checking the cache first Args: name (str): The associated name of the entity file_name (str): The location of the entity file reload_cache (bool): Whether to refresh all of cache must_train (bool): Whether to dismiss model if present and train from scratch again """ Entity.verify_name(name) self.entities.load(Entity.wrap_name(name), file_name, reload_cache) with open(file_name) as f: self.padaos.add_entity(name, f.read().split('\n')) self.must_train = must_train
def add_entity(self, name, lines, reload_cache=False, must_train=True): """ Adds an entity that matches the given lines. Example: self.add_intent('weather', ['will it rain on {weekday}?']) self.add_entity('weekday', ['monday', 'tuesday', 'wednesday']) # ... Args: name (str): The name of the entity lines (list<str>): Lines of example extracted entities reload_cache (bool): Whether to refresh all of cache must_train (bool): Whether to dismiss model if present and train from scratch again """ Entity.verify_name(name) self.entities.add(Entity.wrap_name(name), lines, reload_cache, must_train) self.padaos.add_entity(name, lines) self.must_train = must_train