cts.entityWalk( node as Node, callback as function, [dict as cts.entityDictionary] ) as null
Walk an XML document or element node, evaluating a callback function
against any matching entities. This functions is similar to
cts.entityHighlight
in how it processes matched entities, but it differs in what it returns.
The callback function can use variables in scope to accumulate results. The callback function returns an action string that specifies what happens next.
Your callback function must have the following signature:
function(text, node, entityType, entityId, normText, start)
Where the parameters have the following semantics:
text
- A string containing the matched text. In the case of overlapping matches, this value may not encompass the entirety of the entity match string. Instead, it contains only the non-overlapping part of the text, to prevent introduction of duplicate text in the final result.
node
- The text node containing the match.
entityType
- The type of the entity, as defined in the
type
field of the matchedcts.entity
in the entity dictionary.entityId
- The ID of the entity, as defined in the
id
field of the matched entity in the entity dictionary.normText
- The normalized label of the entity, as defined in the
normalized
field of the matched entity in the entity dictionary.start
- The offset (in codepoints) of the start of
text
in the matched text node.
Your callback function should return one of the following values to indicate what should happen next:
'continue'
: Proceed with the next match. (Default)'skip'
: Skip walking any more matches and return.'break'
: Stop walking matches and return.null
: Continue with the previous action.