Commit ·
e3bf330
1
Parent(s): 9b9ab55
Update Climate_site/python_scripts/paper_functions.py
Browse files
Climate_site/python_scripts/paper_functions.py
CHANGED
|
@@ -13,13 +13,6 @@ import matplotlib.pyplot as plt
|
|
| 13 |
import seaborn as sns
|
| 14 |
from math import radians, cos, sin, asin, sqrt
|
| 15 |
|
| 16 |
-
#import spacy
|
| 17 |
-
#spacy_nlp = spacy.load("en_core_web_lg")
|
| 18 |
-
|
| 19 |
-
#@st.cache_resource
|
| 20 |
-
#def spacy_func():
|
| 21 |
-
# spacy_nlp = spacy.load("en_core_web_lg")
|
| 22 |
-
# return spacy_nlp
|
| 23 |
|
| 24 |
from sentence_transformers import SentenceTransformer, util
|
| 25 |
|
|
@@ -29,9 +22,11 @@ def model_nlp():
|
|
| 29 |
return model
|
| 30 |
|
| 31 |
|
|
|
|
|
|
|
| 32 |
@st.cache_data # 👈 Add the caching decorator
|
| 33 |
def load_data():
|
| 34 |
-
url = "
|
| 35 |
dic = pd.read_csv(url, delimiter = "\t" , index_col = 1).to_dict('index')
|
| 36 |
return dic
|
| 37 |
|
|
@@ -102,7 +97,7 @@ def cosine_similarity2(vec_a, vec_b):
|
|
| 102 |
|
| 103 |
def print_extracted_text(name_file):
|
| 104 |
|
| 105 |
-
file = open('
|
| 106 |
lines = file.readlines()
|
| 107 |
count = 0
|
| 108 |
for index, line in enumerate(lines):
|
|
@@ -116,7 +111,7 @@ def print_extracted_text(name_file):
|
|
| 116 |
|
| 117 |
def details(name_file , display):
|
| 118 |
|
| 119 |
-
file = open("
|
| 120 |
lines = file.readlines()
|
| 121 |
|
| 122 |
mark = 0
|
|
@@ -159,7 +154,7 @@ def details(name_file , display):
|
|
| 159 |
|
| 160 |
def key_initiatives(name_file , display ):
|
| 161 |
|
| 162 |
-
file = open('
|
| 163 |
lines = file.readlines()
|
| 164 |
|
| 165 |
|
|
@@ -204,7 +199,7 @@ def key_initiatives(name_file , display ):
|
|
| 204 |
|
| 205 |
def deployment_target(name_file , display):
|
| 206 |
|
| 207 |
-
file = open('
|
| 208 |
lines = file.readlines()
|
| 209 |
|
| 210 |
|
|
@@ -248,7 +243,7 @@ def deployment_target(name_file , display):
|
|
| 248 |
|
| 249 |
def cost_reduction_target(name_file , display):
|
| 250 |
|
| 251 |
-
file = open('
|
| 252 |
lines = file.readlines()
|
| 253 |
|
| 254 |
mark = 0
|
|
@@ -293,7 +288,7 @@ def cost_reduction_target(name_file , display):
|
|
| 293 |
|
| 294 |
def key_words(name_file, display ):
|
| 295 |
|
| 296 |
-
file = open('
|
| 297 |
|
| 298 |
lines = file.readlines()
|
| 299 |
|
|
@@ -372,7 +367,7 @@ def key_words(name_file, display ):
|
|
| 372 |
|
| 373 |
def technology(name_file, display ):
|
| 374 |
# Filepath too specific, need to change to relative path
|
| 375 |
-
file = open('
|
| 376 |
lines = file.readlines()
|
| 377 |
|
| 378 |
list_categories = []
|
|
|
|
| 13 |
import seaborn as sns
|
| 14 |
from math import radians, cos, sin, asin, sqrt
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
from sentence_transformers import SentenceTransformer, util
|
| 18 |
|
|
|
|
| 22 |
return model
|
| 23 |
|
| 24 |
|
| 25 |
+
|
| 26 |
+
path = 'Climate_site/python_scripts/'
|
| 27 |
@st.cache_data # 👈 Add the caching decorator
|
| 28 |
def load_data():
|
| 29 |
+
url = path + "institutions.tsv"
|
| 30 |
dic = pd.read_csv(url, delimiter = "\t" , index_col = 1).to_dict('index')
|
| 31 |
return dic
|
| 32 |
|
|
|
|
| 97 |
|
| 98 |
def print_extracted_text(name_file):
|
| 99 |
|
| 100 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 101 |
lines = file.readlines()
|
| 102 |
count = 0
|
| 103 |
for index, line in enumerate(lines):
|
|
|
|
| 111 |
|
| 112 |
def details(name_file , display):
|
| 113 |
|
| 114 |
+
file = open(path + "iea.txt", "r")
|
| 115 |
lines = file.readlines()
|
| 116 |
|
| 117 |
mark = 0
|
|
|
|
| 154 |
|
| 155 |
def key_initiatives(name_file , display ):
|
| 156 |
|
| 157 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 158 |
lines = file.readlines()
|
| 159 |
|
| 160 |
|
|
|
|
| 199 |
|
| 200 |
def deployment_target(name_file , display):
|
| 201 |
|
| 202 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 203 |
lines = file.readlines()
|
| 204 |
|
| 205 |
|
|
|
|
| 243 |
|
| 244 |
def cost_reduction_target(name_file , display):
|
| 245 |
|
| 246 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 247 |
lines = file.readlines()
|
| 248 |
|
| 249 |
mark = 0
|
|
|
|
| 288 |
|
| 289 |
def key_words(name_file, display ):
|
| 290 |
|
| 291 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 292 |
|
| 293 |
lines = file.readlines()
|
| 294 |
|
|
|
|
| 367 |
|
| 368 |
def technology(name_file, display ):
|
| 369 |
# Filepath too specific, need to change to relative path
|
| 370 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 371 |
lines = file.readlines()
|
| 372 |
|
| 373 |
list_categories = []
|