DHRUV SHEKHAWAT commited on
Commit
6817b3e
·
1 Parent(s): 2040a2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -56,8 +56,14 @@ if load_checkpoint:
56
  transformer = checkpoint['transformer']
57
 
58
 
59
-
60
- question = text2
 
 
 
 
 
 
61
 
62
  max_len = 128
63
  enc_qus = [word_map.get(word, word_map['<unk>']) for word in question.split()]
 
56
  transformer = checkpoint['transformer']
57
 
58
 
59
+ def remove_punc(string):
60
+ punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
61
+ no_punct = ""
62
+ for char in string:
63
+ if char not in punctuations:
64
+ no_punct = no_punct + char # space is also a character
65
+ return no_punct.lower()
66
+ question = remove_punc(text2)
67
 
68
  max_len = 128
69
  enc_qus = [word_map.get(word, word_map['<unk>']) for word in question.split()]