3

I'm using Watson conversation to help run a virtual support system and am trying to figure out how to play with conditions a bit more. Specifically, I'm looking for a way to negate conditions or to specify a condition not found.

For example, I have an entity @sports with the sub-entities @sports:mlb, @sports:nba, @sports:nhl, and @sports:nfl. I'm looking for a way to specify recognizing any of these except nba (I know I could just specify the other three, but I have other similar needs where that is less feasible).

Ideally, it would be as easy as:
If bot recognizes:
@sports AND !@sports:nba
(sports and not nba)
but that doesn't seem to work.

Is this doable? Any help is appreciated!

C Stephens
  • 75
  • 7
  • Hello @CStephens what have you tried so far? Also welcome to Stack Overflow! Please take a time to go through the [welcome tour](https://stackoverflow.com/tour) to know your way around here (and also to earn your first badge), read how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also check [How to Ask Good Questions](https://stackoverflow.com/help/how-to-ask) so you increase your chances to get feedback and useful answers. – DarkCygnus Sep 11 '17 at 17:52

3 Answers3

3

Answering my own question for anyone else looking for this answer:

An exclamation point before the entity DOES, in fact, work to negate the response.

I'm not sure why it wasn't earlier; likely a misrecognized entity.

C Stephens
  • 75
  • 7
0

According to the Official documentation, Watson uses the following example to Accessing entities with one negative example:

@year != 2016   

In this case, your example will be:

@sports != 'nba'
Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
0

This should work:

@sports AND !@sports:nba

What could be causing it to fail is that you didn't select "Create New Condition" on the second part.

Entity for sports.

enter image description here

Dialog Nodes

enter image description here

Dialog Node with condition.

(Remember, create new condition) enter image description here

Results

enter image description here


Outside of this, a common mistake is to forget to add # or @.

Get into the habit of naming your intents #ALL_IN_CAPITALS and your entity names in @CamelCase.

Simon O'Doherty
  • 9,259
  • 3
  • 26
  • 54