This code is working well in my Mac, was trying to execute in windows environment (Python version 3.7.3), it throws an exception
ModuleNotFoundError Traceback (most recent call last) in 1 ##from rasa_nlu.training_data import load_data 2 import rasa_nlu ----> 3 from rasa.nlu.training_data import load_data 4 from rasa_nlu.config import RasaNLUModelConfig 5 from rasa_nlu.model import Trainer
ModuleNotFoundError: No module named ‘rasa’
code
import rasa_nlu
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu.model import Metadata, Interpreter
from rasa_nlu import config
def train_nlu(data, config, model_dir): training_data = load_data(data) trainer = Trainer(RasaNLUConfig(config)) trainer.train(training_data) model_directory = trainer.persist(model_dir, fixed_model_name = ‘weatherbot’)
def run_nlu(): interpreter = Interpreter.load(’./models/nlu/default/weatherbot’) print(interpreter.parse(“I am planning my holiday in Chennai, I wonder what is the weather out there.”))
if name == ‘main’: #train_nlu(’./data/data.json’, ‘config_spacy.json’, ‘./models/nlu’) training_data = load_data(’./data/data.json’) trainer = Trainer(config.load(‘config_spacy.json’)) trainer.train(training_data) model_directory = trainer.persist(’./models/nlu’ , fixed_model_name = ‘weatherbot’) run_nlu()
I had installed Rasa-nlu using pip3 command