Multiple entite in one intent

Hi , I am using rasa 1.6.1 , python 3.6 I have created my custom actions, config , nlu as follows, I want my chatbot to answer the leave balance for different type of leave .The entity classifications is working fine but when i run rasa shell i am getting below error.

Error

c:\users\aashay.bane\appdata\local\continuum\anaconda3\envs\rasa16\lib\site-packages\rasa\nlu\extractors\crf_entity_extractor.py:590: UserWarning: Number of features (1) for attribute ‘text_dense_features’ does not match number of tokens (2). Set ‘return_sequence’ to true in the corresponding featurizer in order to make use of the features in ‘CRFEntityExtractor’. f"Number of features ({len(features)}) for attribute "

Actions.py

This files contains your custom actions which can be used to run custom Python code.

See this guide on how to implement these action:

This is a simple example for a custom action which utters “Hello World!”

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 []

from future import absolute_import from future import division from future import unicode_literals

from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher

from rasa.core.actions.action import Action from rasa.core.events import SlotSet from rasa_sdk import Tracker from rasa_sdk.executor import CollectingDispatcher

from typing import Dict, Text, Any, List import requests from rasa_sdk import Action from rasa_sdk.events import SlotSet, FollowupAction from rasa_sdk.forms import FormAction Tracker keep track of the slots in conversation.

class getjoiningdate(Action):

	def name(self):
        
        return 'get_joining_date'

	def run(self, dispatcher, tracker, domain):
        
        import pyodbc
    
        #connecting to SQL server 
        conn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0}; \
                            SERVER=.;\
                            DATABASE=rasa_storge_new;\
                            UID=sa;\
                            PWD=xxxx;\
                          "Trusted_Conenection=yes;')
        cursor = conn.cursor() 
        
    	#storing the user ID in "user_id"
        user_id =tracker.get_slot('userid')
        
        #querying SQL
        user_name =cursor.execute("""select [First Name], [Emp ID] from [RAW_SAMPLE_ Records] where [Emp ID]={}""".format(user_id)).fetchone()[0]
        
        date_of_joining =cursor.execute("""select ([Date of Joining] )from [RAW_SAMPLE_ Records] where [Emp ID]= {}""".format(user_id)).fetchone()[0]
        
        #setting the output
        dispatcher.utter_message(text=(""" Hey {}, your date of joining in kaggle is {} . """.format(user_name,date_of_joining)))
        
        return []

class GetLeaveBalance(Action):

def name(self):
    return 'get_leave_balance'



def run(self, dispatcher, tracker, domain):
    
    
    #importing librires to connect with wsdl 
    from suds.client import Client
    from suds.sax.element import Element
    
    #specfying the wsdl url and setting the client 
    url = "http://devmobileapi.beehivesoftware.in/API/BeehiveMobileService.svc?wsdl"
    client = Client(url)
    
    #creating the headers for auth in service xml and setting the values for both API-key and API-Code
    Namespace = ('ns2', 'http://beehivehronline.com/v1')
    name_space = Element('APICode', ns=Namespace).setText('xxxxxxxxxxxx')

    Apikey =('ns2',"http://beehivehronline.com/v1")
    api_key = Element('APIKey',ns= Apikey).setText('xxxxxxxxxxxxxxxxxxxxxxx')
    
    client.set_options(soapheaders=(name_space,api_key))
    
    # getting the leave data from GetLeaveBalance for specific user 
    leave=client.service.GetLeaveBalance('1')
    leave_data= Client.dict(leave)

##################### Creating list of leave types

    leavetype=["short_leave", "casual_leave", "sick_leave","earned_leave", "leave_without_pay",
                "paid_leave","paternity_leave","leave"]
    
     saving the leave type
    leave_type= tracker.get_slot("leave_type")
    leave_type=latest_message.get("leave_type")
    
     specifing conditions for different leave types
    
    
    if leave_type =="leave":
        
        short_l=leave_data['LeaveBalance']["LeaveBalanceData"][0]["Balance"]
        casual_l=leave_data['LeaveBalance']["LeaveBalanceData"][1]["Balance"]
        sick_l=leave_data['LeaveBalance']["LeaveBalanceData"][2]["Balance"]
        earned_l=leave_data['LeaveBalance']["LeaveBalanceData"][3]["Balance"]
        without_pay_l=leave_data['LeaveBalance']["LeaveBalanceData"][4]["Balance"]
        privilege_l=leave_data['LeaveBalance']["LeaveBalanceData"][5]["Balance"]
        Paternity_l=leave_data['LeaveBalance']["LeaveBalanceData"][6]["Balance"]
        
        dispatcher.utter_message(text=(""" Your Leave balance summary is as follows:
            Short Leave :{}
            Casual Leave : {}
            Sick Leave: {}
            Earned Leave : {}
            Leave Without Pay : {}
            Privilege Leave : {}
            Paternity Leave : {}
            """.format(short_l,casual_l,sick_l,earned_l,without_pay_l,privilege_l,privilege_l,Paternity_l)))
    

    return []     

config file Configuration for Rasa NLU.

language: en pipeline: - name: “SpacyNLP” - name: “SpacyTokenizer” - name: “SpacyFeaturizer” return_sequence: True - name: “RegexFeaturizer” - name: “CRFEntityExtractor” - name: “EntitySynonymMapper” - name: “SklearnIntentClassifier” - name: “EntitySynonymMapper”

Configuration for Rasa Core.

policies:

  • name: MemoizationPolicy max_history: 3
  • name: KerasPolicy epochs: 200 #validation_split: 0.2 random_seed: 1 max_history: 5
  • name: MappingPolicy

**nlu file **

intent:leave_balance

You can also set the parameter return_sequence: True for the RegexFeatureizer also.

Did try that , not working !! Also is my actions.py written in right way ?