toposition

Purpose

Provides the argument’s position in the document.

Syntax

toposition(position_type, argument)

Arguments

The function takes two required arguments. The first argument position_type specifies the type of position to be extracted. It takes the following values:

Value

Comments

StartSentence

Index number of the start sentence the argument is found in.

StartSentenceToken

Index number of the start token of the StartSentence.

EndSentence

Index number of the end sentence the argument is found in.

EndSentenceToken

Index number of the end token of the EndSentence.

StartToken

Index number of the argument’s start token.

EndToken

Index number of the argument’s end token.

LengthToken

The argument’s length in tokens.

StartSymbol

Index number of the start symbol.

EndSymbol

Index number of the end symbol.

LengthSymbol

The argument’s length in symbols.

The second argument is a reference to a named group.

Returned Value

The string’s position within a document.

Examples

XPDL rule

rule: toposition

{

query: {sentence(price, strategy)}:m

result: Match = $m

attribute: StartSentence = toposition(StartSentence, $m)

attribute: StartSentenceToken = toposition(StartSentenceToken, $m)

attribute: EndSentence = toposition(EndSentence, $m)

attribute: EndSentenceToken = toposition(EndSentenceToken, $m)

attribute: StartToken = toposition(StartToken, $m)

attribute: EndToken = toposition(EndToken, $m)

attribute: LengthToken = toposition(LengthToken, $m)

attribute: StartSymbol = toposition(StartSymbol, $m)

attribute: EndSymbol = toposition(EndSymbol, $m)

attribute: LengthSymbol = toposition(LengthSymbol, $m)

}