该 ai.fix_grammar 函数使用生成 AI 通过一行代码更正输入文本的拼写、语法和标点符号。
注释
概述
              ai.fix_grammar 函数扩展了 pandas Series 类。 若要更正每行输入的拼写、语法和标点符号,请对 pandas DataFrame 文本列调用函数。
该函数返回一个 pandas Series,其中包含更正的文本值,这些值可以存储在新的 DataFrame 列中。
Syntax
df["corrections"] = df["input"].ai.fix_grammar()
参数
None
退货
该函数返回一个 pandas Series ,其中包含每个输入文本行的更正文本。 如果输入的文本是 null,则结果为 null。
Example
# This code uses AI. Always review output for mistakes. 
# Read terms: https://azure.microsoft.com/support/legal/preview-supplemental-terms/.
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_extract提取实体。
使用 ai.generate_response回答自定义用户提示。
使用ai.summarize功能汇总文本。
使用 ai.translate 翻译文本。
详细了解 完整的 AI 函数集。
自定义 AI 函数的配置。
我们错过了所需的功能吗? 在面料创意论坛上提出建议。