Corianas commited on
Commit
1993817
1 Parent(s): a0a49ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -22,12 +22,29 @@ def remove_caseifer(text):
22
  return new_text
23
 
24
  def add_caseifer(text):
 
 
 
 
 
 
 
 
 
 
 
25
  new_text = ""
 
 
26
  for char in text:
27
- if char.isupper():
28
- new_text += "↨" + char.lower()
29
- else:
30
- new_text += char
 
 
 
 
31
  return new_text
32
 
33
  max_new_tokens = 88 # number of tokens generated in each sample
 
22
  return new_text
23
 
24
  def add_caseifer(text):
25
+ tokenlist = set("\n\" !$&'#,/+=-<>*@.:;[]{}()^_?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzèé")
26
+ replace_map = { # Define a mapping of characters to be replaced
27
+ "{": "[",
28
+ "(": "[",
29
+ "}": "]",
30
+ ")": "]",
31
+ "&":"and"
32
+ }
33
+ upperlist = set("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
34
+ lowerlist = set("abcdefghijklmnopqrstuvwxyz")
35
+
36
  new_text = ""
37
+ uppers = 0
38
+ lowers = 0
39
  for char in text:
40
+ if char in tokenlist:
41
+ if char in upperlist:
42
+ uppers += 1
43
+ new_text += "↨" + char.lower()
44
+ elif char in replace_map:
45
+ new_text += replace_map[char]
46
+ else:
47
+ new_text += char
48
  return new_text
49
 
50
  max_new_tokens = 88 # number of tokens generated in each sample