MarkLogic 9 Product Documentation
cts:entity-dictionary

cts:entity-dictionary(
   $entities as cts:entity*,
   [$options as xs:string*]
) as cts:entity-dictionary

Summary

Returns a cts:entity-dictionary object.

Parameters
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

Example

xquery version "1.0-ml";

let $dict := 
  cts:entity-dictionary(
    for $alt in ("ACA", "Obamacare", "Affordable Care Act")
    return cts:entity("E1", "ACA", $alt, "Law")
  )
return 
  cts:entity-highlight(<node>ACA is often called Obamacare</node>,
    element {$cts:entity-type} {attribute norm {$cts:normalized-text}, 
             $cts:text}, $dict)

(: Returns output such as the following:
 :
 : <node><Law norm="ACA">ACA</Law> is often called <Law norm="ACA">Obamacare</Law></node>
 :)
Powered by MarkLogic Server | Terms of Use | Privacy Policy