public class Document extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ABSOLUTE_DIRECTORY_PATH
Common metadata key for the absolute path of the directory from which the document was loaded.
|
static String |
FILE_NAME
Common metadata key for the name of the file from which the document was loaded.
|
static String |
URL
Common metadata key for the URL from which the document was loaded.
|
Constructor and Description |
---|
Document(String text)
Creates a new Document from the given text.
|
Document(String text,
Metadata metadata)
Creates a new Document from the given text.
|
Modifier and Type | Method and Description |
---|---|
static Document |
document(String text)
Creates a new Document from the given text.
|
static Document |
document(String text,
Metadata metadata)
Creates a new Document from the given text.
|
boolean |
equals(Object o) |
static Document |
from(String text)
Creates a new Document from the given text.
|
static Document |
from(String text,
Metadata metadata)
Creates a new Document from the given text.
|
int |
hashCode() |
Metadata |
metadata()
Returns the metadata associated with this document.
|
String |
metadata(String key)
Looks up the metadata value for the given key.
|
String |
text()
Returns the text of this document.
|
String |
toString() |
TextSegment |
toTextSegment()
Builds a TextSegment from this document.
|
public static final String FILE_NAME
public static final String ABSOLUTE_DIRECTORY_PATH
public static final String URL
public Document(String text)
The created document will have empty metadata.
text
- the text of the document.public String text()
public Metadata metadata()
public String metadata(String key)
key
- the key to look up.public TextSegment toTextSegment()
public static Document from(String text)
The created document will have empty metadata.
text
- the text of the document.public static Document from(String text, Metadata metadata)
text
- the text of the document.metadata
- the metadata of the document.public static Document document(String text)
The created document will have empty metadata.
text
- the text of the document.Copyright © 2024. All rights reserved.