PlainTextExtractor
class \
A simple text extractor to extract text from plain text files.
Attributes
Table of Contents
Interfaces
- TextExtractorInterface
- Interface for text extractors, which are registered as tagged services via the #[AsTextExtractor] attribute or the 'fal.text_extractor' service tag.
- StructuredTextExtractorInterface
- A text extractor that is bound to MIME types and returns, next to the text, the metadata it found in the resource, such as a title or keywords.
Methods
- canExtractText() : bool
- Checks if the given file can be read by this extractor
- extractStructuredText() : ExtractedText
- The actual text extraction, returning the text and the metadata of the resource
- extractText() : string
- The actual text extraction.
- getSupportedMimeTypes() : array<int, string>
- Lowercase MIME types which this extractor can currently handle. Generic detections, such as "application/zip" for a Word document, are resolved to the concrete MIME type by the file extension via $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility'], so an extractor does not need to declare them.
Methods
canExtractText()
Checks if the given file can be read by this extractor
public
canExtractText(FileInterface $file) : bool
Parameters
- $file : FileInterface
Return values
boolextractStructuredText()
The actual text extraction, returning the text and the metadata of the resource
public
extractStructuredText(SystemResourceInterface $resource) : ExtractedText
Parameters
- $resource : SystemResourceInterface
Return values
ExtractedTextextractText()
The actual text extraction.
public
extractText(FileInterface $file) : string
Parameters
- $file : FileInterface
Return values
stringgetSupportedMimeTypes()
Lowercase MIME types which this extractor can currently handle. Generic detections, such as "application/zip" for a Word document, are resolved to the concrete MIME type by the file extension via $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility'], so an extractor does not need to declare them.
public
getSupportedMimeTypes() : array<int, string>