insight-finder / src /core.py
ALLOUNE
add dataset
c97a50e
raw
history blame
1.44 kB
from src.services.utils import *
from src.services.processor import *
dataset = load_data()
def process_input(data, dataset, data_type):
if data_type == "problem":
prompt = set_prompt(data.problem)
constraints = retrieve_constraints(prompt)
elif data_type == "constraints":
constraints = data
constraints_stemmed = stem(constraints, "constraints")
result_similarities, matrix = get_contrastive_similarities(constraints_stemmed, dataset)
save_to_pickle(result_similarities)
best_combinations = find_best_list_combinations(constraints_stemmed, dataset, matrix)
best_technologies_id = select_technologies(best_combinations)
best_technologies = get_technologies_by_id(best_technologies_id, dataset)
return best_technologies
def process_prior_art(technologies, data, data_type, techno_type):
try:
prior_art_reponse = search_prior_art(technologies, data, data_type, techno_type)
prior_art_search = add_citations_and_collect_uris(prior_art_reponse)
except Exception as e:
print(f"An error occured during the process, trying again : {e}")
prior_art_reponse = search_prior_art(technologies, data, data_type, techno_type)
prior_art_search = add_citations_and_collect_uris(prior_art_reponse)
print("PRIOR ART SEARCH")
print(prior_art_reponse)
print(prior_art_search)
return prior_art_search