Spaces:
Runtime error
Runtime error
Commit
·
85854a6
1
Parent(s):
7b26957
Update app.py
Browse files
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(?=[
|
9 |
text = re.sub(pattern, '', text)
|
10 |
-
|
|
|
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
|