How to use the nlu.messages.system_message.SystemMessage function in nlu

To help you get started, we’ve selected a few nlu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JoshRosen / cmps140_creative_cooking_assistant / nlu / messages / system_message.py View on Github external
def confidence(raw_input_string):
        return get_keyword_confidence(raw_input_string,
                                      SystemMessage.keywords,
                                      3)
github JoshRosen / cmps140_creative_cooking_assistant / nlu / messages / system_message.py View on Github external
def _parse(self, raw_input_string):
        """
        Fills out message meta and frame attributes
        """
       
        tokenizer = nltk.WordPunctTokenizer()
        tokenized_string = tokenizer.tokenize(raw_input_string)
        tagger = utils.combined_taggers
        tagged_string = tagger.tag(tokenized_string)

        wordActionMap = {'exit':SystemMessage.exit_keywords, 'restart':SystemMessage.restart_keywords}
        for action, keywords in wordActionMap.items():
            matches = extract_close_keywords(keywords, tokenized_string, 3)
            if matches: # synset of keyword was found in the sentence
                self.frame['action'] = action