Skip to main content

Text Chunk Service

Overview

The TextChunkService is responsible for retrieving text chunks from the backend based on various parameters.

getTextChunks()

Retrieves text chunks based on the provided parameters.

getTextChunks(
id: string,
textChunks: TextLocation[],
highlights: string[],
query: Query,
leftSentencesCount: number,
rightSentencesCount: number
): Observable<TextChunk[]>
ParameterTypeDescription
idstringThe ID of the record.
textChunksTextLocation[]An array of TextLocation objects representing the location of the text chunks.
highlightsstring[]An array of strings representing the highlights to be applied to the text chunks.
queryQueryThe query used to retrieve the text chunks.
leftSentencesCountnumberThe number of sentences to include before the text chunks.
rightSentencesCountnumberThe number of sentences to include after the text chunks.

Usage Example:

textChunkService.getTextChunks(
'recordId',
[{ start: 0, end: 100 }],
['highlight1', 'highlight2'],
query,
2,
2
).subscribe(chunks => {
console.log(chunks);
});