Toya0421 commited on
Commit
f4d0acc
·
verified ·
1 Parent(s): 59b00da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -63,7 +63,7 @@ def load_text(path: str) -> str:
63
 
64
 
65
  def target_flesch_from_level(level: int) -> int:
66
- level_to_flesch = {1: 90, 2: 75, 3: 65, 4: 55, 5: 50}
67
  return level_to_flesch[int(level)]
68
 
69
 
@@ -115,49 +115,49 @@ def build_prompt(text: str, target_level: int, original_fre: Optional[float] = N
115
  return f"""
116
  The Flesch Reading Ease score is a numeric measure of text readability,
117
  where higher scores indicate easier readability and lower scores indicate more difficult text.
118
-
119
  In this task, we are trying to rewrite a given text into the target Flesch Reading Ease score
120
  and preserving the original meaning and information.
121
-
122
  Given the original draft (Flesch Reading Ease = {original_fre}):
123
-
124
  [TEXT START]
125
  {text}
126
  [TEXT END]
127
-
128
  Rewrite the above text to the difficulty level of:
129
  Flesch Reading Ease = {target_flesch}
130
-
131
  Follow the instructions below carefully.
132
-
133
- Content preservation:
 
 
 
 
 
 
 
 
134
  - Maintain the original meaning faithfully.
135
  - Do not add new information.
136
  - Do not remove important information.
137
  - Do not introduce interpretations or opinions that are not present in the original text.
138
-
139
- Scope of rewriting:
 
 
 
 
 
140
  - Rewrite ONLY the main body text.
141
  - Completely EXCLUDE titles, headings, chapter labels, author names, source information, footnotes, annotations, and introductions.
142
  - Do NOT include any text other than the rewritten main body under any circumstances.
143
-
144
- Readability control guidelines:
145
- - Make sentences shorter.
146
- - Prefer familiar, high-frequency vocabulary.
147
- - Use simple and direct sentence structures.
148
- - Avoid jargon; if technical terms are necessary, explain them clearly in simple language.
149
- - Minimize figurative language, idioms, and expressions whose meanings are not directly inferable.
150
-
151
- Language modernization:
152
- - Rewrite the text in clear, modern English.
153
- - Remove archaic expressions and unnatural or outdated syntax typical of older texts at all levels..
154
-
155
- Structure and formatting:
156
  - Preserve the original paragraph structure of the main text.
157
  - Insert exactly ONE blank line between paragraphs.
158
  - Do NOT create new section breaks, chapter divisions, or headings.
159
-
160
- Output constraints:
161
  - Output only the rewritten text.
162
  - Do not include explanations, comments, or metadata.
163
  - Do not include [TEXT START] and [TEXT END] in the output.
 
63
 
64
 
65
  def target_flesch_from_level(level: int) -> int:
66
+ level_to_flesch = {1: 90, 2: 80, 3: 70, 4: 60, 5: 50}
67
  return level_to_flesch[int(level)]
68
 
69
 
 
115
  return f"""
116
  The Flesch Reading Ease score is a numeric measure of text readability,
117
  where higher scores indicate easier readability and lower scores indicate more difficult text.
118
+
119
  In this task, we are trying to rewrite a given text into the target Flesch Reading Ease score
120
  and preserving the original meaning and information.
121
+
122
  Given the original draft (Flesch Reading Ease = {original_fre}):
123
+
124
  [TEXT START]
125
  {text}
126
  [TEXT END]
127
+
128
  Rewrite the above text to the difficulty level of:
129
  Flesch Reading Ease = {target_flesch}
130
+
131
  Follow the instructions below carefully.
132
+
133
+ Numerous Readability Manipulation
134
+ - Make sentences shorter.
135
+ - Prefer familiar, high-frequency vocabulary.
136
+ - Use simple and direct sentence structures.
137
+ - Avoid jargon; if technical terms are necessary, explain them clearly in simple language.
138
+ - Minimize figurative language, idioms, and expressions whose meanings are not directly inferable.
139
+
140
+ Qualitative Readability Control
141
+ ・Content preservation
142
  - Maintain the original meaning faithfully.
143
  - Do not add new information.
144
  - Do not remove important information.
145
  - Do not introduce interpretations or opinions that are not present in the original text.
146
+
147
+ ・Language modernization
148
+ - Rewrite the text in clear, modern English.
149
+ - Remove archaic expressions and unnatural or outdated syntax typical of older texts at all levels.
150
+
151
+ Formatting Constraints
152
+ ・Scope of rewriting
153
  - Rewrite ONLY the main body text.
154
  - Completely EXCLUDE titles, headings, chapter labels, author names, source information, footnotes, annotations, and introductions.
155
  - Do NOT include any text other than the rewritten main body under any circumstances.
156
+
157
+ ・Structure and formatting
 
 
 
 
 
 
 
 
 
 
 
158
  - Preserve the original paragraph structure of the main text.
159
  - Insert exactly ONE blank line between paragraphs.
160
  - Do NOT create new section breaks, chapter divisions, or headings.
 
 
161
  - Output only the rewritten text.
162
  - Do not include explanations, comments, or metadata.
163
  - Do not include [TEXT START] and [TEXT END] in the output.