choose

Purpose

The function is used to find the first, the last, the shortest or the longest result in a specific document range.

Syntax

choose(argument)

Arguments

The function accepts one required argument which can be a string or a pdl-function.

The function accepts the following optional named parameters:

  • mode:=shortest/longest/first/last matches the shortest/longest/first/last argument’s result respectively.

  • scope:=sentence/line/paragraph/text limits the search range to a sentence/line/paragraph/text respectively. By default scope:=text.

It is possible to mix mode values to specify a search, using an underscore ("_"): shortest_first, last_longest.

Returned Value

Documents matching the query.

Examples

choose(entity(Companies), mode:=first) matches the first company in the document.

choose(agreement, mode:=last, scope:=paragraph) matches the last word "agreement" in the paragraph.