Loading TOC...


   entities as cts.entity[],
   [options as String[]]
) as cts.entityDictionary


Returns a cts:entity-dictionary object.

entities The entities to put into the dictionary.
options Options with which you can control the behavior of the entity dictionary. You can specify the following options. It is strongly recommended that you use the default option settings.
  • "case-sensitive" or "case-insensitive": Perform case-sensitive or case-insensitive matching of entities names. Specify one or the other. Default: "case-sensitive".
  • "remove-overlaps" or "allow-overlaps": Either eliminate entities with the overlapping names or allow them. Specify one or the other. Default: "allow-overlaps".
  • "whole-words" or "partial-words": Either require matches to align with token boundares, or allow matches to fall within token boundaries. Specify one or the other. Default: "whole-words".

Usage Notes

Use this function when creating ad hoc entity dictionaries, or as a prelude to saving an entity dictionary to the database.

See Also


const entries = [];
for (let alt of ['ACA', 'Obamacare', 'Affordable Care Act']) {
  entries.push(cts.entity('E1', 'ACA', alt, 'Law'));
const dictionary = cts.entityDictionary(entries);
const inputNode = new NodeBuilder()
                    .addElement('node', 'ACA is often called Obamacare')
const resultBuilder = new NodeBuilder();
  function(builder, entityType, text, normText, entityId, node, start) {
              .addAttribute('norm', normText)
  resultBuilder, dictionary);

// Returns the following output:
// <node><Law norm="ACA">ACA</Law> is often called <Law norm="ACA">Obamacare</Law></node>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.