Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
angelRev committed Oct 22, 2021
1 parent 2cb09b9 commit f19e79c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,11 @@ With the following logic:
```python
if len(processed_query.entities) > 0:
location = processed_query.entities[0]['text']
if location == 'all':
text = 'Ok, turning all lights on.'
entity = processed_query.entities[0]
if entity['type'] == 'location':
text = f'Ok, turning the {entity["text"]} lights on.'
else:
text = f'Ok, turning the {location} lights on.'
text = 'Ok, turning all lights on.'
else:
text = 'Ok, turning all lights on.'
```
Expand All @@ -720,9 +720,9 @@ That's it! We now have NLP support in our skill.
All in all your `main.py` should look like this:
```python
from webex_assistant_sdk.api import MindmeldAPI
from webex_assistant_sdk.dialogue import responses
from webex_assistant_sdk.models.mindmeld import DialogueState, ProcessedQuery
from webex_skills.api import MindmeldAPI
from webex_skills.dialogue import responses
from webex_skills.models.mindmeld import DialogueState, ProcessedQuery
api = MindmeldAPI()
Expand All @@ -746,11 +746,11 @@ async def turn_on(current_state: DialogueState, processed_query: ProcessedQuery)
new_state = current_state.copy()
if len(processed_query.entities) > 0:
location = processed_query.entities[0]['text']
if location == 'all':
text = 'Ok, turning all lights on.'
entity = processed_query.entities[0]
if entity['type'] == 'location':
text = f'Ok, turning the {entity["text"]} lights on.'
else:
text = f'Ok, turning the {location} lights on.'
text = 'Ok, turning all lights on.'
else:
text = 'Ok, turning all lights on.'
Expand All @@ -770,11 +770,11 @@ async def turn_off(current_state: DialogueState, processed_query: ProcessedQuery
new_state = current_state.copy()
if len(processed_query.entities) > 0:
location = processed_query.entities[0]['text']
if location == 'all':
text = 'Ok, turning all lights off.'
entity = processed_query.entities[0]
if entity['type'] == 'location':
text = f'Ok, turning the {entity["text"]} lights off.'
else:
text = f'Ok, turning the {location} lights off.'
text = 'Ok, turning all lights off.'
else:
text = 'Ok, turning all lights off.'
Expand Down

0 comments on commit f19e79c

Please sign in to comment.