Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

GSoC 2019 Phase 1, 2 & 3 work submission#14

Open
iosdev747 wants to merge 91 commits into
openMF:masterfrom
iosdev747:master
Open

GSoC 2019 Phase 1, 2 & 3 work submission#14
iosdev747 wants to merge 91 commits into
openMF:masterfrom
iosdev747:master

Conversation

@iosdev747
Copy link
Copy Markdown

@iosdev747 iosdev747 commented Jun 22, 2019

overview:

  • integrate facebook messenger
  • integrate slack
  • integrate telegram
  • authentication solution using SQL
  • create Rasa dataset
  • create Rasa NLU model.
  • integrate Rasa NLU model with chatbot (handlers)
  • small talk dataset
  • small talk integration

Fixes:
#9 #11 #13 and #12

@iosdev747 iosdev747 changed the title GSoC 2019 Phase 1 & 2 work submission GSoC 2019 Phase 1, 2 & 3 work submission Aug 10, 2019
import org.mifos.chatbot.core.model.Intent;

class SmallTalk {
private static final String[] SMALL_TALK_INTENTS = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we move this to a static file for logical separation, and easy modification later.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

made interface SmallTalkService for that. And moved isSmallTalkRequest from SmallTalk.java to SmallTalkHandler.

@Component
public class ArrearDayHandler extends BaseLoanIntentHandler {
private static final String[] INTENT_KEYWORDS = {"arrear", "day"};
private static final String[] INTENT_KEYWORDS = {"arrear_day"};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Move to static file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This INTENT_KEYWORDS is specific for this class, so my intention is to keep it here or should i move it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Keep it here then.

@Component
public class ClientActivationDateHandler extends BaseLoanIntentHandler {
private static final String[] INTENT_KEYWORDS = {"client", "activation", "date"};
private static final String[] INTENT_KEYWORDS = {"client_activation_date"};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All such hard coded strings to static files

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

same as above.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved

@Component
public class NextDueDateHandler extends BaseLoanIntentHandler {
private static final String[] INTENT_KEYWORDS = {"Due", "Date"};
private static final String[] INTENT_KEYWORDS = {"due_date"};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

potentially add stemming/lemmatization based matching for these intent keywords?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

same as above.

String intentKeyword = intent.getKeyword().toLowerCase();
MifosResponse mifosResponse = new MifosResponse();
for(int i=0; i<INTENT_KEYWORDS.length; i++) {
if(intentKeyword.equals(INTENT_KEYWORDS[i])) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can override equals to an approx equals function here which includes some stemming/lemmatization/general intent based matching rather than exact matches.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These is used to match the intent names predicted by rasa NLU model (most confident one) and those intent names are defined in Rasa dataset (rasa/data/nlu.md) as well as SmallTalkService.java (org/mifos/chatbot/core/SmallTalkService.java) so that's why i used equal rather than partial equal. And for lemmatization i am now using spacy.lemma

Comment thread README.md
```
create table users_creds
(
username varchar(255) not null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can potentially look into encrypting these fields at the database level for when we want to extend this work.

@Component
public class ArrearDayHandler extends BaseLoanIntentHandler {
private static final String[] INTENT_KEYWORDS = {"arrear", "day"};
private static final String[] INTENT_KEYWORDS = {"arrear_day"};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Keep it here then.

@Component
public class ClientActivationDateHandler extends BaseLoanIntentHandler {
private static final String[] INTENT_KEYWORDS = {"client", "activation", "date"};
private static final String[] INTENT_KEYWORDS = {"client_activation_date"};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved

for (String token : input.split(" ")) {
try {
id = Long.parseLong(token);
} catch (NumberFormatException e) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be handled, ideally. If this isn't expected, you should trigger some sort of alerting.


@Override
public void onUpdateReceived(Update update) {
if (update.hasMessage() && update.getMessage().hasText()) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved

@sabya48
Copy link
Copy Markdown

sabya48 commented Jan 23, 2020

i want to contribute int this project.
hello my name is sabyasachi sarkar from IIT Patna

@iosdev474
Copy link
Copy Markdown

Can this PR be merged so further progress could be done please?

@vidakovic
Copy link
Copy Markdown
Collaborator

vidakovic commented Feb 29, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants