Search code examples
ibm-cloudibm-watsonwatson-dialog

IBM Watson Dialog - entity not working / resolved


I am trying to get input (say gender - male / female) from user using entity and store it in profile variable and the code snippet below.

<default>
  <output>
    <prompt selectionType="RANDOM">
      <item>I did not quite get that.</item>
    </prompt>
  </output>
</default>
<input id="input_2508594">
  <grammar>
    <item>$(Gender)={gender}</item>
    <item>I am a
    </item>
  </grammar>
  <action operator="SET_TO" varName="gender">{gender.value:main}</action>
  <output>
    <prompt selectionType="RANDOM">
      <item>Hi hello {gender}!</item>
    </prompt>
  </output>
</input>
<entities>
  <entity name="Gender">
    <value name="Male" value="Male"/><value name="Female" value="Female"/>
  </entity>
</entities>
<variables>
  <var_folder name="Home">
    <var description="friend" name="UserName" type="TEXT"/>
    <var description="one" name="gender" type="TEXT"/>
  </var_folder>
</variables>

Now, if I say "I am a", the dialog service responds with "Hi hello!". But, if i input "Female", WDS responds with default output "I did not quite get that.". Then I tried giving $(Gender)={gender}, it returns "Hi hello!". So, it looks dialog is not resolving the input to entity and I could not store the input into profile variable.

Any advise please? Am I missing anything in the dialog xml file?


Solution

  • Settings should be added in the dialog config file.

    <settings>
         <setting name="ENTITIES_SCOPE">3</setting>
    </settings>
    

    https://developer.ibm.com/answers/questions/238673/dialog-entity-not-working-resolved.html