类 TextSegment
java.lang.Object
dev.langchain4j.data.segment.TextSegment
Represents a semantically meaningful segment (chunk/piece/fragment) of a larger entity such as a document or chat conversation.
This might be a sentence, a paragraph, or any other discrete unit of text that carries meaning.
This class encapsulates a piece of text and its associated metadata.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleanstatic TextSegmentCreates a new text segment.static TextSegmentCreates a new text segment.inthashCode()metadata()Returns the metadata.已过时。text()Returns the text.static TextSegmenttextSegment(String text) Creates a new text segment.static TextSegmenttextSegment(String text, Metadata metadata) Creates a new text segment.toString()
-
构造器详细资料
-
TextSegment
Creates a new text segment.- 参数:
text- the text.metadata- the metadata.
-
-
方法详细资料
-
text
Returns the text.- 返回:
- the text.
-
metadata
Returns the metadata.- 返回:
- the metadata.
-
metadata
已过时。as of 0.31.0, usemetadata()and thenMetadata.getString(String),Metadata.getInteger(String),Metadata.getLong(String),Metadata.getFloat(String),Metadata.getDouble(String)instead.Returns the metadata value for the given key.- 参数:
key- the key.- 返回:
- the metadata value, or null if not found.
-
equals
-
hashCode
public int hashCode() -
toString
-
from
Creates a new text segment.- 参数:
text- the text.- 返回:
- the text segment.
-
from
Creates a new text segment.- 参数:
text- the text.metadata- the metadata.- 返回:
- the text segment.
-
textSegment
Creates a new text segment.- 参数:
text- the text.- 返回:
- the text segment.
-
textSegment
Creates a new text segment.- 参数:
text- the text.metadata- the metadata.- 返回:
- the text segment.
-
metadata()and thenMetadata.getString(String),Metadata.getInteger(String),Metadata.getLong(String),Metadata.getFloat(String),Metadata.getDouble(String)instead.