Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import os
|
|
12 |
from transformers import pipeline
|
13 |
import itertools
|
14 |
import pandas as pd
|
15 |
-
|
16 |
|
17 |
OUT_HEADERS = ['E','S','G']
|
18 |
DF_SP500 = pd.read_csv('SP500_constituents.zip',compression=dict(method='zip'))
|
@@ -29,12 +29,13 @@ MODEL_SENTIMENT_ANALYSIS = "ProsusAI/finbert"
|
|
29 |
def get_company_sectors(extracted_names, threshold=0.95):
|
30 |
'''
|
31 |
'''
|
|
|
32 |
output = []
|
33 |
standard_names_tuples = []
|
34 |
for extracted_name in extracted_names:
|
35 |
-
name_match =
|
36 |
DF_SP500.Name,
|
37 |
-
scorer=
|
38 |
similarity = name_match[1]/100
|
39 |
if similarity >= threshold:
|
40 |
standard_names_tuples.append(name_match[:2])
|
|
|
12 |
from transformers import pipeline
|
13 |
import itertools
|
14 |
import pandas as pd
|
15 |
+
|
16 |
|
17 |
OUT_HEADERS = ['E','S','G']
|
18 |
DF_SP500 = pd.read_csv('SP500_constituents.zip',compression=dict(method='zip'))
|
|
|
29 |
def get_company_sectors(extracted_names, threshold=0.95):
|
30 |
'''
|
31 |
'''
|
32 |
+
from thefuzz import process, fuzz
|
33 |
output = []
|
34 |
standard_names_tuples = []
|
35 |
for extracted_name in extracted_names:
|
36 |
+
name_match = process.extractOne(extracted_name,
|
37 |
DF_SP500.Name,
|
38 |
+
scorer=fuzz.token_set_ratio)
|
39 |
similarity = name_match[1]/100
|
40 |
if similarity >= threshold:
|
41 |
standard_names_tuples.append(name_match[:2])
|