cacode commited on
Commit
b543d62
·
verified ·
1 Parent(s): ac28f88

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +67 -6
app/main.py CHANGED
@@ -80,9 +80,12 @@ def process(image_pil):
80
 
81
  # 2. 批改
82
  corr_prompt = (
83
- "请帮我把下面的英语作文的语法错误改正,输出改正后的文章,"
84
- "原文错误用()括起来,修改部分用[]括起来:\n\n" + revised
85
- )
 
 
 
86
  cm_resp = openai.chat.completions.create(
87
  model="gpt-4o",
88
  messages=[{"role": "user", "content": corr_prompt}]
@@ -91,8 +94,31 @@ def process(image_pil):
91
 
92
  # 3. 批改意见
93
  review_prompt = (
94
- "下面是一份已经批改过的英语作文,请根据批注给出逐条批改意见:\n\n" + corrected
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  )
 
96
  rm_resp = openai.chat.completions.create(
97
  model="gpt-4o",
98
  messages=[{"role": "user", "content": review_prompt}]
@@ -101,7 +127,38 @@ def process(image_pil):
101
 
102
  # 4. 评分
103
  rate_prompt = (
104
- "请按照 IELTS/CEFR 写作评价体系,从语言通顺度、连贯度、词汇与语法三维度打分并给出原因:\n\n" + revised
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  )
106
  rr_resp = openai.chat.completions.create(
107
  model="gpt-4o",
@@ -111,7 +168,11 @@ def process(image_pil):
111
 
112
  # 5. 优秀范文
113
  rewrite_prompt = (
114
- "请使用优秀表达重写下面这篇作文,加粗可供学习的部分:\n\n" + revised
 
 
 
 
115
  )
116
  wm_resp = openai.chat.completions.create(
117
  model="gpt-4o",
 
80
 
81
  # 2. 批改
82
  corr_prompt = (
83
+ "请帮我把下面的英语作文的语法错误改正,输出改正后的文章(只改错误和不流畅之处),请参照下面的格式要求\n\n"
84
+ + "这是格式要求:原文修改部分用()括起来,修改的部分用[]括起来,修改单词括单词、修改短语括短语、修改句子括句子,括的部分精准一些,能反映问题\n\n"
85
+ + "例如:The (rabbish) [rubbish] thrown by visitors has piled up and its lush (verdure no longer flourish) [verdure no longer flourishes] as it (did once) [once did].\n\n"
86
+ + "下面是需要批改的英语习作:\n\n"
87
+ + revised
88
+ )
89
  cm_resp = openai.chat.completions.create(
90
  model="gpt-4o",
91
  messages=[{"role": "user", "content": corr_prompt}]
 
94
 
95
  # 3. 批改意见
96
  review_prompt = (
97
+ """下面是一份已经批改过的英语作文(改正了一些语法错误和不流畅不准确之处),其中小括号表示原文的错误,中括号表示原文的修改部分。请你根据修改的批注,按照如下格式给出批改意见:
98
+
99
+ > 英文有错误的原文1
100
+
101
+ - 错误1和解决方案
102
+ - 错误2和解决方案,后面的以此类推
103
+
104
+ > 英文有错误的原文2
105
+
106
+ - 错误1和解决方案
107
+ - 错误2和解决方案,后面的以此类推
108
+
109
+ 一个错误的句子使用一个“>”开头,错误的句子下面是批注,批注的内容是对错误的解释和修改建议。
110
+
111
+ 比如批注过的原文里面出现了“The (rabbish) [rubbish] thrown by visitors has piled up and its lush (verdure no longer flourish) [verdure no longer flourishes] as it (did once) [once did].”就需要点评下面的内容:
112
+
113
+ > The rabbish thrown by visitors has piled up and its lush verdure no longer flourish as it did once.
114
+
115
+ - rabbish:拼写错误
116
+ - verdure no longer flourish:动词单复数错误,其中verdure是单数,动词使用第三人称单数
117
+ - as it did once:语序错误
118
+
119
+ 接下来是经过批注过的原文:\n\n""" + corrected
120
  )
121
+
122
  rm_resp = openai.chat.completions.create(
123
  model="gpt-4o",
124
  messages=[{"role": "user", "content": review_prompt}]
 
127
 
128
  # 4. 评分
129
  rate_prompt = (
130
+ """
131
+ 你是⼀位资深英语写作批改专家,熟悉 IELTS、CEFR 及 EFL 写作评价体系。特别注意语言准确度。
132
+ 请按照下列三个维度,详细具体分析,写明原因(结合原文相关内容,提到原文中哪里有问题哪里写得好),并且需要提出改进方向和方案:
133
+
134
+ ## 语言通顺度(Fluency)&可读性与风格(Readability & Style)
135
+
136
+ ## 上下文连贯度(Coherence)
137
+
138
+ ## 词汇多样性(Lexical Resource)&语法准确性(Grammatical Accuracy)
139
+
140
+ 例如:
141
+
142
+ ## 语言通顺度 (Fluency) & 可读性与风格 (Readability & Style)
143
+
144
+ - 文中的句子结构变化适中,使用了一些复杂的句子和短语,如“first and foremost”和“in other words”,展现了作者对语言的掌握。
145
+ - 语句的流畅性有待提高。例如,“making an adequately choosing”该句结构不正确,应为“making an adequate choice”。此外,部分句子显得较为冗长,可能会影响读者的理解。
146
+ - 适当分割冗长的句子,确保每个句子传递清晰的信息。例如,可以将“making an adequately choosing, which presents us with more faith when facing arduous challenges and high-demanding tasks”改为“making an adequate choice boosts our confidence when facing arduous challenges and high-demanding tasks”。
147
+
148
+ ## 上下文连贯度 (Coherence)
149
+
150
+ - 文章整体上能够进行较为清晰的逻辑展开,提纲挈领地介绍了选择的重要性。
151
+ - 尽管主要论点较为明确,但论述的衔接和转折有时显得不够流畅。例如,从“none of our outstanding achievements would be obtained if we haven't preserved the preciousness of this virtue”到“choosing is an action word”的过渡有些突兀,缺乏自然的逻辑连接。
152
+ - 使用更有效的过渡词或短语来增强段落之间的连贯性。例如,增加“Furthermore”或“Moreover”来连接不同的思想,使其流畅过渡。
153
+
154
+ ## 词汇多样性 (Lexical Resource) & 语法准确性 (Grammatical Accuracy)
155
+
156
+ - 使用了一些较为高级的词汇,如“prerequisite”和“unleash”,展现了较好的词汇量。
157
+ - 词汇使用上还有提升空间,存在一些使用不当和语法错误,如“making an adequately choosing”不符合语法,应为“making an adequate choice”;“the possibility to meet triumph”应为“the possibility of achieving success”。
158
+ - 清晰检查词汇的搭配和语法使用,确保语法结构的正确性,尽量避免错误。建议多做语法练习,增强对词汇搭配的理解,在写作中多样化词汇的使用。
159
+
160
+ 下面是这篇英文习作的原文:\n\n
161
+ """ + revised
162
  )
163
  rr_resp = openai.chat.completions.create(
164
  model="gpt-4o",
 
168
 
169
  # 5. 优秀范文
170
  rewrite_prompt = (
171
+ """
172
+ 你是⼀位资深英语写作批改专家,熟悉 IELTS、CEFR 及 EFL 写作评价体系。特别注意语言准确度。
173
+ 使用优秀的英语表达重写下面这篇英文习作,要展现优秀的词汇和语法,使用地道的表达方式,尽量使用多样化的句式、短语和词汇(但是不要通篇生僻,可以使用一两个表情达意的优秀词汇,需要保证流畅度)。
174
+ 加粗可供学习的部分。
175
+ 下面是这篇英文习作原文:\n\n""" + revised
176
  )
177
  wm_resp = openai.chat.completions.create(
178
  model="gpt-4o",