Package dev.langchain4j.data.segment
Interface TextSegmentTransformer
-
- All Implemented Interfaces:
public interface TextSegmentTransformer
Defines the interface for transforming a TextSegment. Implementations can perform a variety of tasks such as transforming, filtering, enriching, etc.
-
-
Method Summary
Modifier and Type Method Description abstract TextSegment
transform(TextSegment segment)
Transforms a provided segment. List<TextSegment>
transformAll(List<TextSegment> segments)
Transforms all the provided segments. -
-
Method Detail
-
transform
abstract TextSegment transform(TextSegment segment)
Transforms a provided segment.
- Parameters:
segment
- The segment to be transformed.- Returns:
The transformed segment, or null if the segment should be filtered out.
-
transformAll
List<TextSegment> transformAll(List<TextSegment> segments)
Transforms all the provided segments.
- Parameters:
segments
- A list of segments to be transformed.- Returns:
A list of transformed segments. The length of this list may be shorter or longer than the original list. Returns an empty list if all segments were filtered out.
-
-
-
-