Aspose.Words for Python via .NET OpenAI, Google, Claude AI 모델을 사용하여 문서의 문법 오류를 감지하고 강조 표시합니다. CheckGrammar 메서드는 DOC, DOCX, RTF, PDF, HTML, Markdown, ODT, TXT, EPUB 파일을 분석하고 문법 문제를 표시합니다 — 수동 교정 없이도 깔끔하고 전문적인 콘텐츠를 제공할 수 있도록 도와줍니다.
인증을 위해서는 선택한 AI 제공업체의 API 키가 필요합니다. 지원되는 모델 전체 목록은 API Reference를 참조하세요.
오늘 바로 Python 문법 검사를 시작하세요 — 위의 실시간 데모를 사용해 보세요.
pip install aspose-words
복사
doc = aw.Document("Document.docx")
api_key = os.getenv("API_KEY")
# OpenAI의 생성 언어 모델을 사용하십시오.
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model()
grammar_options = aw.ai.CheckGrammarOptions()
grammar_options.improve_stylistics = True
proofed_doc = model.check_grammar(doc, grammar_options)
proofed_doc.save("Output.docx")
doc = aw.Document("Document.docx")
# Pass an empty string if the self-hosted model does not require an API key.
model = CustomAiModel("my-model-24b", "https://your-server.com/v1").with_api_key("")
grammar_options = aw.ai.CheckGrammarOptions()
grammar_options.improve_stylistics = True
proofed_doc = model.check_grammar(doc, grammar_options)
proofed_doc.save("Output.docx")
class CustomAiModel(aw.ai.OpenAiModel):
def __init__(self, name, url):
super().__init__(name)
self._url = url
@property
def url(self):
return self._url
이 패키지는 Python ≥3.5 및 <3.12 와 호환됩니다. Linux용 소프트웨어를 개발하는 경우 제품 설명서 에서 gcc 및 libpython 에 대한 추가 요구 사항을 살펴보십시오.