This site is no longer updated.Go to new Conversational Cloud docs

Named Entities


Named entities are contained within named entity dictionaries.


Named entity dictionaries

Named entity dictionaries are required for processing large number of names, e.g. names of cities, countries, proper names, currencies, etc.

Dictionaries are contained within .csv files, with each line complying to the following format:

id; name; value

Here,

  • id is the unique identifier of the entity;
  • name is the entity name, possible synonyms are separated by commas;
  • value is the value of the entity, either string or json.

You may enumerate all the synonyms inside name and specify the main one as one of the json attributes.

Here is a fragment of a dictionary of proper names:

149;Bernard;{"name": "Bernard", "sex": "male"}
150;Bernie;{"name": "Bernie", "sex": "male"}
151;Berry;{"name": "Berry", "sex": "male"}
152;Bert, Bertram;{"name": "Bertram", "sex": "male"}
153;Bill,Billie,Billy;{"name": "Bill", "sex": "male"}
154;Blaine;{"name": "Blaine", "sex": "male"}

Elements of named entity dictionaries

In order to access named entity dictionaries from named patterns, the following steps are necessary:

  1. Specify the dictionary name and its path in the .sc script under the require tag:
require: common/common-cities.csv
         name = RoamingRegions
         var = RoamingRegions

  1. Define a converter in any .js file. The converter allows to save pattern information into the value attribute of the parseTree. For example:
function RoamingRegionTagConverter($parseTree) {
            var id = $parseTree.RoamingRegions[0].value;
            return RoamingRegions[id].value
    }

Here,

  • RoamingRegionTagConverter is the name of the converter;
  • RoamingRegions is the name of the named entity dictionary.

The returned value is saved into the value attribute.


  1. Declare a named pattern. Use $entity<>:
$roamingRegion = $entity<RoamingRegions> || converter = RoamingRegionTagConverter

Named entities can be used even without declaring a named pattern.

When a named pattern is assigned a converter, a $parseTree’s value attribute will then include the value of the corresponding dictionary element.