Skip to content

语法纠错

数据

json
{
    "sentsFeedback": [
        {
            "rawSent": "There could be several reasons for the phenomenon, one of which is that internet developed fast.",
            "paraId": 1,
            "sentId": 2,
            "errorPosInfos": [
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "冠词包含不定冠词a和an、定冠词the。不定冠词a和an仅用于单数可数名词前;定冠词the表示特指,用在可数名词和不可数名词前。",
                    "reason": "冠词缺失,建议插入〖the〗",
                    "isValidLangChunk": true,
                    "orgChunk": "internet",
                    "exampleCases": [
                        {
                            "right": "A friend of mine came to my home today.",
                            "error": "Friend of mine came to my home today.",
                            "rightTranslate": "今天我的一个朋友来我家。"
                        },
                        {
                            "right": "The earth goes around the sun.",
                            "error": "The earth goes around sun.",
                            "rightTranslate": "地球绕着太阳转。"
                        }
                    ],
                    "errBaseInfo": "名词前的冠词不能省略,建议插入【the】",
                    "newErrorType": 20,
                    "errorTypeTitle": "冠词缺失",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "名词前的冠词不能省略",
                    "startPos": 72,
                    "endPos": 80,
                    "structType": 2,
                    "errorTypeCode": "`Insert:Default`",
                    "errorTypeId": "01005",
                    "cvalidChunk": "the",
                    "showType": 1,
                    "id": 1730923055891,
                    "vip": false,
                    "cardSubtitle": "在名词前补全冠词",
                    "errToBBasicType": "句法",
                    "correctChunk": "the internet"
                },
                {
                    "newSubErrorType": 1,
                    "reason": "词汇频繁使用,建议替换新单词",
                    "isValidLangChunk": true,
                    "orgChunk": "fast",
                    "exampleCases": [],
                    "errBaseInfo": "词汇使用频繁,建议替换新单词",
                    "newErrorType": 20,
                    "errorTypeTitle": "词汇频繁使用",
                    "type": "synonym",
                    "nodeType": 1,
                    "detailReason": "词汇使用频繁",
                    "startPos": 91,
                    "endPos": 95,
                    "target": [
                        "quickly",
                        "rapidly",
                        "quick"
                    ],
                    "structType": 3,
                    "errorTypeCode": "suggest",
                    "errorTypeId": "32000",
                    "showType": 2,
                    "id": 1730923055890,
                    "vip": true,
                    "cardSubtitle": "替换新单词",
                    "correctChunk": "fast"
                }
            ],
            "sentFeedback": "冠词缺失,建议插入〖the〗;词汇频繁使用,建议替换新单词",
            "sentStartPos": 232,
            "correctedSent": "There could be several reasons for the phenomenon, one of which is that the internet developed fast.",
            "rawSegSent": "there could be several reasons for the phenomenon , one of which is that internet developed fast .",
            "isContainGrammarError": true,
            "isContainTypoError": false,
            "sentScore": 100.0,
            "isValidLangSent": true
        },
        {
            "rawSent": "From 2G network to nowadays 5G network, there are only went through less than ten years.",
            "paraId": 1,
            "sentId": 3,
            "errorPosInfos": [
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "动词是表示主语动作或状态的词,分为助动词和实义动词等。其中,实义动词有现在分词、过去分词、过去式等多种形式,动词形式不同,用法也不同。英语中不同时间和方式发生的动作或状态要用谓语动词的不同形式来表示。",
                    "reason": "动词变形错误,建议将〖are〗修改为【have】",
                    "isValidLangChunk": true,
                    "orgChunk": "are",
                    "exampleCases": [
                        {
                            "right": "She dropped out after only a year.",
                            "error": "She dropping out after only a year.",
                            "rightTranslate": "她仅在一年后就退学了。"
                        },
                        {
                            "right": "We finally decided to give up our plan.",
                            "error": "We finally deciding to give up our plan.",
                            "rightTranslate": "我们最后决定放弃我们的计划。"
                        }
                    ],
                    "errBaseInfo": "动词形式不当会影响语义,建议将【are】修改为【have】",
                    "newErrorType": 20,
                    "errorTypeTitle": "动词变形错误",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "动词形式不当会影响语义",
                    "startPos": 46,
                    "endPos": 49,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "07200",
                    "showType": 1,
                    "id": 1730923055893,
                    "vip": false,
                    "cardSubtitle": "修改动词形式",
                    "errToBBasicType": "句法",
                    "correctChunk": "have"
                },
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "一般现在时表示经常性的动作或状态,或者客观事实;现在完成时表示过去发生的动作对现在的影响,或是过去的状态持续到现在,还可能持续下去。",
                    "reason": "动词时态错误,建议将〖went through〗修改为【been】",
                    "isValidLangChunk": true,
                    "orgChunk": "went through",
                    "exampleCases": [
                        {
                            "right": "We have known each other since childhood.",
                            "error": "We know each other since childhood.",
                            "rightTranslate": "我们从小就认识。"
                        },
                        {
                            "right": "This is the first time I have drunk Californian champagne.",
                            "error": "This is the first time I drink Californian champagne.",
                            "rightTranslate": "这是我第一次喝加州的香槟酒。"
                        }
                    ],
                    "errBaseInfo": "用现在完成时表示过去的动作对现在的影响和迄今发生的事,建议将【went through】修改为【been】",
                    "newErrorType": 20,
                    "errorTypeTitle": "动词时态错误",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "用现在完成时表示过去的动作对现在的影响和迄今发生的事",
                    "startPos": 55,
                    "endPos": 67,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "07236",
                    "showType": 1,
                    "id": 1730923055892,
                    "vip": false,
                    "cardSubtitle": "修改动词时态为现在完成时",
                    "errToBBasicType": "句法",
                    "correctChunk": "been"
                }
            ],
            "sentFeedback": "动词变形错误,建议将〖are〗修改为【have】;动词时态错误,建议将〖went through〗修改为【been】",
            "sentStartPos": 329,
            "correctedSent": "From 2G network to nowadays 5G network, there have only been less than ten years.",
            "rawSegSent": "from 2g network to nowadays 5g network , there are only went through less than ten years .",
            "isContainGrammarError": true,
            "isContainTypoError": false,
            "sentScore": 100.0,
            "isValidLangSent": true
        },
        {
            "rawSent": "That was caused more and more eye-catching content in the internet, almost people spend more time on mobile phone, including the children.",
            "paraId": 1,
            "sentId": 4,
            "errorPosInfos": [
                {
                    "newSubErrorType": 3,
                    "knowledgeExp": "被动语态是由原主动句的宾语变成被动句的主语。英语里只有及物动词后面可以直接跟宾语,才有被动语态。不及物动词没有宾语,因此没有被动语态。",
                    "reason": "助动词冗余,建议删除〖was〗",
                    "isValidLangChunk": true,
                    "orgChunk": "was ",
                    "exampleCases": [
                        {
                            "right": "She sat and stared at the letter in front of her.",
                            "error": "She was sat and stared at the letter in front of her.",
                            "rightTranslate": "她坐着,盯着她面前的信。"
                        },
                        {
                            "right": "He laughed for 10 minutes.",
                            "error": "He was laughed for 10 minutes.",
                            "rightTranslate": "他大笑了十分钟。"
                        }
                    ],
                    "errBaseInfo": "不及物动词没有被动语态,建议删除【was】",
                    "newErrorType": 20,
                    "errorTypeTitle": "助动词冗余",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "不及物动词没有被动语态",
                    "startPos": 5,
                    "endPos": 9,
                    "rvalidChunk": "was",
                    "structType": 2,
                    "errorTypeCode": "`Delete:Default`",
                    "errorTypeId": "07104",
                    "showType": 1,
                    "id": 1730923055896,
                    "vip": false,
                    "cardSubtitle": "去掉助动词",
                    "errToBBasicType": "句法",
                    "correctChunk": ""
                },
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "介词与形容词、动词、名词等搭配没有固定规律,需要熟记搭配,并且依据语境、句子的含义来进行正确的选择。",
                    "reason": "介词使用不当,建议将〖in〗修改为【on】",
                    "isValidLangChunk": true,
                    "orgChunk": "in",
                    "exampleCases": [
                        {
                            "right": "Her head nodded in agreement.",
                            "error": "Her head nodded of agreement.",
                            "rightTranslate": "她点了下头,表示同意。"
                        }
                    ],
                    "errBaseInfo": "介词与名词搭配应符合语义,建议将【in】修改为【on】",
                    "newErrorType": 20,
                    "errorTypeTitle": "介词使用不当",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "介词与名词搭配应符合语义",
                    "startPos": 51,
                    "endPos": 53,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "04204",
                    "showType": 1,
                    "id": 1730923055897,
                    "vip": false,
                    "cardSubtitle": "修改介词",
                    "errToBBasicType": "词法",
                    "correctChunk": "on"
                },
                {
                    "newSubErrorType": 1,
                    "reason": "标点符号混淆,建议将〖,〗修改为【.】",
                    "isValidLangChunk": true,
                    "orgChunk": ",",
                    "exampleCases": [],
                    "errBaseInfo": "不符合英文的标点格式规范,建议将【,】修改为【.】",
                    "newErrorType": 20,
                    "errorTypeTitle": "标点符号混淆",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "不符合英文的标点格式规范",
                    "startPos": 66,
                    "endPos": 67,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "09200",
                    "showType": 1,
                    "id": 1730923055900,
                    "vip": false,
                    "cardSubtitle": "修改标点符号",
                    "errToBBasicType": "格式",
                    "correctChunk": "."
                },
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "应根据语义使用正确的词汇或短语,并在阅读和使用英语中,注意不能把其中的一些“形式上相近”的词组混淆在一起。",
                    "reason": "词汇使用错误,建议将〖almost〗修改为【Most】",
                    "isValidLangChunk": true,
                    "orgChunk": "almost",
                    "exampleCases": [
                        {
                            "right": "She arranged everything with her customary efficiency.",
                            "error": "She arranged everything with her customary efficacy.",
                            "rightTranslate": "她用她特有的高效办事方法把一切都安排妥当。"
                        },
                        {
                            "right": "The hotel has exclusive access to the beach.",
                            "error": "The hotel has exclusive assess to the beach.",
                            "rightTranslate": "这家旅馆有通向海滩的专用通道。"
                        }
                    ],
                    "errBaseInfo": "使用词汇要符合语义和上下文,建议将【almost】修改为【Most】",
                    "newErrorType": 20,
                    "errorTypeTitle": "词汇使用错误",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "使用词汇要符合语义和上下文",
                    "startPos": 68,
                    "endPos": 74,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "00200",
                    "showType": 1,
                    "id": 1730923055898,
                    "vip": false,
                    "cardSubtitle": "修改使用不当的词汇",
                    "errToBBasicType": "词法",
                    "correctChunk": "Most"
                },
                {
                    "newSubErrorType": 1,
                    "reason": "词汇频繁使用,建议替换新单词",
                    "isValidLangChunk": true,
                    "orgChunk": "more",
                    "exampleCases": [],
                    "errBaseInfo": "词汇使用频繁,建议替换新单词",
                    "newErrorType": 20,
                    "errorTypeTitle": "词汇频繁使用",
                    "type": "synonym",
                    "nodeType": 1,
                    "detailReason": "词汇使用频繁",
                    "startPos": 88,
                    "endPos": 92,
                    "target": [
                        "extra"
                    ],
                    "structType": 3,
                    "errorTypeCode": "suggest",
                    "errorTypeId": "32000",
                    "showType": 2,
                    "id": 1730923055895,
                    "vip": true,
                    "cardSubtitle": "替换新单词",
                    "correctChunk": "more"
                },
                {
                    "newSubErrorType": 1,
                    "knowledgeExp": "名词复数指两个或两个以上的可数名词;名词单数指个数为1。",
                    "reason": "名词单复数错误,建议将〖phone〗修改为【phones】",
                    "isValidLangChunk": true,
                    "orgChunk": "phone",
                    "exampleCases": [
                        {
                            "right": "Lions belong to the cat family.",
                            "error": "Lion belong to the cat family.",
                            "rightTranslate": "狮子属于猫科动物。"
                        },
                        {
                            "right": "We have been working together for years.",
                            "error": "We have been working together for year.",
                            "rightTranslate": "我们在一起工作很多年了。"
                        }
                    ],
                    "errBaseInfo": "根据名词是否可数,数量是否大于1来选择单数或复数,建议将【phone】修改为【phones】",
                    "newErrorType": 20,
                    "errorTypeTitle": "名词单复数错误",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "根据名词是否可数,数量是否大于1来选择单数或复数",
                    "startPos": 108,
                    "endPos": 113,
                    "structType": 2,
                    "errorTypeCode": "`Replace:Default`",
                    "errorTypeId": "02202",
                    "showType": 1,
                    "id": 1730923055901,
                    "vip": false,
                    "cardSubtitle": "修改名词单复数",
                    "errToBBasicType": "词法",
                    "correctChunk": "phones"
                },
                {
                    "newSubErrorType": 3,
                    "knowledgeExp": "冠词包含不定冠词a和an,以及定冠词the。不定冠词a和an仅用于单数可数名词前;定冠词the表示特指,用在可数名词和不可数名词前。冠词一般不需要重复使用。",
                    "reason": "冠词冗余,建议删除〖the〗",
                    "isValidLangChunk": true,
                    "orgChunk": "the ",
                    "exampleCases": [
                        {
                            "right": "They encourage an image of the region as an otherworldly sort of place.",
                            "error": "They encourage an image of the region as the an otherworldly sort of place.",
                            "rightTranslate": "他们鼓励将这儿看作一个超凡脱俗的地方。"
                        }
                    ],
                    "errBaseInfo": "冗余的冠词难以确定名词的范围或数量,建议删除【the】",
                    "newErrorType": 20,
                    "errorTypeTitle": "冠词冗余",
                    "type": "grammar_v1",
                    "nodeType": 1,
                    "detailReason": "冗余的冠词难以确定名词的范围或数量",
                    "startPos": 125,
                    "endPos": 129,
                    "rvalidChunk": "the",
                    "structType": 2,
                    "errorTypeCode": "`Delete:Default`",
                    "errorTypeId": "01106",
                    "showType": 1,
                    "id": 1730923055899,
                    "vip": false,
                    "cardSubtitle": "去掉多余的冠词",
                    "errToBBasicType": "句法",
                    "correctChunk": ""
                }
            ],
            "sentFeedback": "助动词冗余,建议删除〖was〗;介词使用不当,建议将〖in〗修改为【on】;标点符号混淆,建议将〖,〗修改为【.】;词汇使用错误,建议将〖almost〗修改为【Most】;词汇频繁使用,建议替换新单词;名词单复数错误,建议将〖phone〗修改为【phones】;冠词冗余,建议删除〖the〗",
            "sentStartPos": 418,
            "correctedSent": "That caused more and more eye-catching content on the internet. Most people spend more time on mobile phones, including children.",
            "rawSegSent": "that was caused more and more eye-catching content in the internet , almost people spend more time on mobile phone , including the children .",
            "isContainGrammarError": true,
            "isContainTypoError": false,
            "sentScore": 100.0,
            "isValidLangSent": true
        },
    ]
}

前端页面

访问前端页面

alt text

反馈框内容处理

反馈框的内容处理主要基于 errorPosInfos 数组中的错误信息,处理逻辑如下:

1. 错误类型判断

  • 通过 isContainGrammarError 判断是否包含语法错误
    • true: 使用红色反馈框
    • false: 检查 errorPosInfos 是否有建议内容,使用黄色反馈框

2. 反馈框内容结构

反馈框内容包含以下部分:

html
<div class="title">
    <!-- 根据错误类型显示不同的标题 -->
    <!-- grammar_v1: {原文} 🡢 {修改建议} -->
    <!-- 其他: 错误原因 -->
</div>
<div class="content">
    <div class="error-item">
        <p>{错误原因说明}</p>
        <!-- 如果有替换建议 -->
        <div class="suggestions">
            建议替换为: <strong><em>{建议词1}</em></strong>、<strong><em>{建议词2}</em></strong>...
        </div>
        <!-- 如果有知识点解释 -->
        {知识点说明}
        <!-- 如果有示例 -->
        {示例说明}
    </div>
</div>

3. 错误类型示例

  1. 语法错误 (grammar_v1)

    • 标点符号缺失
    • 介词使用不当
    • 词汇拼写错误
    • 冠词缺失/冗余
    • 空格缺失
    • 词汇使用错误
  2. 建议优化 (synonym)

    • 词汇频繁使用
    • 建议替换新单词
  3. 文体建议 (literary)

    • 使用第一人称代词
    • 其他文体相关建议

4. 错误信息字段说明

  • reason: 错误原因简述
  • knowledgeExp: 相关知识点解释
  • orgChunk: 原始文本片段
  • correctChunk: 修正后的文本片段
  • target: 建议替换的词汇数组
  • exampleCases: 示例用例数组
    • right: 正确示例
    • error: 错误示例
    • rightTranslate: 示例中文翻译