Package com.tnsai.rag
Enum Class DocumentFormat
- All Implemented Interfaces:
Serializable,Comparable<DocumentFormat>,Constable
Canonical content format for a file-backed knowledge source.
The format is separate from the source location: a
Knowledge.Type.FILE source says where documents come from, while this
enum says how their contents must be interpreted. At this contract stage,
AUTO uses bounded content detection with registered file-name aliases
as a fallback hint. An explicit format is strict and its registered aliases
are part of the declaration contract.
Declaring a format does not imply that an extractor is installed. Textual
formats are handled by the bundled file-ingestion path; binary document
formats require an optional ContentExtractor provider.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInfer each candidate independently, with content detection downstream.Comma-separated values.Office Open XML word-processing document.EPUB publication.HTML text.JSON document.Newline-delimited JSON document.Markdown text.Portable Document Format document.Office Open XML presentation.Source-code family; language detection is performed after selection.Raw UTF-8 text.Tab-separated values.Office Open XML spreadsheet.XML document.YAML document. -
Method Summary
Modifier and TypeMethodDescriptionReturns the registered lowercase extensions, without a leading dot.static Optional<DocumentFormat> fromFileName(String fileName) Resolves a registered format from a file name, if one is known.booleanReturns whether the bundled file path can decode this format as UTF-8.booleanmatchesFileName(String fileName) Returns whether a file name carries one of this format's aliases.static DocumentFormatReturns the enum constant of this class with the specified name.static DocumentFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
AUTO
Infer each candidate independently, with content detection downstream. -
TEXT
Raw UTF-8 text. Explicit TEXT intentionally accepts any file name. -
MARKDOWN
Markdown text. -
HTML
HTML text. -
CSV
Comma-separated values. -
TSV
Tab-separated values. -
JSON
JSON document. -
JSONL
Newline-delimited JSON document. -
YAML
YAML document. -
XML
XML document. -
PDF
Portable Document Format document. -
DOCX
Office Open XML word-processing document. -
XLSX
Office Open XML spreadsheet. -
PPTX
Office Open XML presentation. -
EPUB
EPUB publication. -
SOURCE_CODE
Source-code family; language detection is performed after selection.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isTextual
public boolean isTextual()Returns whether the bundled file path can decode this format as UTF-8. Structural extraction may still require a format-specific extractor. -
extensions
Returns the registered lowercase extensions, without a leading dot. -
matchesFileName
Returns whether a file name carries one of this format's aliases.TEXTis intentionally special at ingestion time and may be used with any file name; this method still reports only its registered.txtalias. -
fromFileName
Resolves a registered format from a file name, if one is known.
-