Search for Arguments at a Specific Position in Text
The position() function matches documents containing arguments at a specific position in text.
Syntax
The function position() has no required arguments. When called without arguments, optional named parameters should be specified, for example:
The first optional parameter number is used to specify the maximum position (in tokens) at which the argument can occur in text. By default, the function finds arguments at the first position in text. Punctuation marks are not taken into consideration when calculating position number.
The function accepts the following optional named parameters:
Parameter |
Comments |
scope:=line/sentence/paragraph/text/table_cell/table_name/table_row_name/table_column_name/heading/page |
Specifies a position within a line/sentence/paragraph/text/heading/page. |
mode:=forward/backward |
Specifies a position from the beginning/end of the scope. |
min_pos |
Specifies the minimal position of the argument. |
max_pos |
Specifies the maximal position of the argument. |
min_snt |
Specifies the minimal sentence number. |
max_snt |
Specifies the maximal sentence number. |
Note
-
By default, the parameters are set to the following values: scope:=text, mode:=forward.
-
The max_pos parameter is equivalent to the first optional argument number.
-
If both min_snt and min_pos parameters are specified, positions will be counted from the beginning of the indicated sentence. The same will occur if both max_snt and max_pos parameters are indicated.
-
If the sentence number is not specified, then the position is calculated from the beginning of the scope parameter.
-
If you need to count positions from the end of sentences, then you should specify negative values for min_pos and max_pos parameters.
-
If you need to count positions from the end of sentences, then you should specify negative values for min_pos and max_pos parameters.
Example
Task example: Find country names in upper case at the beginning of a document
The query expression position(case(upper, dictword(GeoAdministrative, "category=country")), min_pos:=1, max_pos:=4) matches documents in which country names in upper case occur at the first, second, third, or forth position from the beginning of a text. This may be useful for searching within newspaper articles.
