Cognigy

Cognigy.AI Docs

COGNIGY.AI is the Conversational AI Platform focused on the needs of large enterprises to develop, deploy and run Conversational AI’s on any conversational channel.

Given the arising need of voice interfaces as the most natural way of communicating with brands, Cognigy was founded in 2016 by Sascha Poggemann and Phil Heltewig. Our mission: to enable all devices and applications to intelligently communicate with their users via naturally spoken or written dialogue.

Get Started

Slots & Lexicons

Detect slots & keyphrases in the user input

Description

Slots are keyphrases which are detected by Cognigy.AI's NLU and placed into the Input Object under ci.slots.

There are system-defined Slots and User-defined Slots, called Keyphrases.

System-defined Slots

Cognigy.AI automatically detects the following Slots. All system-defined Slots tags are capitalized.

Slot TagExampleSlot JSON
DATEtomorrow, August 1st at 5pmJSON "DATE": [ { "start": { "day": 2, "month": 6, "year": 2018, "hour": 12, "minute": 0, "second": 0, "millisecond": 0, "text": "tomorrow", "weekday": 6, "dayOfWeek": "Saturday", "ISODate": "2018-06-02T12:00:00Z" }, "end": null }
NUMBERone hundred, 143JSON "NUMBER": [ 100, 143 ]
DURATION10 minutes 20 secondsJSON "DURATION": { "hour": null, "minute": 10, "second": 20 }
TEMPERATURE50 degreesJSON "TEMPERATURE": [ 50 ]
AGE32 years oldJSON "AGE": [ 32 ]
EMAIL[email protected]JSON "EMAIL": [ "[email protected]" ]
PERCENTAGE5 percentJSON "PERCENTAGE": [ 5 ]

Date formats


🚧

Time Zone & DATE Slots

Detection of dates depends on the time zone set for the Flow (see here) or User (see here)

The following tables provide an overview of supported input patterns and formats.

LanguagesSupported input pattern examples
EnglishNow, Today, Tomorrow, Yesterday, Last Friday, Last night
17 August 2013 - 19 August 2013
This Friday from 13:00 - 16.00
5 days ago
2 weeks from now
Sat Aug 17 2013 18:40:39 GMT+0900 (JST)
2014-11-30T08:15:30-05:30
Day after tomorrow
Days before yesterday
Next Tuesday
GermanJetzt, Heute, Morgen, Gestern, Vorgestern
Letzte Nacht, Heute Nacht, Diese Nacht, Morgen Vormittags, Gestern Abend
Nach einem Tag, In einer Woche
15/01/2021, 15.01.2021, 15. Jan 2021, Freitag den 15. Januar 2021
17.08.2013 - 19.08.2013, 17.08.2013 bis 19.08.2013
Kommenden Montag
DutchNu, Deze Nacht, Deze Vannacht, Gisteren, Morgen, Gisteravond, Eergisteren, Overmorgen
Morgen Middag, Deze Ochtend, Gisteren Voormiddag, Deze Namiddag, Morgen Avond, Overmorgen Nacht
Binnen Een Dag, Na een halve Maand
15/01/2021, 15.01.2021, 15. Jan 2021, Vrijdag de 15de Januari 2021
17.08.2013 - 19.08.2013, 17.08.2013 tot 19.08.2013
Laatste/vorige/volgende/komende Woensdag
Japanese今日, 当日, 昨日, 明日, 今夜, 今夕, 今晩, 今朝
2016年2月17日です
Sat Aug 17 2013
01/30/2018
Other languagesBy example of French, the following patterns are supported. Some advanced patterns involving more advanced casual expressions such as "day before yesterday" or "next friday" would not be supported:

15.04.2023 12:00
15 aout 2015
15 aout 2015 a 12 octobre 2016
aujourd'hui, demain, hier
hier soir, demain après-midi

DATE Slot parsing depends on the language set in the Flow. See here for an overview of date formats by country we aim to support. The following table for language-specific behaviors on slash-formatted dates:

LanguagesSlash date format ordering (01/01/2019)
Default (English UK, German, Generic etc.)dd/mm/YYYY
English US, Japanese, Chinesemm/dd/YYYY

Note if mm/dd/YYYY yields an illegal date the parser falls back to dd/mm/YYYY.

🚧

Future Dates Only

You can force the DATE slot to only detect dates in the future for relative expressions (e.g. "Monday", "Friday"). For more information, see the Code Node Action setForwardDatesOnly

🚧

Invalid DATES

Cognigy.AI checks the validity of provided dates, including leap years, etc. Invalid dates will not show up in the detected slots.

User-defined Slots & Lexicons

User-defined Slots in Cognigy are called Keyphrases, which are maintained in Lexicons.

In Cognigy AI, Lexicons are lists of Keyphrases with Tags. A Lexicon can have any number of Keyphrases, which in turn can have any number of Tags and Synonyms.

If a Lexicon is assigned to a Flow, the Flow will parse the user input for all Keyphrases. When detected Keyphrases with same Tag are assigned to Slots.

Detected Keyphrases will be exposed in the Input property keyphrases.slot (e.g. keyphrases.food).

{
    "slots": {
        "tag1": [
            {
                "keyphrase": "found keyphrase",
                "lower": "found keyphrase in lower case",
                "synonym": "found synonym, otherwise keyphrase",
                "count": "how often the keyphrase was found"
            }
        ]
    }
}

Keyphrases and Synonyms are detected in order of their word count, with the longest Keyphrase first. If cake and cheese cake are defined and the text is I love cheese cake, only cheese cake will be found.

If a Synonym is found, the returned Keyphrase is the Keyphrase the Synonym is mapped to, whilst the Synonym itself is recorded in a special synonym property of the result.

📘

Example of how Slots are filled

If the user says I love pizza pie, the slots Input property will look like this:

{
    "food": [
        {
            "keyphrase": "pizza",
            "count": 1,
            "synonym": "pizza pie"
        }
    ]
}

Create and edit Lexicons

Create a new Lexicon from the Project Dashboard add resource button. You will be taken directly to the Lexicon editor. You can go back to Lexicons in Lexicon Editor via the left hand navigation page on the Project Dashboard.

Feature overview


The Lexicon Editor allows you to modify an existing Lexicon and change its keyphrases and the related tags, synonyms and the referenced data object that is available in the input object when a certain Keyphrase/Synonym is found in the users input.

Feature usage


Adding Keyphrases

To add a new Keyphrase, go to the Enter new keyphrase input field, type the name of the Keyphrase and hit enter.

Editing Keyphrases

To edit a Keyphrase, just click on the name of the Keyphrase, and an input field will appear. To add Tags/Synonyms, just click on the green "plus" button and type the Tag/Synonym. You can also add data to Lexicons, which will be displayed in the input object when a Keyphrase is triggered, and it is therefore useful to store something like product IDs here. To add data, simply click on the expand arrow on the right of the Keyphrase entry, and then type in the desired data in JSON format.

📘

A Lexicon could look like this:

KeyphraseSynonymsTags
cakecheese cake, strudel, piefood
pizzapizza piefood

Deleting Keyphrases

You have two ways of deleting Keyphrases: One is to expand the Keyphrase by clicking on the "expand" arrow, and then clicking on the trashcan at the bottom right corner. Another way is to mark the desired Keyphrase(s) by clicking the checkbox on the left of a Keyphrase, and then scrolling down to the bottom to delete it. You can delete several Keyphrases this way.

Search

You can search through your Keyphrases via the search bar in the top right corner. This will search trhough Keyphrase names, Tags and Synonyms.

Download / upload / delete a Lexicon

In the top right corner of the Lexicon Editor, you can either upload or download the lexicon as a .csv file. To download it, click on the "Download lexicon" button and you can also delete a Lexicon by clicking on the trashcan in the upper right corner.

To upload a Lexicon click on the "Choose CSV File" button. The .csv file should have the following format:

`,"","",""`

🚧

UTF-8 Encoding

In order to avoid any issues with special characters, make sure your CSV files are UTF-8 encoded

Example

Keyphrase1,"tag,tag2,tag3","synonym3,synonym3_2,synonym3_3","{'key3':'value'}"
Keyphrase2,"tag,tag2","synonym2,synonym2_2","{'key2':'value'}"
Keyphrase3,"tag","synonym1","{'key1':'value'}"

Pages

At the bottom, you can navigate to different pages and toggle the amount of Keyphrases you wish to show per page. This is quite handy when your Lexicons start to grow and have dozens of entries - just switch to a smaller page-size on smaller screens or increase the limit of entries on a page for large monitor usage.

Attach Lexicons to your Flows

In the Flow Editor, click the Lexicon button in the left-hand navigation pane.

The two cards show attached Lexicons. We distinguish user Lexicons created by yourself and default Cognigy lexicons.

Click a Lexicon to move the toggle and attach a Lexicon. Click an enabled Lexicon to remove the toggle it and detach it.

Use Lexicons through CognigyScript

Keyphrases can be accessed quite simply through CognigyScript.

{{ci.slots}} contains all found tags and keyphrases. CognigyScript offers some convenience functions to deal with keyphrases.

CognigyScriptDescription
{{ci.slots.tag}}Returns the keyphrase array for the tag tag

Updated 11 months ago


Slots & Lexicons


Detect slots & keyphrases in the user input

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.