Extract surrounding lines in a text.

Parameters:

Parameters:
See dedicated page for more information.
Simply specify the number of lines before and after the target text, and you're set.
The extractSurroundingLines action is used to extract lines of text located before and after a specific match position within a body of text. This is especially useful in log analysis, natural language processing (NLP), or any context where the surrounding context of a match is important for understanding or classification.
Extracts lines around a specific text. This action is fed by a table containing:
It also allows configuration of how many lines before and after the match should be extracted. The result is appended to the dataset as new output columns with a configurable prefix.
Set the following parameters:
idText: Column containing the full text string.idPos: Column with the position of the matched term.idMatchLen: Column indicating the length of the match.
Define how many lines to extract:
nRBefore: Number of lines to include before the match.nRAfter: Number of lines to include after the match.Optionally, adjust the prefix to customize the names of the generated columns.

After execution, the output will include:
Surrounding_before and Surrounding_after: The extracted surrounding lines.Surrounding_before_CW, CD: Word/character counts for the "before" lines.Surrounding_after_CW, CD: Word/character counts for the "after" lines.These columns provide both raw context and useful metadata.


Context_ or Surrounding_ to organize columns.extractRegExpPosition for pattern-driven extraction.nRBefore and nRAfter based on your data’s typical structure.