MarkLogic 12 EA 1 Product Documentation
cts.entityDictionary

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

Summary

Returns a cts:entity-dictionary object.

Parameters
entities The entities to put into the dictionary.
options Dictionary building options. The default is case-sensitive, allow-overlaps, and whole-words.

Options include:

"case-sensitive"
Entity names are case-sensitive.
"case-insensitive"
Entity names are case-insensitive.
"whole-words"
Require that matches align with token boundaries.
"partial-words"
Allow matches to fall within token boundaries.
"allow-overlaps"
Allow overlapping entity labels.
"remove-overlaps"
Remove overlapping entity labels.

Usage Notes

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.

Example

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"))
  
)
Powered by MarkLogic Server | Terms of Use | Privacy Policy