cts:entity-dictionary( $entities as cts:entity*, [$options as xs:string*] ) as cts:entity-dictionary
Returns a cts:entity-dictionary
object.
Only one of "case-sensitive" and "case-insensitive", "whole-words" and "partial-words", and "allow-overlaps" and "remove-overlaps" is permitted. It is strongly recommended that the defaults be used.
Use this method when creating ad hoc entity dictionaries, or as a prelude to saving the entity dictionary to the database.
let $dict := cts:entity-dictionary( for $alt in ("ADA", "Obamacare", "Affordable Care Act") return cts:entity("E1", "ADA", $alt", "Law") ) return cts:entity-highlight(<root>ADA is often called Obamacare</root>, element {$cts:entity-type} {attribute norm {$cts:normalized-text}, $cts:text}, $dict) => <root><Law norm="ADA">ADA</Law> is often called <Law norm="ADA">Obamacare</Law>.</root>
import module namespace entity = "http://marklogic.com/entity" at "/MarkLogic/entity.xqy"; xdmp:document-insert("/entities/example.txt", entity:skos-dictionary("http://example.org/ontology","en")) ; cts:entity-walk(doc("mydoc.xml"), <entity type="{$cts:entity-type}">{$cts:text}</entity>, cts:entity-dictionary-get("/entities/example.txt")) )