Skip to content

Instantly share code, notes, and snippets.

@engelmav
Created February 7, 2018 04:43
Show Gist options
  • Select an option

  • Save engelmav/89f983ccf6dbd69a7c27865126a165dc to your computer and use it in GitHub Desktop.

Select an option

Save engelmav/89f983ccf6dbd69a7c27865126a165dc to your computer and use it in GitHub Desktop.

Revisions

  1. engelmav renamed this gist Feb 7, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. engelmav created this gist Feb 7, 2018.
    40 changes: 40 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    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)