Weather

The Weather solution contains a weather flow that gets either the current weather or forecast for a city using the free weather api from MetaWeather.

Sunset

Core concepts

  • Integration
  • External weather service
  • Slot filling
  • Date handling
  • Topic handling
  • Listeners

Example conversations

User: What is the weather like?
Bot: For which city?

User: Amsterdam
Bot: On 10 Dec 2018 the weather will be Light Cloud and 16°C in Amsterdam.


User: What is the weather like in Amsterdam?
Bot: On 10 Dec 2018 the weather will be Light Cloud and 16°C in Amsterdam.


User: What will the weather be like in Amsterdam tomorrow?
Bot: On 11 Dec 2018 the weather will be Showers and 15°C in Amsterdam.


User: What is the forecast for Thursday
Bot: For which city?

User: London
Bot: On 13 Dec 2018 the weather will be Light Cloud and 3°C in London.


User: What's the forecast?
Bot: For which city?

User: Paris
Bot: On 10 Dec 2018 the weather will be Light Cloud and 8°C in Paris.


User: What is the weather like in Stockholm
Bot: On 10 Dec 2018 the weather will be Heavy Cloud and -1°C in Stockholm.

User: What about tomorrow?
Bot: On 11 Dec 2018 the weather will be Showers and 2°C in Stockholm.

User: What about London?
Bot: On 11 Dec 2018 the weather will be Light Cloud and 6°C in London.

User: How about today?
Bot: Response On 10 Dec 2018 the weather will be Heavy Cloud and 7°C in London.


User: Do I need an umbrella today?
Bot: For which city?

User: Helsinki
Bot: You will not need your umbrella today. The weather will be Heavy Cloud and 2°C in Helsinki.

User: How about tomorrow?
Bot: You will need your umbrella tomorrow. The weather will be Showers and 2°C in Helsinki.

Solution components

Name Type Description
Weather Folder A folder that holds sub-folders for the flows and entities in this solution.
Weather flow Flow A slot filling flow in which allows the user to get the weather by city and day. If no day is mentioned in the user input, the get Date time script in the flow will assume that it is for ‘today’ that the user wants the weather for, by creating a ‘default’ date representation.
WEATHER_ACCESSORIES.ENTITY Entity Entity containing weather accessories SUNGLASSES.NN.LEX, UMBRELLA.NN.LEX and RAINCOAT.NN.LEX. Also contains two NLU variables: ’weatherType’ which holds the type of weather and 'weatherAccessory' which holds the name of the accessory.
WEATHER_CITIES.ENTITY Entity Entity containing CITY.ENTITY and LOCATION.ENTITY (both exist in the English TLR). Also contains an NLU variable called 'cityName' which holds the value of the city as a string.
Weather integration Integration An integration that contains the method ‘Get weather’ which gets the weather description for a city during the given day. The weather service MetaWeather is used to get the weather. 
DateTimeHandler.1.2.3.jar JAR file in the Resource file manager A Jar file containing the interpretation logic for the date and time handling.
weatherTemperatureScale Global variable Used for controlling which temperature scale to use. Contains one letter ‘C’ for Celsius. Change the ‘C’ to an ‘F’ to get Fahrenheit.
weatherDate Global variable Used to remember the date to allow follow-up questions.
weatherCity Global variable Used to remember the city to allow follow-up questions.
weatherTopic Global variable Used to set topic of the conversation to 'weather' and context restrict the follow-up triggers.
weatherAccessoryName Global variable Used to remember the weather accessory name to allow follow-up questions.
weatherAccessoryType Global variable Used to remember the weather accessory 'type' to allow follow-up questions.
Weather Syntax Triggers Order Group This is an order group for syntax triggers used by the solution.

Make sure you check for possible conflicts before you import this solution into an existing solution (merge solutions).

Download

  1. Download the solution from the following link: Weather.solution
  2. Import the solution into Teneo studio. We recommend you to import it into a solution that is based on the Teneo Dialogue Resources English.
  3. Once imported, please make sure to assign the following Lexical Resources:
    • Teneo Lexical Resource English
    • Teneo Offensive Language Detector - English
    • DateTime Handler - English
  4. Disable the flow 'The user comments on the weather' in the folder 'Dialogue' -> 'Conversational' -> 'Conversation'. Otherwise, this flow will steal inputs from the solution you are about to import.

Note that the MetaWeather API supports a limited set of cities. Also bear in mind that since it is a free API, you should limit the number of api requests. If you are planning to use a weather API in a production environment, we advise you to look for commercial alternatives.

Was this page helpful?