ashokpoudel commited on
Commit
edfd769
·
1 Parent(s): d424b19
Files changed (1) hide show
  1. SynonymEditor.py +3 -2
SynonymEditor.py CHANGED
@@ -13,6 +13,7 @@ class SynonymEditor:
13
  self.max_tokens = max_tokens
14
  self.temperature = temperature
15
  self.language = language
 
16
 
17
  # Play with the prompts here and change the return index to change and see the effect of the prompt on the output quality
18
  # Note that the longer the prompt, higher the token used and hence the billing
@@ -55,7 +56,7 @@ class SynonymEditor:
55
  # Split the paragraph to preserve quotation marks
56
  def _split_into_sentences(self, text, few_shots):
57
  if (few_shots == False):
58
- text = text.replace('"', '__QUOTE__')
59
  text = re.sub(r'\s+', ' ', text)
60
  text = text.strip()
61
  sentences = sent_tokenize(text)
@@ -64,7 +65,7 @@ class SynonymEditor:
64
  def _post_process_sentence(self, text):
65
  print(text)
66
  print("==============")
67
- return text.replace('__QUOTE__', '"')
68
 
69
  # Preprocess the text, perform edit task and join back to get the original format
70
  def _edit_text(self, text, few_shots=False):
 
13
  self.max_tokens = max_tokens
14
  self.temperature = temperature
15
  self.language = language
16
+ self.quote = '__NIE__' if (language == 'de') else '__QUOTE__'
17
 
18
  # Play with the prompts here and change the return index to change and see the effect of the prompt on the output quality
19
  # Note that the longer the prompt, higher the token used and hence the billing
 
56
  # Split the paragraph to preserve quotation marks
57
  def _split_into_sentences(self, text, few_shots):
58
  if (few_shots == False):
59
+ text = text.replace('"', self.quote)
60
  text = re.sub(r'\s+', ' ', text)
61
  text = text.strip()
62
  sentences = sent_tokenize(text)
 
65
  def _post_process_sentence(self, text):
66
  print(text)
67
  print("==============")
68
+ return text.replace(self.quote, '"')
69
 
70
  # Preprocess the text, perform edit task and join back to get the original format
71
  def _edit_text(self, text, few_shots=False):