Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Upgraded ChatBot #161

Merged
merged 1 commit into from
Aug 11, 2018
Merged

Upgraded ChatBot #161

merged 1 commit into from
Aug 11, 2018

Conversation

lunayach
Copy link
Member

@lunayach lunayach commented Jul 26, 2018

Description

Shifted to new more robust and scalable ChatBot built on top of Rasa Core using Rasa NLU as processing pipeline.

Fixes #132, #133

Type of Change:

  • Code
  • Outreach
  • Documentation
  • This change requires a documentation update (software upgrade on readme file)
  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

Evaluated the model using cross-validation.
Precision, f1-score, Confusion matrix etc. were recorded.

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules
    blank diagram

@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@systers systers deleted a comment Jul 26, 2018
@@ -0,0 +1,23 @@
run:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work for both python 2 and 3?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should Integrate it as part of travis build. Opinions @Raxerz @paavininanda @Buddhiprabha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shreyans29 what purpose shall it serve?
I have created this make file just to map larger python commands to shorter make commands.
i.e. instead of python bot.py run, you can call make run

Copy link
Member Author

@lunayach lunayach Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Raxerz it supports both Python 2 and 3.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay.. about version, rasa has support for both, but you must have chosen one of those and moved ahead with it right? APIs for python 2 and python 3 are different. I doubt we can build this code with both.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shreyans29 I had used Python 3. And accordingly recommended this in the Documentation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.. I am saying that this code won't work with python 2. If you used python 3 which is a nice decision, everyone contributing in future will have to use python 3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay! Got it.

utter_ask_name:
- "What's your name?"
utter_ask_gender:
- "About you, male or female?"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess since we have the option of a third gender then we may have to ask this differently like "May I know your gender?"

"prev_utter_ask_age",
"prev_check_age"
]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

@@ -0,0 +1 @@
{"py/object": "rasa_core.featurizers.MaxHistoryTrackerFeaturizer", "max_history": 3, "remove_duplicates": true, "state_featurizer": {"py/object": "rasa_core.featurizers.BinarySingleStateFeaturizer", "input_state_map": {"entity_age": 16, "entity_medicine": 15, "intent_Female": 13, "intent_Male": 12, "intent_affirm": 10, "intent_botPlace": 4, "intent_deny": 11, "intent_gender": 9, "intent_goodbye": 2, "intent_greet": 0, "intent_identity": 3, "intent_informThird": 14, "intent_intro": 6, "intent_medicines": 7, "intent_prevent": 5, "intent_safeMedicine": 8, "intent_thankyou": 1, "prev_action_listen": 20, "prev_action_patient_information": 34, "prev_action_restart": 21, "prev_action_suggest_normal": 36, "prev_action_suggest_pregnant": 35, "prev_check_age": 38, "prev_utter_ask_age": 37, "prev_utter_ask_gender": 32, "prev_utter_ask_name": 31, "prev_utter_ask_pregnant": 33, "prev_utter_default": 22, "prev_utter_goodbye": 24, "prev_utter_greet": 23, "prev_utter_identity": 26, "prev_utter_intro": 29, "prev_utter_medicines": 30, "prev_utter_place": 27, "prev_utter_prevent": 28, "prev_utter_youarewelcome": 25, "slot_age_0": 17, "slot_matches_0": 18, "slot_requested_slot_0": 19}, "num_features": 39, "slot_feature_len": 3, "user_feature_len": 17}, "use_intent_probabilities": false}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line at the end of the file

@@ -0,0 +1 @@
{"class_name": "Sequential", "config": [{"class_name": "Masking", "config": {"name": "masking_1", "trainable": true, "batch_input_shape": [null, 3, 39], "dtype": "float32", "mask_value": -1}}, {"class_name": "LSTM", "config": {"name": "lstm_1", "trainable": true, "return_sequences": false, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "units": 32, "activation": "tanh", "recurrent_activation": "hard_sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "VarianceScaling", "config": {"scale": 1.0, "mode": "fan_avg", "distribution": "uniform", "seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.2, "recurrent_dropout": 0.0, "implementation": 1}}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "batch_input_shape": [null, 32], "dtype": "float32", "units": 19, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "VarianceScaling", "config": {"scale": 1.0, "mode": "fan_avg", "distribution": "uniform", "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Activation", "config": {"name": "activation_1", "trainable": true, "activation": "softmax"}}], "keras_version": "2.2.0", "backend": "tensorflow"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

@@ -0,0 +1,5 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

"rasa_core.policies.memoization.MemoizationPolicy",
"rasa_core.policies.keras_policy.KerasPolicy"
]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

"training_data": "training_data.json",
"trained_at": "20180725-005152",
"rasa_nlu_version": "0.12.0"
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

#- name: "ner_synonyms"
#- name: "intent_entity_featurizer_regex"
#- name: "intent_featurizer_mitie"
#- name: "intent_classifier_sklearn"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line




#language: "en"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are all these comments required?

{
"intent": "botPlace",
"text": "Where you?"
}, {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the opening braces for this block should be on a new line

- Hola
- Ola


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two new lines added..

- why specify?
- will not tell


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two newlines in so many files..

this.messages.push({message: {text: sentMessage}, status: 'sent-message'});
if (localStorage.getItem(DoctorchatComponent._localStorageKey)) {
this._botService.getIntent(sentMessage).subscribe(intent => {
this._botService.getResponse(sentMessage).subscribe(text => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a default timeout.. or some error handling done here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, done in the service code.

@Raxerz
Copy link

Raxerz commented Aug 9, 2018

@lunayach
I am getting the following error:

ERROR Error: Cannot find a differ supporting object 'function link() { [native code] }' of type 'link'. NgFor only supports binding to Iterables such as Arrays.
    at NgForOf.push../node_modules/@angular/common/fesm5/common.js.NgForOf.ngOnChanges (common.js:3379)
    at checkAndUpdateDirectiveInline (core.js:10093)
    at checkAndUpdateNodeInline (core.js:11363)
    at checkAndUpdateNode (core.js:11325)
    at debugCheckAndUpdateNode (core.js:11962)
    at debugCheckDirectivesFn (core.js:11922)
    at Object.View_DoctorchatComponent_3._co [as updateDirectives] (DoctorchatComponent.html:10)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:11914)
    at checkAndUpdateView (core.js:11307)

Am I missing something here? Can you please look into it?

@lunayach
Copy link
Member Author

@Raxerz did you start the Bot server after installing all the dependencies.

@Raxerz
Copy link

Raxerz commented Aug 10, 2018

@lunayach fix the conflict and can you share the steps to set up the bot server

@lunayach
Copy link
Member Author

@Raxerz you may follow the steps given in the beginning of the ChatBot wiki, https://github.com/systers/PC-Prep-Kit/wiki/ChatBot-Documentation
And when exactly this error comes? Like, during querying the bot? etc.

@lunayach lunayach force-pushed the ChatBotUpgrade branch 8 times, most recently from 154b2fd to a281fab Compare August 10, 2018 20:39
@lunayach
Copy link
Member Author

Addressed comments.

"prev_action_check_medicine_normal",
"prev_action_check_medicine_pregnant"
]
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an autogenerated model file.

"prev_action_check_medicine_normal",
"prev_action_check_medicine_pregnant"
]
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these autogenerated.. if not add a new line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an autogenerated model file.

shreyans29
shreyans29 previously approved these changes Aug 11, 2018
Copy link

@shreyans29 shreyans29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor new line issues. You have to confirm if the files are autogenerated.

@shreyans29
Copy link

@paavininanda @Raxerz this can also be reviewed and merged.. have alook

paavininanda
paavininanda previously approved these changes Aug 11, 2018
Copy link
Member

@paavininanda paavininanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change otherwise looks good.

- What is this?
- Mosquito transmitted diseases


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra new line here

Copy link
Member

@paavininanda paavininanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shreyans29 This can be merged now 👍

@shreyans29 shreyans29 merged commit c08f70f into systers:gsoc18 Aug 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants