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.


c:\users\aashay.bane\appdata\local\continuum\anaconda3\envs\rasa16\lib\site-packages\rasa\nlu\extractors\ 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 "

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 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 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}; \
        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 = ""
    client = Client(url)
    #creating the headers for auth in service xml and setting the values for both API-key and API-Code
    Namespace = ('ns2', '')
    name_space = Element('APICode', ns=Namespace).setText('xxxxxxxxxxxx')

    Apikey =('ns2',"")
    api_key = Element('APIKey',ns= Apikey).setText('xxxxxxxxxxxxxxxxxxxxxxx')
    # getting the leave data from GetLeaveBalance for specific user 
    leave_data= Client.dict(leave)

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

    leavetype=["short_leave", "casual_leave", "sick_leave","earned_leave", "leave_without_pay",
     saving the leave type
    leave_type= tracker.get_slot("leave_type")
     specifing conditions for different leave types
    if leave_type =="leave":
        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 : {}

    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.


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

**nlu file **


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

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