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
| config = """ | |
| language: "en" | |
| pipeline: | |
| - name: "nlp_spacy" # loads the spacy language model | |
| - name: "tokenizer_spacy" # splits the sentence into tokens | |
| - name: "ner_crf" # uses the pretrained spacy NER model | |
| - name: "intent_featurizer_spacy" # transform the sentence into a vector representation | |
| - name: "intent_classifier_sklearn" # uses the vector representation to classify using SVM | |
| - name: "ner_synonyms" # trains the synonyms |
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
| 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 | |
| # loading the nlu training samples | |
| training_data = load_data("nlu.md") | |
| # trainer to educate our pipeline | |
| trainer = Trainer(config.load("config.yml")) |
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
| domain_yml = """ | |
| intents: | |
| - greet | |
| - goodbye | |
| - mood_affirm | |
| slots: | |
| group: | |
| type: text | |
| entities: |
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
| from rasa_core.actions import Action | |
| from rasa_core.events import SlotSet | |
| from IPython.core.display import Image, display | |
| import requests | |
| class ApiAction(Action): | |
| def name(self): | |
| return "action_retrieve_image" |
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
| from rasa_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy | |
| from rasa_core.agent import Agent | |
| # The fallback action will be executed if the intent recognition has #a confidence below nlu_threshold or if none of the dialogue #policies predict an action with confidence higher than #core_threshold. | |
| fallback = FallbackPolicy(fallback_action_name="utter_unclear", | |
| core_threshold=0.2, | |
| nlu_threshold=0.1) | |
| agent = Agent('domain.yml', policies=[MemoizationPolicy(), KerasPolicy(), fallback]) |
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
| from rasa_core.channels.slack import SlackInput | |
| from rasa_core.agent import Agent | |
| from rasa_core.interpreter import RasaNLUInterpreter | |
| import yaml | |
| from rasa_core.utils import EndpointConfig | |
| nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/current') | |
| action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") | |
| agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint) |
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
| from rasa_core.channels.slack import SlackInput | |
| from rasa_core.agent import Agent | |
| from rasa_core.interpreter import RasaNLUInterpreter | |
| import yaml | |
| from rasa_core.utils import EndpointConfig | |
| nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/current') | |
| action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") | |
| agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint) |
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
| articles = pd.DataFrame({ | |
| 'holiday': 'Article_Published', | |
| 'ds': pd.to_datetime(['2018-07-02', '2018-07-06', '2018-07-08', | |
| '2018-07-09', '2018-07-12', '2018-07-19', '2018-07-26', '2018-07-31', | |
| '2018-08-06', '2018-08-15', '2018-07-19', '2018-08-26', '2018-08-31', | |
| '2018-09-01', '2018-09-04', '2018-09-11', '2018-09-17', '2018-09-23', | |
| '2018-10-02', '2018-10-09', '2018-10-18', '2018-10-19', '2018-10-26', | |
| '2018-11-02', '2018-11-08', '2018-11-24', '2018-12-05', '2018-12-13', | |
| '2018-12-19', '2018-12-24', '2018-12-27', '2019-01-08', '2019-01-11', | |
| '2019-01-22', '2019-01-24', '2019-01-28', '2019-02-01', '2019-02-04', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.