Commit
·
458a656
1
Parent(s):
f35c189
Update Climate_site/python_scripts/functions_contest.py
Browse files
Climate_site/python_scripts/functions_contest.py
CHANGED
|
@@ -9,6 +9,9 @@ import json
|
|
| 9 |
|
| 10 |
from sentence_transformers import SentenceTransformer, util
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
@st.cache_resource
|
| 13 |
def model_nlp():
|
| 14 |
model = SentenceTransformer('all-mpnet-base-v2')
|
|
@@ -16,7 +19,7 @@ def model_nlp():
|
|
| 16 |
|
| 17 |
|
| 18 |
def load_data():
|
| 19 |
-
url = "
|
| 20 |
dic = pd.read_csv(url, delimiter = "\t" , index_col = 0).to_dict('index')
|
| 21 |
return dic
|
| 22 |
|
|
@@ -46,7 +49,7 @@ def cosine_similarity2(vec_a, vec_b):
|
|
| 46 |
|
| 47 |
def print_extracted_text(name_file):
|
| 48 |
|
| 49 |
-
file = open('
|
| 50 |
lines = file.readlines()
|
| 51 |
count = 0
|
| 52 |
for index, line in enumerate(lines):
|
|
@@ -60,7 +63,7 @@ def print_extracted_text(name_file):
|
|
| 60 |
|
| 61 |
def details(name_file , display):
|
| 62 |
|
| 63 |
-
file = open("
|
| 64 |
lines = file.readlines()
|
| 65 |
|
| 66 |
mark = 0
|
|
@@ -103,7 +106,7 @@ def details(name_file , display):
|
|
| 103 |
|
| 104 |
def key_initiatives(name_file , display ):
|
| 105 |
|
| 106 |
-
file = open('
|
| 107 |
lines = file.readlines()
|
| 108 |
|
| 109 |
|
|
@@ -148,7 +151,7 @@ def key_initiatives(name_file , display ):
|
|
| 148 |
|
| 149 |
def deployment_target(name_file , display):
|
| 150 |
|
| 151 |
-
file = open('
|
| 152 |
lines = file.readlines()
|
| 153 |
|
| 154 |
|
|
@@ -192,7 +195,7 @@ def deployment_target(name_file , display):
|
|
| 192 |
|
| 193 |
def cost_reduction_target(name_file , display):
|
| 194 |
|
| 195 |
-
file = open('
|
| 196 |
lines = file.readlines()
|
| 197 |
|
| 198 |
mark = 0
|
|
@@ -237,7 +240,7 @@ def cost_reduction_target(name_file , display):
|
|
| 237 |
|
| 238 |
def key_words(name_file, display ):
|
| 239 |
|
| 240 |
-
file = open('
|
| 241 |
|
| 242 |
lines = file.readlines()
|
| 243 |
|
|
@@ -316,7 +319,7 @@ def key_words(name_file, display ):
|
|
| 316 |
|
| 317 |
def technology(name_file, display ):
|
| 318 |
# Filepath too specific, need to change to relative path
|
| 319 |
-
file = open('
|
| 320 |
lines = file.readlines()
|
| 321 |
|
| 322 |
list_categories = []
|
|
@@ -379,7 +382,7 @@ def technology(name_file, display ):
|
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
-
####################
|
| 383 |
|
| 384 |
|
| 385 |
def extract_quantitative_data_technology(technologies, number_technology):
|
|
|
|
| 9 |
|
| 10 |
from sentence_transformers import SentenceTransformer, util
|
| 11 |
|
| 12 |
+
|
| 13 |
+
path = 'Climate_site/python_scripts/'
|
| 14 |
+
|
| 15 |
@st.cache_resource
|
| 16 |
def model_nlp():
|
| 17 |
model = SentenceTransformer('all-mpnet-base-v2')
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
def load_data():
|
| 22 |
+
url = path + "big_ideas_contest.tsv"
|
| 23 |
dic = pd.read_csv(url, delimiter = "\t" , index_col = 0).to_dict('index')
|
| 24 |
return dic
|
| 25 |
|
|
|
|
| 49 |
|
| 50 |
def print_extracted_text(name_file):
|
| 51 |
|
| 52 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 53 |
lines = file.readlines()
|
| 54 |
count = 0
|
| 55 |
for index, line in enumerate(lines):
|
|
|
|
| 63 |
|
| 64 |
def details(name_file , display):
|
| 65 |
|
| 66 |
+
file = open(path + "iea.txt", "r")
|
| 67 |
lines = file.readlines()
|
| 68 |
|
| 69 |
mark = 0
|
|
|
|
| 106 |
|
| 107 |
def key_initiatives(name_file , display ):
|
| 108 |
|
| 109 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 110 |
lines = file.readlines()
|
| 111 |
|
| 112 |
|
|
|
|
| 151 |
|
| 152 |
def deployment_target(name_file , display):
|
| 153 |
|
| 154 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 155 |
lines = file.readlines()
|
| 156 |
|
| 157 |
|
|
|
|
| 195 |
|
| 196 |
def cost_reduction_target(name_file , display):
|
| 197 |
|
| 198 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 199 |
lines = file.readlines()
|
| 200 |
|
| 201 |
mark = 0
|
|
|
|
| 240 |
|
| 241 |
def key_words(name_file, display ):
|
| 242 |
|
| 243 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 244 |
|
| 245 |
lines = file.readlines()
|
| 246 |
|
|
|
|
| 319 |
|
| 320 |
def technology(name_file, display ):
|
| 321 |
# Filepath too specific, need to change to relative path
|
| 322 |
+
file = open(path + 'iea.txt', "r", encoding='utf8')
|
| 323 |
lines = file.readlines()
|
| 324 |
|
| 325 |
list_categories = []
|
|
|
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
+
#################### Contest Functions #############################
|
| 386 |
|
| 387 |
|
| 388 |
def extract_quantitative_data_technology(technologies, number_technology):
|