This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import PuLP | |
| from pulp import * | |
| # Create the 'prob' variable to contain the problem data | |
| prob = LpProblem("The Miracle Worker", LpMaximize) | |
| # Create problem variables | |
| x=LpVariable("Medicine_1_units",0,None,LpInteger) | |
| y=LpVariable("Medicine_2_units",0, None, LpInteger) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {'intent': {'name': 'query_days_in_month', 'confidence': 0.6128492334410716}, 'entities': [{'start': 17, 'end': 24, 'value': 'january', 'entity': 'month', 'confidence': 0.5002208121139594, 'extractor': 'ner_crf'}], 'intent_ranking': [{'name': 'query_days_in_month', 'confidence': 0.6128492334410716}, {'name': 'bye', 'confidence': 0.1951941314517159}, {'name': 'greet', 'confidence': 0.19195663510721267}], 'text': 'How many days in January'} | |
| {'intent': {'name': 'query_days_in_month', 'confidence': 0.6105606961005596}, 'entities': [{'start': 17, 'end': 22, 'value': 'march', 'entity': 'month', 'confidence': 0.5002208121139594, 'extractor': 'ner_crf'}], 'intent_ranking': [{'name': 'query_days_in_month', 'confidence': 0.6105606961005596}, {'name': 'bye', 'confidence': 0.20686031746694789}, {'name': 'greet', 'confidence': 0.18257898643249237}], 'text': 'How many days in March' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Loading the Agent | |
| rasaNLU = RasaNLUInterpreter("models/nlu/default/chat") | |
| agent = Agent.load("models/dialogue", interpreter= rasaNLU) | |
| # asking question | |
| agent.handle_message('Hi') | |
| >>> [{'recipient_id': 'default', 'text': 'Hey'}] | |
| # once more | |
| agent.handle_message('How many days in January') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Imports | |
| #----------- | |
| # rasa core | |
| import logging | |
| from rasa_core import training | |
| from rasa_core.actions import Action | |
| from rasa_core.agent import Agent | |
| from rasa_core.domain import Domain | |
| from rasa_core.policies.keras_policy import KerasPolicy | |
| from rasa_core.policies.memoization import MemoizationPolicy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## story1 | |
| * greet | |
| - utter_greet | |
| * query_days_in_month{"month":"January"} | |
| - utter_answer_31_days | |
| * query_days_in_month{"month":"February"} | |
| - utter_answer_28_days | |
| * query_days_in_month{"month":"April"} | |
| - utter_answer_30_days | |
| * bye |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| intents: | |
| # place your intents | |
| - greet | |
| - query_days_in_month | |
| - bye | |
| entities: | |
| # place your entities | |
| - month |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipeline: "spacy_sklearn" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Imports | |
| #----------- | |
| # 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 import config | |
| from rasa_nlu.model import Metadata, Interpreter | |
| # Functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # loading the interpreter | |
| interpreter = Interpreter.load('./models/nlu/default/chat') | |
| # define function to ask question | |
| def ask_question(text): | |
| print(interpreter.parse(text)) | |
| # asking question | |
| ask_question("How many days in January") | |
| ask_question("How many days in March") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## intent:greet | |
| - Hi | |
| - Hey | |
| ## intent:query_days_in_month | |
| - How many days in [January](month) | |
| - How many days in [Feb](month) | |
| ## intent:bye | |
| - Bye |