Loading TOC...

MarkLogic 12 EA 2 Product Documentation
cts:entity-dictionary-parse

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

Summary

Construct a cts:entity-dictionary object by parsing it from a formatted string.

Parameters
contents The dictionary entries to parse. Each line (or string) must consist of four tab-delimited fields: The entity ID, the normalized form of the entity, the word or phrase to match during entity identification, and the entity type. For more details about the fields, see cts:entity. Multiple formatted strings can be passed in and they will be combined into a single dictionary object.
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.



cts:entity-dictionary-parse(
   $uri as xs:string
) as cts:entity-dictionary

Summary

Construct a cts:entity-dictionary object by parsing it from a location in the database. The dictionary will be automatically cached for reuse.

Parameters
uri The URI of the entity dictionary that has previously been saved in 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"))
)

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