ak5005 commited on
Commit
22ee258
·
1 Parent(s): 049b49d

formality feedback

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -73,6 +73,16 @@ def response_generator(prompt):
73
  for error in ppl["errors"]:
74
  response += f" - {error['message']}\n"
75
 
 
 
 
 
 
 
 
 
 
 
76
  lines = response.split("\n")
77
  for line in lines:
78
  for word in line.split():
 
73
  for error in ppl["errors"]:
74
  response += f" - {error['message']}\n"
75
 
76
+ frm_s = frm["normalized"]
77
+ response += f"\nYour formality score is {score(frm_s)}:\n"
78
+
79
+ if frm["src_label"] != frm["trg_label"]:
80
+ response += (
81
+ f"\n Tone mismatch: "
82
+ f"your translation is “{frm['trg_label']}”\n"
83
+ f"but likely should be “{frm['src_label']}” "
84
+ )
85
+
86
  lines = response.split("\n")
87
  for line in lines:
88
  for word in line.split():