Skip to content

Instantly share code, notes, and snippets.

@engelmav
Created February 7, 2018 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save engelmav/89f983ccf6dbd69a7c27865126a165dc to your computer and use it in GitHub Desktop.
Save engelmav/89f983ccf6dbd69a7c27865126a165dc to your computer and use it in GitHub Desktop.
from rasa_nlu.model import Interpreter, RasaNLUConfig
from rasa_core import utils
import logging
def test_loop(user_messages):
for message in user_messages:
result = interpreter.parse(message)
logger.info("test message: `{}`, result: {} with confidence {}".format(message, result['intent']['name'],
result['intent']['confidence']))
logger = logging.getLogger(__name__)
utils.configure_colored_logging(loglevel="INFO")
model_path = './models/nlu/default/jokerbot'
nlu_config_path = './nlu_model_config.json'
interpreter = Interpreter.load(model_path, RasaNLUConfig(nlu_config_path))
test_greetings = [
u"hey doucheface!",
u"hey asshole!",
u"hi guy",
u"hello sir",
u"what's up dude?",
u"good morning"
]
test_loop(test_greetings)
test_joke_reqs = [
"tell me a marriage joke",
"tell me a joke",
"give me a joke about marriage",
"tell me something about marriage",
"tell me a joke about holy matrimony",
"tell me something funny about marriage",
"what's a joke about marriage?",
"what's something funny?"
]
test_loop(test_joke_reqs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment