Python rasa_nlu.config.RasaNLUConfig() Examples
The following are 9
code examples of rasa_nlu.config.RasaNLUConfig().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rasa_nlu.config
, or try the search function
.
Example #1
Source File: train_online.py From rasa_wechat with Apache License 2.0 | 6 votes |
def parse(self, message): interpreter = Interpreter.load(nlu_model_path, RasaNLUConfig("../mom/nlu_model_config.json")) intent = interpreter.parse(message) return intent # return { # "text": message, # "intent": {"name": intent, "confidence": 1.0}, # "entities": [] # }
Example #2
Source File: train_nlu.py From rasa_wechat with Apache License 2.0 | 5 votes |
def train(): training_data = load_data('../mom/data/nlu.json') trainer = Trainer(RasaNLUConfig("../mom/nlu_model_config.json")) trainer.train(training_data) model_directory = trainer.persist('../models') # Returns the directory the model is stored in return model_directory
Example #3
Source File: train_nlu.py From rasa_wechat with Apache License 2.0 | 5 votes |
def predict(model_directory): from rasa_nlu.model import Metadata, Interpreter # where `model_directory points to the folder the model is persisted in interpreter = Interpreter.load(model_directory, RasaNLUConfig("../mom/nlu_model_config.json")) print (interpreter.parse("salad")) # model_directory = train() # print (model_directory)
Example #4
Source File: test.py From rasa_wechat with Apache License 2.0 | 5 votes |
def parse(self, message): interpreter = Interpreter.load(nlu_model_path, RasaNLUConfig("../mom/nlu_model_config.json")) intent = interpreter.parse(message) return intent
Example #5
Source File: train_nlu.py From rasa_wechat with Apache License 2.0 | 5 votes |
def train_babi_nlu(): training_data = load_data('examples/babi/data/franken_data.json') trainer = Trainer(RasaNLUConfig("examples/babi/data/config_nlu.json")) trainer.train(training_data) model_directory = trainer.persist('examples/babi/models/nlu/', fixed_model_name=model_name) return model_directory
Example #6
Source File: interpreter.py From rasa_wechat with Apache License 2.0 | 5 votes |
def parse(self, text): """Parses a text message. Returns a nlu value if the parsing of the text failed.""" if self.lazy_init and self.interpreter is None: from rasa_nlu.model import Interpreter from rasa_nlu.config import RasaNLUConfig self.interpreter = Interpreter.load(self.metadata, RasaNLUConfig(self.config_file, os.environ)) return self.interpreter.parse(text)
Example #7
Source File: yaha_tokenizer.py From Rasa_NLU_Chi with Apache License 2.0 | 5 votes |
def train(self, training_data, config, **kwargs): # type: (TrainingData, RasaNLUConfig, **Any) -> None if config['language'] != 'zh': raise Exception("tokenizer_yaha is only used for Chinese. Check your configure json file.") for example in training_data.training_examples: example.set("tokens", self.tokenize(example.text))
Example #8
Source File: rasa_classifier.py From JusticeAI with MIT License | 5 votes |
def __init__(self): self.rasa_config = RasaNLUConfig(self.config_file) self.trainer = Trainer(self.rasa_config, self.builder)
Example #9
Source File: rasa.py From bot with MIT License | 5 votes |
def __init__(self, data_provider, config_file, data_file, model_dir): logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s') # store unparsed messages, so later we can train bot self.unparsed_messages = [] self.data_provider = data_provider self.data_file = data_file self.model_dir = model_dir self.rasa_config = RasaNLUConfig(config_file)