該 ai.fix_grammar 功能使用生成式 AI 來糾正輸入文本的拼寫、語法和標點符號,只需一行代碼即可。
備註
概觀
ai.fix_grammar 函式會擴充 pandas Series 類別。 若要更正每列輸入的拼字、文法和標點符號,請在 pandas DataFrame 文字欄上呼叫函數。
函式會傳回 pandas Series,其中包含更正的文字值,可儲存在新的 DataFrame 欄位中。
語法
df["corrections"] = df["input"].ai.fix_grammar()
參數
None
退貨
函式會傳回 pandas Series,其中包含每個輸入文字行的更正文字。 如果輸入文字 null,則結果會 null。
Example
# This code uses AI. Always review output for mistakes.
df = pd.DataFrame([
"There are an error here.",
"She and me go weigh back. We used to hang out every weeks.",
"The big picture are right, but you're details is all wrong."
], columns=["text"])
df["corrections"] = df["text"].ai.fix_grammar()
display(df)
此範例程式碼儲存格提供下列輸出:
相關內容
用 ai.analyze_sentiment檢測情緒。
使用 ai.classify 對文本進行分類。
用 ai.embed 產生向量嵌入。
使用 ai_extract 擷取實體。
使用 ai.generate_response 回答自訂使用者提示。
使用 ai.similarity 計算相似度。
使用 ai.summarize 總結文本。
使用 ai.translate 翻譯文本。
進一步了解 全套 AI 功能。
自訂 AI功能的配置。
我們錯過了您需要的功能嗎? 請在 Fabric Ideas 論壇上提出建議。