TextSummarizer
class TextSummarizer : NSObjectPerforms summarization on text using a LiteRT-LM model asset bundle.
-
Creates a new instance of
TextSummarizerfrom an absolute path to a model asset bundle.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathAbsolute path to a model file on the device.
Return Value
A new instance of
TextSummarizer. -
Creates a new instance of
TextSummarizerfrom the givenTextSummarizerOptions.Declaration
Swift
init(options: TextSummarizerOptions) throwsParameters
optionsThe TextSummarizerOptions used to configure the summarizer.
Return Value
A new instance of
TextSummarizer. -
Performs summarization on the input text.
Declaration
Swift
func summarize(text: String) throws -> TextSummarizerResultParameters
textThe String on which summarization is to be performed.
Return Value
A
TextSummarizerResultcontaining the complete summary. -
Performs summarization on the input text and delivers incremental chunks via the completion handler.
Declaration
Swift
func summarizeStreaming(text: String, completion: @escaping (TextSummarizerResult?, Error?) -> Void) throwsParameters
textThe input text to summarize.
completionCallback invoked with incremental summarization chunks.
-
Shuts down the
TextSummarizerwhen all work is done.Declaration
Swift
func close() throws