ziyadbastaili commited on
Commit
85854a6
1 Parent(s): 7b26957

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,13 +1,15 @@
1
  import gradio as gr
2
  from sentence_transformers import SentenceTransformer, util
3
  import string, re
 
4
 
5
  model = None
6
  def prepare(text):
7
  text = text.translate(str.maketrans('', '', string.punctuation + '”“'))
8
- pattern = r"\b(?=[MDCLXVIΙ])M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})([]X|[]V|V?[]{0,3})\b\.?"
9
  text = re.sub(pattern, '', text)
10
- return text.upper()
 
11
 
12
  def semantic(company_1, company_2):
13
  global model
 
1
  import gradio as gr
2
  from sentence_transformers import SentenceTransformer, util
3
  import string, re
4
+ from cleanco import basename
5
 
6
  model = None
7
  def prepare(text):
8
  text = text.translate(str.maketrans('', '', string.punctuation + '”“'))
9
+ pattern = r"\b(?=[MDCLXVII])M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})([II]X|[II]V|V?[II]{0,3})\b\.?"
10
  text = re.sub(pattern, '', text)
11
+ text = basename(text).upper()
12
+ return text
13
 
14
  def semantic(company_1, company_2):
15
  global model