Last active
December 2, 2019 18:58
-
-
Save arushir/7c556220654aa8879f8d1c49ced34dd1 to your computer and use it in GitHub Desktop.
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
| # Run in command line: | |
| # mindmeld blueprint hr_assistant | |
| # python -m hr_assistant build | |
| # MindMeld NLP tutorial | |
| bp_path = 'hr_assistant' | |
| from mindmeld.components.nlp import NaturalLanguageProcessor | |
| nlp = NaturalLanguageProcessor(app_path=bp_path) | |
| nlp.load() | |
| from mindmeld.components.dialogue import Conversation | |
| conv = Conversation(nlp=nlp, app_path=bp_path) | |
| conv.say("Hi, how much does daniel make?") | |
| dc = nlp.domain_classifier | |
| stats = dc.evaluate() | |
| stats.print_stats() | |
| dc.config.to_dict() | |
| my_features = dc.config.features | |
| # See feature options: https://www.mindmeld.com/docs/userguide/domain_classifier.html#train-the-domain-classifier | |
| my_features_2 = {'in-gaz': {}} | |
| dc.fit(features=my_features_2) | |
| stats = dc.evaluate() | |
| stats.print_stats() | |
| dc.fit(features=my_features) | |
| # https://www.mindmeld.com/docs/userguide/intent_classifier.html#train-an-intent-classifier | |
| ic = nlp.domains['general'].intent_classifier | |
| # https://www.mindmeld.com/docs/userguide/entity_recognizer.html#train-an-entity-recognizer | |
| er = nlp.domains['general'].intents['get_employees'].entity_recognizer | |
| # MindMeld QA tutorial | |
| conv.say("Hi, how much does daniel make?") | |
| from mindmeld.components import QuestionAnswerer | |
| qa = QuestionAnswerer(app_path='hr_assistant') | |
| query = 'is there an online course on how to set goals?' | |
| qa.get(index='hr_faq_data', query_type='text', question=query)[0] | |
| qa.get(index='hr_faq_data', query_type='text', question=query, answer=query)[0] | |
| # Integration with Webex Teams | |
| # Create bot access token here: https://developer.webex.com/my-apps/new/bot | |
| # export BOT_ACCESS_TOKEN=<bot access token> | |
| # Create web hook here: https://developer.webex.com/docs/api/v1/webhooks/create-a-webhook | |
| # export WEBHOOK_ID=<webhook_id> | |
| # Run ngrok: ./ngrok http 8080 | |
| # Test on Webex Teams |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment