Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added bot/__init__.py
Empty file.
64 changes: 19 additions & 45 deletions bot/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,24 @@
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/core/actions/#custom-actions/

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import spacy
#
#
nlp = spacy.load('en_core_web_sm')


class ActionSubjectCourses(Action):
def name(self) -> Text:
return "action_subject_courses"

def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
print('running action_subject_courses')
dispatcher.utter_message(template="utter_fetching_data")
print(tracker.latest_message.get('entities'))
elements = [{"type":"subject_courses","entities":tracker.latest_message.get('entities'), "intent" : "subject_courses"}]
dispatcher.utter_message(json_message=elements)
#dispatcher.utter_custom_message(*elements)
#dispatcher.utter_custom_json(elements)
return []



class FallbackAction(Action):
def name(self):
return "fallback_action"
# This is a simple example for a custom action which utters "Hello World!"

def run(self, dispatcher, tracker, domain):
intent_ranking = tracker.latest_message.get('intent_ranking', [])
doc = nlp(tracker.latest_message.get('text'))
nouns = []
adjs = []
for token in doc:
if token.pos_ == 'NOUN':
nouns.append(token.text)
if token.pos_ == 'ADJ':
adjs.append(token.text)
if len(intent_ranking) > 0 :
elements = [{"type":"low_confidence","entities":nouns, "adj":adjs, "intent" : "low_confidence"}]
dispatcher.utter_message(json_message=elements)
else :
elements = [{"type":"low_confidence","entities":nouns, "adj":adjs, "intent" : "low_confidence"}]
dispatcher.utter_message(json_message=elements)
# from typing import Any, Text, Dict, List
#
# from rasa_sdk import Action, Tracker
# from rasa_sdk.executor import CollectingDispatcher
#
#
# class ActionHelloWorld(Action):
#
# def name(self) -> Text:
# return "action_hello_world"
#
# def run(self, dispatcher: CollectingDispatcher,
# tracker: Tracker,
# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
#
# dispatcher.utter_message(text="Hello World!")
#
# return []
31 changes: 16 additions & 15 deletions bot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
- name: "WhitespaceTokenizer"
- name: "RegexFeaturizer"
- name: "CRFEntityExtractor"
- name: "EntitySynonymMapper"
- name: "CountVectorsFeaturizer"
- name: "CountVectorsFeaturizer"
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
- name: "EmbeddingIntentClassifier"
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 100

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
- name: MemoizationPolicy
- name: KerasPolicy
- name: TEDPolicy
max_history: 5
epochs: 100
- name: MappingPolicy
- name: FallbackPolicy
nlu_threshold: 0.7
core_threshold: 0.5
fallback_action_name: "fallback_action"
6 changes: 3 additions & 3 deletions bot/credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ rest:

#mattermost:
# url: "https://<mattermost instance>/api/v4"
# team: "<mattermost team>"
# user: "<bot username>"
# pw: "<bot token>"
# token: "<bot token>"
# webhook_url: "<callback URL>"

# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
207 changes: 79 additions & 128 deletions bot/data/nlu.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,143 +5,94 @@
- good morning
- good evening
- hey there
- good after noon
- good evening
- hi there
- wassup
- what's up
- namaste
- vanakkam

## intent:how_you
- how are you
- how you doing
- how do you do
- whats up
- how is it going
- how are you today
- How have you been?
- whassup
- What are you up to

##intent: find_and_play_content
- find and play content
- Find and play content

##intent: download_update_diska_app
- download update the DIKSHA mobile app
- Download/update the DIKSHA mobile app

##intent: other_queries
- other queries
- Other Queries

##intent: board_menu
- Board Menu
- board menu

##intent: state_board_link
- tn
- kr
- gj
- up

##intent: cbse
- CBSE
- cbse

##intent: state_board
- State Board
- state board

##intent: how_to_scan_using_qr_code
- how to scan using qr code
- How to scan using qr code

##intent: not_able_to_login
- not able to login
- Not able to login

##intent: other
- other
- Other

## intent:goodbye
- bye
- goodbye
- see you around
- see you later

## intent:affirm
- yes
- indeed
- of course
- that sounds good
- correct

## intent:deny
- no
- never
- I don't think so
- don't like that
- no way
- not really

## intent:mood_great
- perfect
- very good
- great
- amazing
- wonderful
- I am feeling very good
- I am great
- I'm good

## intent:mood_unhappy
- sad
- very sad
- unhappy
- bad
- very bad
- awful
- terrible
- not very good
- extremely sad
- so sad

## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- who are you?
- who am i talking to
- what is your name
- tell me your name
- who is this?
- tell me about yourself

## intent:worksheet
- about worksheet
- tell me about worksheet for a course
- what does worksheet do
- What is a worksheet for
- What is a worksheet?
- what are worksheets for?
- i need to know about worksheet
- how can a worksheet help me?
- what can a worksheet do for me?
- Explain me about worksheet
- How does a worksheet work?

## intent:course_mentor
- what is a course mentor?
- who is course mentor
- course mentor
- who is mentor
- tell me about mentor for a course
- what do course mentors do
- what is a mentor for
- what are mentors for?
- i need to know about mentors
- how can a course mentor help me?
- what can a mentor do for me?

## intent:flag_reviewer
- what is a flag reviewer?
- who is flag reviewer
- flag reviewer
- who is flag reviewer
- tell me about reviewer for flag
- what do flag reviewer do
- what is a reviewer for
- what are flag reviewers for?
- i need to know about flag reviewers
- how can a flag reviewer help me?
- what can a flag reviewer do for me?

## intent:language_support
- How many languages does Diksha support?
- Does Diksha support [hindi](medium)?
- Can I learn in [hindi](medium) language?
- I want to learn in [hindi](medium). Is it possible in this?
- is there content in [kannada](medium)?
- i want content in [english](medium)
- in which languages content is there
- what language do you support
- do you support [marathi](medium) language
- do you support [urdu](medium) medium

## intent:content_customization
- Can we make the content specific to an organisation?
- Can we have private content for an organisation?
- Is there a way we can make the contents private for an organisation?
- can we customize the content for us?
- can we have customized content for our company?
- can we have our own content base?
- can we have separate content repository?
- i want to create content for my organisation
- i need content specific to our organisation
- i need content specific to our company
- can we get tailored content for us?
- customize content for us
- customized content

## intent:author_credit
- How can I give credits to the authors?
- Can I see who are the authors?
- How can I add the names of authors in the content?
- Is there a way to give credits to the content authors?
- add author name to content
- add author credit
- how to add name to credits
- how can i add my name as author
- content author adding
- process to add name in credits as author
- process to add name in author credit
- i am author to book, how can i add my name in credit
- add author to material
- add name in credit of content

## intent:content_suggestions
- I want to learn [CBSE](board) content
- I'm a student from [Maharashtra](board) and want to learn from home
- Do you have any content from [Karnataka](board) state board
- Show me class [one](grade) content from [Tamil Nadu](board)
- Please show [second](grade) standard content
- I want to do [maths](subject) revision
- I want to learn [fourth](grade) standard [physics](subject)

## lookup:board
data/boards.txt

## lookup:grade
data/grades.txt

## lookup:subject
data/subjects.txt

## lookup:medium
data/mediums.txt

Loading