Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Podsumowanie dokumentów jest cennym narzędziem do przeglądania treści, szybkiego wglądu lub przygotowywania streszczeń. Aspose.Words obsługuje podsumowanie dokumentów przy użyciu modeli opartych na AI, co ułatwia przetwarzanie długiego tekstu. Ta funkcja, dostępna w module aspose.words.ai, integruje zaawansowane generatywne modele językowe z OpenAI i Google, a także Claude’s antropiczne generatywne modele językowe. Lista obsługiwanych modeli jest dostępna w wyliczeniu AiModelType.
Możesz określić różne opcje podsumowania zawartości dokumentu. Użyj metody summarize, aby wygenerować podsumowanie dokumentu. Możesz także ustawić długość podsumowania za pomocą właściwości summary_length.
Dzięki Aspose.Words implementacja podsumowania dokumentu jest prosta. Poniższy przykład kodu pokazuje, jak podsumować dokument przy użyciu modelu GPT-4o:
first_doc = aw.Document(MyDir + "Big document.docx")
second_doc = aw.Document(MyDir + "Document.docx")
api_key = os.getenv("API_KEY")
# Use OpenAI or Google generative language models.
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model()
options = aw.ai.SummarizeOptions()
options.summary_length = aw.ai.SummaryLength.SHORT
one_document_summary = model.summarize(first_doc, options)
oneDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.One.docx")
options.summary_length = aw.ai.SummaryLength.LONG
multi_document_summary = model.summarize([first_doc, second_doc], options)
multiDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.Multi.docx")
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.